func()

in v2/api/documentdb/v1api20210515/database_account_types_gen.go [1705:2090]


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)
		}
	}

	// 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 "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 "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 "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 "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 "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 "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 "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 "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
}