func()

in v2/api/apimanagement/v1api20230501preview/service_types_gen.go [1618:2043]


func (service *Service_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.Service_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.Service_STATUS, got %T", armInput)
	}

	// Set property "AdditionalLocations":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.AdditionalLocations {
			var item1 AdditionalLocation_STATUS
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.AdditionalLocations = append(service.AdditionalLocations, item1)
		}
	}

	// Set property "ApiVersionConstraint":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ApiVersionConstraint != nil {
			var apiVersionConstraint1 ApiVersionConstraint_STATUS
			err := apiVersionConstraint1.PopulateFromARM(owner, *typedInput.Properties.ApiVersionConstraint)
			if err != nil {
				return err
			}
			apiVersionConstraint := apiVersionConstraint1
			service.ApiVersionConstraint = &apiVersionConstraint
		}
	}

	// Set property "Certificates":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.Certificates {
			var item1 CertificateConfiguration_STATUS
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.Certificates = append(service.Certificates, item1)
		}
	}

	// no assignment for property "Conditions"

	// Set property "ConfigurationApi":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ConfigurationApi != nil {
			var configurationApi1 ConfigurationApi_STATUS
			err := configurationApi1.PopulateFromARM(owner, *typedInput.Properties.ConfigurationApi)
			if err != nil {
				return err
			}
			configurationApi := configurationApi1
			service.ConfigurationApi = &configurationApi
		}
	}

	// Set property "CreatedAtUtc":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CreatedAtUtc != nil {
			createdAtUtc := *typedInput.Properties.CreatedAtUtc
			service.CreatedAtUtc = &createdAtUtc
		}
	}

	// Set property "CustomProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CustomProperties != nil {
			service.CustomProperties = make(map[string]string, len(typedInput.Properties.CustomProperties))
			for key, value := range typedInput.Properties.CustomProperties {
				service.CustomProperties[key] = value
			}
		}
	}

	// Set property "DeveloperPortalStatus":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeveloperPortalStatus != nil {
			var temp string
			temp = string(*typedInput.Properties.DeveloperPortalStatus)
			developerPortalStatus := ApiManagementServiceProperties_DeveloperPortalStatus_STATUS(temp)
			service.DeveloperPortalStatus = &developerPortalStatus
		}
	}

	// Set property "DeveloperPortalUrl":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DeveloperPortalUrl != nil {
			developerPortalUrl := *typedInput.Properties.DeveloperPortalUrl
			service.DeveloperPortalUrl = &developerPortalUrl
		}
	}

	// Set property "DisableGateway":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableGateway != nil {
			disableGateway := *typedInput.Properties.DisableGateway
			service.DisableGateway = &disableGateway
		}
	}

	// Set property "EnableClientCertificate":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableClientCertificate != nil {
			enableClientCertificate := *typedInput.Properties.EnableClientCertificate
			service.EnableClientCertificate = &enableClientCertificate
		}
	}

	// Set property "Etag":
	if typedInput.Etag != nil {
		etag := *typedInput.Etag
		service.Etag = &etag
	}

	// Set property "GatewayRegionalUrl":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.GatewayRegionalUrl != nil {
			gatewayRegionalUrl := *typedInput.Properties.GatewayRegionalUrl
			service.GatewayRegionalUrl = &gatewayRegionalUrl
		}
	}

	// Set property "GatewayUrl":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.GatewayUrl != nil {
			gatewayUrl := *typedInput.Properties.GatewayUrl
			service.GatewayUrl = &gatewayUrl
		}
	}

	// Set property "HostnameConfigurations":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.HostnameConfigurations {
			var item1 HostnameConfiguration_STATUS
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.HostnameConfigurations = append(service.HostnameConfigurations, item1)
		}
	}

	// Set property "Id":
	if typedInput.Id != nil {
		id := *typedInput.Id
		service.Id = &id
	}

	// Set property "Identity":
	if typedInput.Identity != nil {
		var identity1 ApiManagementServiceIdentity_STATUS
		err := identity1.PopulateFromARM(owner, *typedInput.Identity)
		if err != nil {
			return err
		}
		identity := identity1
		service.Identity = &identity
	}

	// Set property "LegacyPortalStatus":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.LegacyPortalStatus != nil {
			var temp string
			temp = string(*typedInput.Properties.LegacyPortalStatus)
			legacyPortalStatus := ApiManagementServiceProperties_LegacyPortalStatus_STATUS(temp)
			service.LegacyPortalStatus = &legacyPortalStatus
		}
	}

	// Set property "Location":
	if typedInput.Location != nil {
		location := *typedInput.Location
		service.Location = &location
	}

	// Set property "ManagementApiUrl":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ManagementApiUrl != nil {
			managementApiUrl := *typedInput.Properties.ManagementApiUrl
			service.ManagementApiUrl = &managementApiUrl
		}
	}

	// Set property "Name":
	if typedInput.Name != nil {
		name := *typedInput.Name
		service.Name = &name
	}

	// Set property "NatGatewayState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NatGatewayState != nil {
			var temp string
			temp = string(*typedInput.Properties.NatGatewayState)
			natGatewayState := ApiManagementServiceProperties_NatGatewayState_STATUS(temp)
			service.NatGatewayState = &natGatewayState
		}
	}

	// Set property "NotificationSenderEmail":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NotificationSenderEmail != nil {
			notificationSenderEmail := *typedInput.Properties.NotificationSenderEmail
			service.NotificationSenderEmail = &notificationSenderEmail
		}
	}

	// Set property "OutboundPublicIPAddresses":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.OutboundPublicIPAddresses {
			service.OutboundPublicIPAddresses = append(service.OutboundPublicIPAddresses, item)
		}
	}

	// Set property "PlatformVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PlatformVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.PlatformVersion)
			platformVersion := ApiManagementServiceProperties_PlatformVersion_STATUS(temp)
			service.PlatformVersion = &platformVersion
		}
	}

	// Set property "PortalUrl":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PortalUrl != nil {
			portalUrl := *typedInput.Properties.PortalUrl
			service.PortalUrl = &portalUrl
		}
	}

	// Set property "PrivateEndpointConnections":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.PrivateEndpointConnections {
			var item1 RemotePrivateEndpointConnectionWrapper_STATUS
			err := item1.PopulateFromARM(owner, item)
			if err != nil {
				return err
			}
			service.PrivateEndpointConnections = append(service.PrivateEndpointConnections, item1)
		}
	}

	// Set property "PrivateIPAddresses":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.PrivateIPAddresses {
			service.PrivateIPAddresses = append(service.PrivateIPAddresses, item)
		}
	}

	// Set property "ProvisioningState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProvisioningState != nil {
			provisioningState := *typedInput.Properties.ProvisioningState
			service.ProvisioningState = &provisioningState
		}
	}

	// Set property "PublicIPAddresses":
	// copying flattened property:
	if typedInput.Properties != nil {
		for _, item := range typedInput.Properties.PublicIPAddresses {
			service.PublicIPAddresses = append(service.PublicIPAddresses, item)
		}
	}

	// Set property "PublicIpAddressId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicIpAddressId != nil {
			publicIpAddressId := *typedInput.Properties.PublicIpAddressId
			service.PublicIpAddressId = &publicIpAddressId
		}
	}

	// Set property "PublicNetworkAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublicNetworkAccess != nil {
			var temp string
			temp = string(*typedInput.Properties.PublicNetworkAccess)
			publicNetworkAccess := ApiManagementServiceProperties_PublicNetworkAccess_STATUS(temp)
			service.PublicNetworkAccess = &publicNetworkAccess
		}
	}

	// Set property "PublisherEmail":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublisherEmail != nil {
			publisherEmail := *typedInput.Properties.PublisherEmail
			service.PublisherEmail = &publisherEmail
		}
	}

	// Set property "PublisherName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PublisherName != nil {
			publisherName := *typedInput.Properties.PublisherName
			service.PublisherName = &publisherName
		}
	}

	// Set property "Restore":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Restore != nil {
			restore := *typedInput.Properties.Restore
			service.Restore = &restore
		}
	}

	// Set property "ScmUrl":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ScmUrl != nil {
			scmUrl := *typedInput.Properties.ScmUrl
			service.ScmUrl = &scmUrl
		}
	}

	// Set property "Sku":
	if typedInput.Sku != nil {
		var sku1 ApiManagementServiceSkuProperties_STATUS
		err := sku1.PopulateFromARM(owner, *typedInput.Sku)
		if err != nil {
			return err
		}
		sku := sku1
		service.Sku = &sku
	}

	// Set property "SystemData":
	if typedInput.SystemData != nil {
		var systemData1 SystemData_STATUS
		err := systemData1.PopulateFromARM(owner, *typedInput.SystemData)
		if err != nil {
			return err
		}
		systemData := systemData1
		service.SystemData = &systemData
	}

	// Set property "Tags":
	if typedInput.Tags != nil {
		service.Tags = make(map[string]string, len(typedInput.Tags))
		for key, value := range typedInput.Tags {
			service.Tags[key] = value
		}
	}

	// Set property "TargetProvisioningState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TargetProvisioningState != nil {
			targetProvisioningState := *typedInput.Properties.TargetProvisioningState
			service.TargetProvisioningState = &targetProvisioningState
		}
	}

	// Set property "Type":
	if typedInput.Type != nil {
		typeVar := *typedInput.Type
		service.Type = &typeVar
	}

	// Set property "VirtualNetworkConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.VirtualNetworkConfiguration != nil {
			var virtualNetworkConfiguration1 VirtualNetworkConfiguration_STATUS
			err := virtualNetworkConfiguration1.PopulateFromARM(owner, *typedInput.Properties.VirtualNetworkConfiguration)
			if err != nil {
				return err
			}
			virtualNetworkConfiguration := virtualNetworkConfiguration1
			service.VirtualNetworkConfiguration = &virtualNetworkConfiguration
		}
	}

	// Set property "VirtualNetworkType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.VirtualNetworkType != nil {
			var temp string
			temp = string(*typedInput.Properties.VirtualNetworkType)
			virtualNetworkType := ApiManagementServiceProperties_VirtualNetworkType_STATUS(temp)
			service.VirtualNetworkType = &virtualNetworkType
		}
	}

	// Set property "Zones":
	for _, item := range typedInput.Zones {
		service.Zones = append(service.Zones, item)
	}

	// No error
	return nil
}