func()

in v2/api/compute/v1api20200930/disk_types_gen.go [1332:1642]


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

	// Set property "BurstingEnabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.BurstingEnabled != nil {
			burstingEnabled := *typedInput.Properties.BurstingEnabled
			disk.BurstingEnabled = &burstingEnabled
		}
	}

	// no assignment for property "Conditions"

	// 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
			disk.CreationData = &creationData
		}
	}

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

	// Set property "DiskIOPSReadOnly":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskIOPSReadOnly != nil {
			diskIOPSReadOnly := *typedInput.Properties.DiskIOPSReadOnly
			disk.DiskIOPSReadOnly = &diskIOPSReadOnly
		}
	}

	// Set property "DiskIOPSReadWrite":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskIOPSReadWrite != nil {
			diskIOPSReadWrite := *typedInput.Properties.DiskIOPSReadWrite
			disk.DiskIOPSReadWrite = &diskIOPSReadWrite
		}
	}

	// Set property "DiskMBpsReadOnly":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskMBpsReadOnly != nil {
			diskMBpsReadOnly := *typedInput.Properties.DiskMBpsReadOnly
			disk.DiskMBpsReadOnly = &diskMBpsReadOnly
		}
	}

	// Set property "DiskMBpsReadWrite":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskMBpsReadWrite != nil {
			diskMBpsReadWrite := *typedInput.Properties.DiskMBpsReadWrite
			disk.DiskMBpsReadWrite = &diskMBpsReadWrite
		}
	}

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

	// Set property "DiskSizeGB":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.DiskSizeGB != nil {
			diskSizeGB := *typedInput.Properties.DiskSizeGB
			disk.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)
			disk.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
			disk.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
			disk.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
		disk.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 := DiskProperties_HyperVGeneration_STATUS(temp)
			disk.HyperVGeneration = &hyperVGeneration
		}
	}

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

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

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

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

	// Set property "MaxShares":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.MaxShares != nil {
			maxShares := *typedInput.Properties.MaxShares
			disk.MaxShares = &maxShares
		}
	}

	// Set property "Name":
	if typedInput.Name != nil {
		name := *typedInput.Name
		disk.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)
			disk.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 := DiskProperties_OsType_STATUS(temp)
			disk.OsType = &osType
		}
	}

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

	// 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
			disk.PurchasePlan = &purchasePlan
		}
	}

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

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

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

	// Set property "Tier":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Tier != nil {
			tier := *typedInput.Properties.Tier
			disk.Tier = &tier
		}
	}

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

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

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

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

	// No error
	return nil
}