func()

in v2/api/documentdb/v1api20231115/database_account_types_gen.go [2059:2564]


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

	// Set property "AnalyticalStorageConfiguration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.AnalyticalStorageConfiguration != nil {
			var analyticalStorageConfiguration1 AnalyticalStorageConfiguration_STATUS
			err := analyticalStorageConfiguration1.PopulateFromARM(owner, *typedInput.Properties.AnalyticalStorageConfiguration)
			if err != nil {
				return err
			}
			analyticalStorageConfiguration := analyticalStorageConfiguration1
			account.AnalyticalStorageConfiguration = &analyticalStorageConfiguration
		}
	}

	// Set property "ApiProperties":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ApiProperties != nil {
			var apiProperties1 ApiProperties_STATUS
			err := apiProperties1.PopulateFromARM(owner, *typedInput.Properties.ApiProperties)
			if err != nil {
				return err
			}
			apiProperties := apiProperties1
			account.ApiProperties = &apiProperties
		}
	}

	// Set property "BackupPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BackupPolicy != nil {
			var backupPolicy1 BackupPolicy_STATUS
			err := backupPolicy1.PopulateFromARM(owner, *typedInput.Properties.BackupPolicy)
			if err != nil {
				return err
			}
			backupPolicy := backupPolicy1
			account.BackupPolicy = &backupPolicy
		}
	}

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

	// Set property "Capacity":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Capacity != nil {
			var capacity1 Capacity_STATUS
			err := capacity1.PopulateFromARM(owner, *typedInput.Properties.Capacity)
			if err != nil {
				return err
			}
			capacity := capacity1
			account.Capacity = &capacity
		}
	}

	// no assignment for property "Conditions"

	// Set property "ConnectorOffer":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ConnectorOffer != nil {
			var temp string
			temp = string(*typedInput.Properties.ConnectorOffer)
			connectorOffer := ConnectorOffer_STATUS(temp)
			account.ConnectorOffer = &connectorOffer
		}
	}

	// Set property "ConsistencyPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ConsistencyPolicy != nil {
			var consistencyPolicy1 ConsistencyPolicy_STATUS
			err := consistencyPolicy1.PopulateFromARM(owner, *typedInput.Properties.ConsistencyPolicy)
			if err != nil {
				return err
			}
			consistencyPolicy := consistencyPolicy1
			account.ConsistencyPolicy = &consistencyPolicy
		}
	}

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

	// Set property "CreateMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CreateMode != nil {
			var temp string
			temp = string(*typedInput.Properties.CreateMode)
			createMode := CreateMode_STATUS(temp)
			account.CreateMode = &createMode
		}
	}

	// Set property "CustomerManagedKeyStatus":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CustomerManagedKeyStatus != nil {
			customerManagedKeyStatus := *typedInput.Properties.CustomerManagedKeyStatus
			account.CustomerManagedKeyStatus = &customerManagedKeyStatus
		}
	}

	// Set property "DatabaseAccountOfferType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DatabaseAccountOfferType != nil {
			var temp string
			temp = string(*typedInput.Properties.DatabaseAccountOfferType)
			databaseAccountOfferType := DatabaseAccountOfferType_STATUS(temp)
			account.DatabaseAccountOfferType = &databaseAccountOfferType
		}
	}

	// Set property "DefaultIdentity":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DefaultIdentity != nil {
			defaultIdentity := *typedInput.Properties.DefaultIdentity
			account.DefaultIdentity = &defaultIdentity
		}
	}

	// Set property "DisableKeyBasedMetadataWriteAccess":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableKeyBasedMetadataWriteAccess != nil {
			disableKeyBasedMetadataWriteAccess := *typedInput.Properties.DisableKeyBasedMetadataWriteAccess
			account.DisableKeyBasedMetadataWriteAccess = &disableKeyBasedMetadataWriteAccess
		}
	}

	// Set property "DisableLocalAuth":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DisableLocalAuth != nil {
			disableLocalAuth := *typedInput.Properties.DisableLocalAuth
			account.DisableLocalAuth = &disableLocalAuth
		}
	}

	// Set property "DocumentEndpoint":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DocumentEndpoint != nil {
			documentEndpoint := *typedInput.Properties.DocumentEndpoint
			account.DocumentEndpoint = &documentEndpoint
		}
	}

	// Set property "EnableAnalyticalStorage":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableAnalyticalStorage != nil {
			enableAnalyticalStorage := *typedInput.Properties.EnableAnalyticalStorage
			account.EnableAnalyticalStorage = &enableAnalyticalStorage
		}
	}

	// Set property "EnableAutomaticFailover":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableAutomaticFailover != nil {
			enableAutomaticFailover := *typedInput.Properties.EnableAutomaticFailover
			account.EnableAutomaticFailover = &enableAutomaticFailover
		}
	}

	// Set property "EnableBurstCapacity":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableBurstCapacity != nil {
			enableBurstCapacity := *typedInput.Properties.EnableBurstCapacity
			account.EnableBurstCapacity = &enableBurstCapacity
		}
	}

	// Set property "EnableCassandraConnector":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableCassandraConnector != nil {
			enableCassandraConnector := *typedInput.Properties.EnableCassandraConnector
			account.EnableCassandraConnector = &enableCassandraConnector
		}
	}

	// Set property "EnableFreeTier":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableFreeTier != nil {
			enableFreeTier := *typedInput.Properties.EnableFreeTier
			account.EnableFreeTier = &enableFreeTier
		}
	}

	// Set property "EnableMultipleWriteLocations":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnableMultipleWriteLocations != nil {
			enableMultipleWriteLocations := *typedInput.Properties.EnableMultipleWriteLocations
			account.EnableMultipleWriteLocations = &enableMultipleWriteLocations
		}
	}

	// Set property "EnablePartitionMerge":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EnablePartitionMerge != nil {
			enablePartitionMerge := *typedInput.Properties.EnablePartitionMerge
			account.EnablePartitionMerge = &enablePartitionMerge
		}
	}

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

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

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

	// Set property "InstanceId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.InstanceId != nil {
			instanceId := *typedInput.Properties.InstanceId
			account.InstanceId = &instanceId
		}
	}

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

	// Set property "IsVirtualNetworkFilterEnabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IsVirtualNetworkFilterEnabled != nil {
			isVirtualNetworkFilterEnabled := *typedInput.Properties.IsVirtualNetworkFilterEnabled
			account.IsVirtualNetworkFilterEnabled = &isVirtualNetworkFilterEnabled
		}
	}

	// Set property "KeyVaultKeyUri":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KeyVaultKeyUri != nil {
			keyVaultKeyUri := *typedInput.Properties.KeyVaultKeyUri
			account.KeyVaultKeyUri = &keyVaultKeyUri
		}
	}

	// Set property "KeysMetadata":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.KeysMetadata != nil {
			var keysMetadata1 DatabaseAccountKeysMetadata_STATUS
			err := keysMetadata1.PopulateFromARM(owner, *typedInput.Properties.KeysMetadata)
			if err != nil {
				return err
			}
			keysMetadata := keysMetadata1
			account.KeysMetadata = &keysMetadata
		}
	}

	// Set property "Kind":
	if typedInput.Kind != nil {
		var temp string
		temp = string(*typedInput.Kind)
		kind := DatabaseAccount_Kind_STATUS(temp)
		account.Kind = &kind
	}

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

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

	// Set property "MinimalTlsVersion":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MinimalTlsVersion != nil {
			var temp string
			temp = string(*typedInput.Properties.MinimalTlsVersion)
			minimalTlsVersion := MinimalTlsVersion_STATUS(temp)
			account.MinimalTlsVersion = &minimalTlsVersion
		}
	}

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

	// Set property "NetworkAclBypass":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NetworkAclBypass != nil {
			var temp string
			temp = string(*typedInput.Properties.NetworkAclBypass)
			networkAclBypass := NetworkAclBypass_STATUS(temp)
			account.NetworkAclBypass = &networkAclBypass
		}
	}

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

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

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

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

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

	// Set property "RestoreParameters":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RestoreParameters != nil {
			var restoreParameters1 RestoreParameters_STATUS
			err := restoreParameters1.PopulateFromARM(owner, *typedInput.Properties.RestoreParameters)
			if err != nil {
				return err
			}
			restoreParameters := restoreParameters1
			account.RestoreParameters = &restoreParameters
		}
	}

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

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

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

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

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

	// No error
	return nil
}