func (o *ProcessingUnit) Validate() error {

	errors := elemental.Errors{}
	requiredErrors := elemental.Errors{}

	if err := ValidateTagsWithoutReservedPrefixes("associatedTags", o.AssociatedTags); err != nil {
		errors = errors.Append(err)
	}

	if err := elemental.ValidateStringInList("datapathType", string(o.DatapathType), []string{"Aporeto", "EnvoyAuthorizer"}, false); err != nil {
		errors = errors.Append(err)
	}

	if err := elemental.ValidateMaximumLength("description", o.Description, 1024, false); err != nil {
		errors = errors.Append(err)
	}

	if err := elemental.ValidateStringInList("enforcementStatus", string(o.EnforcementStatus), []string{"Active", "Failed", "Inactive"}, false); err != nil {
		errors = errors.Append(err)
	}

	if err := ValidateMetadata("metadata", o.Metadata); err != nil {
		errors = errors.Append(err)
	}

	if err := elemental.ValidateRequiredString("name", o.Name); err != nil {
		requiredErrors = requiredErrors.Append(err)
	}

	if err := elemental.ValidateMaximumLength("name", o.Name, 256, false); err != nil {
		errors = errors.Append(err)
	}

	for _, sub := range o.NetworkServices {
		if sub == nil {
			continue
		}
		elemental.ResetDefaultForZeroValues(sub)
		if err := sub.Validate(); err != nil {
			errors = errors.Append(err)
		}
	}

	if err := ValidateProcessingUnitServicesList("networkServices", o.NetworkServices); err != nil {
		errors = errors.Append(err)
	}

	if err := elemental.ValidateStringInList("operationalStatus", string(o.OperationalStatus), []string{"Initialized", "Paused", "Running", "Stopped", "Terminated"}, false); err != nil {
		errors = errors.Append(err)
	}

	if o.Tracing != nil {
		elemental.ResetDefaultForZeroValues(o.Tracing)
		if err := o.Tracing.Validate(); err != nil {
			errors = errors.Append(err)
		}
	}

	if err := elemental.ValidateStringInList("type", string(o.Type), []string{"APIGateway", "Docker", "Host", "HostService", "LinuxService", "WindowsService", "RKT", "User", "SSHSession"}, false); err != nil {
		errors = errors.Append(err)
	}

	if len(requiredErrors) > 0 {
		return requiredErrors
	}

	if len(errors) > 0 {
		return errors
	}

	return nil
}
// Validate valides the current information stored into the structure.
Validate valides the current information stored into the structure.
// Validate valides the current information stored into the structure .
func (o *ProcessingUnit) Validate() error {
	errors := elemental.Errors{}
	requiredErrors := elemental.Errors{}
	if err := ValidateTagsWithoutReservedPrefixes("associatedTags", o.AssociatedTags); err != nil {
		errors = errors.Append(err)
	}
	if err := elemental.ValidateStringInList("datapathType", string(o.DatapathType), []string{"Aporeto", "EnvoyAuthorizer"}, false); err != nil {
		errors = errors.Append(err)
	}
	if err := elemental.ValidateMaximumLength("description", o.Description, 1024, false); err != nil {
		errors = errors.Append(err)
	}
	if err := elemental.ValidateStringInList("enforcementStatus", string(o.EnforcementStatus), []string{"Active", "Failed", "Inactive"}, false); err != nil {
		errors = errors.Append(err)
	}
	if err := ValidateMetadata("metadata", o.Metadata); err != nil {
		errors = errors.Append(err)
	}
	if err := elemental.ValidateRequiredString("name", o.Name); err != nil {
		requiredErrors = requiredErrors.Append(err)
	}
	if err := elemental.ValidateMaximumLength("name", o.Name, 256, false); err != nil {
		errors = errors.Append(err)
	}
	for _, sub := range o.NetworkServices {
		if sub == nil {
			continue
		}
		elemental.ResetDefaultForZeroValues(sub)
		if err := sub.Validate(); err != nil {
			errors = errors.Append(err)
		}
	}
	if err := ValidateProcessingUnitServicesList("networkServices", o.NetworkServices); err != nil {
		errors = errors.Append(err)
	}
	if err := elemental.ValidateStringInList("operationalStatus", string(o.OperationalStatus), []string{"Initialized", "Paused", "Running", "Stopped", "Terminated"}, false); err != nil {
		errors = errors.Append(err)
	}
	if o.Tracing != nil {
		elemental.ResetDefaultForZeroValues(o.Tracing)
		if err := o.Tracing.Validate(); err != nil {
			errors = errors.Append(err)
		}
	}
	if err := elemental.ValidateStringInList("type", string(o.Type), []string{"APIGateway", "Docker", "Host", "HostService", "LinuxService", "WindowsService", "RKT", "User", "SSHSession"}, false); err != nil {
		errors = errors.Append(err)
	}
	if len(requiredErrors) > 0 {
		return requiredErrors
	}
	if len(errors) > 0 {
		return errors
	}
	return nil
}
func ( o * ProcessingUnit ) Validate ( ) error { errors := elemental . Errors { } requiredErrors := elemental . Errors { } if err := ValidateTagsWithoutReservedPrefixes ( " " , o . AssociatedTags ) ; err != nil { errors = errors . Append ( err ) } if err := elemental . ValidateStringInList ( " " , string ( o . DatapathType ) , [ ] string { " " , " " } , false ) ; err != nil { errors = errors . Append ( err ) } if err := elemental . ValidateMaximumLength ( " " , o . Description , 1024 , false ) ; err != nil { errors = errors . Append ( err ) } if err := elemental . ValidateStringInList ( " " , string ( o . EnforcementStatus ) , [ ] string { " " , " " , " " } , false ) ; err != nil { errors = errors . Append ( err ) } if err := ValidateMetadata ( " " , o . Metadata ) ; err != nil { errors = errors . Append ( err ) } if err := elemental . ValidateRequiredString ( " " , o . Name ) ; err != nil { requiredErrors = requiredErrors . Append ( err ) } if err := elemental . ValidateMaximumLength ( " " , o . Name , 256 , false ) ; err != nil { errors = errors . Append ( err ) } for _ , sub := range o . NetworkServices { if sub == nil { continue } elemental . ResetDefaultForZeroValues ( sub ) if err := sub . Validate ( ) ; err != nil { errors = errors . Append ( err ) } } if err := ValidateProcessingUnitServicesList ( " " , o . NetworkServices ) ; err != nil { errors = errors . Append ( err ) } if err := elemental . ValidateStringInList ( " " , string ( o . OperationalStatus ) , [ ] string { " " , " " , " " , " " , " " } , false ) ; err != nil { errors = errors . Append ( err ) } if o . Tracing != nil { elemental . ResetDefaultForZeroValues ( o . Tracing ) if err := o . Tracing . Validate ( ) ; err != nil { errors = errors . Append ( err ) } } if err := elemental . ValidateStringInList ( " " , string ( o . Type ) , [ ] string { " " , " " , " " , " " , " " , " " , " " , " " , " " } , false ) ; err != nil { errors = errors . Append ( err ) } if len ( requiredErrors ) > 0 { return requiredErrors } if len ( errors ) > 0 { return errors } return nil }
Validate valides the current information stored into the structure.
Validate valides the current information stored into the structure .