func()

in v2/api/compute/v1api20240302/snapshot_types_gen.go [1689:2013]


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

	// Set property "CompletionPercent":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CompletionPercent != nil {
			completionPercent := *typedInput.Properties.CompletionPercent
			snapshot.CompletionPercent = &completionPercent
		}
	}

	// no assignment for property "Conditions"

	// Set property "CopyCompletionError":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CopyCompletionError != nil {
			var copyCompletionError1 CopyCompletionError_STATUS
			err := copyCompletionError1.PopulateFromARM(owner, *typedInput.Properties.CopyCompletionError)
			if err != nil {
				return err
			}
			copyCompletionError := copyCompletionError1
			snapshot.CopyCompletionError = &copyCompletionError
		}
	}

	// Set property "CreationData":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CreationData != nil {
			var creationData1 CreationData_STATUS
			err := creationData1.PopulateFromARM(owner, *typedInput.Properties.CreationData)
			if err != nil {
				return err
			}
			creationData := creationData1
			snapshot.CreationData = &creationData
		}
	}

	// Set property "DataAccessAuthMode":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DataAccessAuthMode != nil {
			var temp string
			temp = string(*typedInput.Properties.DataAccessAuthMode)
			dataAccessAuthMode := DataAccessAuthMode_STATUS(temp)
			snapshot.DataAccessAuthMode = &dataAccessAuthMode
		}
	}

	// Set property "DiskAccessId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskAccessId != nil {
			diskAccessId := *typedInput.Properties.DiskAccessId
			snapshot.DiskAccessId = &diskAccessId
		}
	}

	// Set property "DiskSizeBytes":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskSizeBytes != nil {
			diskSizeBytes := *typedInput.Properties.DiskSizeBytes
			snapshot.DiskSizeBytes = &diskSizeBytes
		}
	}

	// Set property "DiskSizeGB":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskSizeGB != nil {
			diskSizeGB := *typedInput.Properties.DiskSizeGB
			snapshot.DiskSizeGB = &diskSizeGB
		}
	}

	// Set property "DiskState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskState != nil {
			var temp string
			temp = string(*typedInput.Properties.DiskState)
			diskState := DiskState_STATUS(temp)
			snapshot.DiskState = &diskState
		}
	}

	// Set property "Encryption":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Encryption != nil {
			var encryption1 Encryption_STATUS
			err := encryption1.PopulateFromARM(owner, *typedInput.Properties.Encryption)
			if err != nil {
				return err
			}
			encryption := encryption1
			snapshot.Encryption = &encryption
		}
	}

	// Set property "EncryptionSettingsCollection":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.EncryptionSettingsCollection != nil {
			var encryptionSettingsCollection1 EncryptionSettingsCollection_STATUS
			err := encryptionSettingsCollection1.PopulateFromARM(owner, *typedInput.Properties.EncryptionSettingsCollection)
			if err != nil {
				return err
			}
			encryptionSettingsCollection := encryptionSettingsCollection1
			snapshot.EncryptionSettingsCollection = &encryptionSettingsCollection
		}
	}

	// Set property "ExtendedLocation":
	if typedInput.ExtendedLocation != nil {
		var extendedLocation1 ExtendedLocation_STATUS
		err := extendedLocation1.PopulateFromARM(owner, *typedInput.ExtendedLocation)
		if err != nil {
			return err
		}
		extendedLocation := extendedLocation1
		snapshot.ExtendedLocation = &extendedLocation
	}

	// Set property "HyperVGeneration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.HyperVGeneration != nil {
			var temp string
			temp = string(*typedInput.Properties.HyperVGeneration)
			hyperVGeneration := SnapshotProperties_HyperVGeneration_STATUS(temp)
			snapshot.HyperVGeneration = &hyperVGeneration
		}
	}

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

	// Set property "Incremental":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Incremental != nil {
			incremental := *typedInput.Properties.Incremental
			snapshot.Incremental = &incremental
		}
	}

	// Set property "IncrementalSnapshotFamilyId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.IncrementalSnapshotFamilyId != nil {
			incrementalSnapshotFamilyId := *typedInput.Properties.IncrementalSnapshotFamilyId
			snapshot.IncrementalSnapshotFamilyId = &incrementalSnapshotFamilyId
		}
	}

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

	// Set property "ManagedBy":
	if typedInput.ManagedBy != nil {
		managedBy := *typedInput.ManagedBy
		snapshot.ManagedBy = &managedBy
	}

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

	// Set property "NetworkAccessPolicy":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.NetworkAccessPolicy != nil {
			var temp string
			temp = string(*typedInput.Properties.NetworkAccessPolicy)
			networkAccessPolicy := NetworkAccessPolicy_STATUS(temp)
			snapshot.NetworkAccessPolicy = &networkAccessPolicy
		}
	}

	// Set property "OsType":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.OsType != nil {
			var temp string
			temp = string(*typedInput.Properties.OsType)
			osType := SnapshotProperties_OsType_STATUS(temp)
			snapshot.OsType = &osType
		}
	}

	// Set property "ProvisioningState":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ProvisioningState != nil {
			provisioningState := *typedInput.Properties.ProvisioningState
			snapshot.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)
			snapshot.PublicNetworkAccess = &publicNetworkAccess
		}
	}

	// Set property "PurchasePlan":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.PurchasePlan != nil {
			var purchasePlan1 PurchasePlan_STATUS
			err := purchasePlan1.PopulateFromARM(owner, *typedInput.Properties.PurchasePlan)
			if err != nil {
				return err
			}
			purchasePlan := purchasePlan1
			snapshot.PurchasePlan = &purchasePlan
		}
	}

	// Set property "SecurityProfile":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SecurityProfile != nil {
			var securityProfile1 DiskSecurityProfile_STATUS
			err := securityProfile1.PopulateFromARM(owner, *typedInput.Properties.SecurityProfile)
			if err != nil {
				return err
			}
			securityProfile := securityProfile1
			snapshot.SecurityProfile = &securityProfile
		}
	}

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

	// Set property "SupportedCapabilities":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SupportedCapabilities != nil {
			var supportedCapabilities1 SupportedCapabilities_STATUS
			err := supportedCapabilities1.PopulateFromARM(owner, *typedInput.Properties.SupportedCapabilities)
			if err != nil {
				return err
			}
			supportedCapabilities := supportedCapabilities1
			snapshot.SupportedCapabilities = &supportedCapabilities
		}
	}

	// Set property "SupportsHibernation":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SupportsHibernation != nil {
			supportsHibernation := *typedInput.Properties.SupportsHibernation
			snapshot.SupportsHibernation = &supportsHibernation
		}
	}

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

	// Set property "TimeCreated":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TimeCreated != nil {
			timeCreated := *typedInput.Properties.TimeCreated
			snapshot.TimeCreated = &timeCreated
		}
	}

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

	// Set property "UniqueId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.UniqueId != nil {
			uniqueId := *typedInput.Properties.UniqueId
			snapshot.UniqueId = &uniqueId
		}
	}

	// No error
	return nil
}