// Code generated by azure-service-operator-codegen. DO NOT EDIT.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
package v1api20180501

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/network/v1api20180501/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/network/v1api20180501/storage"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/configmaps"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/core"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/secrets"
	"github.com/rotisserie/eris"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
	"sigs.k8s.io/controller-runtime/pkg/conversion"
)

// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={azure,network}
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].severity"
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
// Generator information:
// - Generated from: /dns/resource-manager/Microsoft.Network/Dns/stable/2018-05-01/dns.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/CAA/{relativeRecordSetName}
type DnsZonesCAARecord struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              DnsZonesCAARecord_Spec   `json:"spec,omitempty"`
	Status            DnsZonesCAARecord_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &DnsZonesCAARecord{}

// GetConditions returns the conditions of the resource
func (record *DnsZonesCAARecord) GetConditions() conditions.Conditions {
	return record.Status.Conditions
}

// SetConditions sets the conditions on the resource status
func (record *DnsZonesCAARecord) SetConditions(conditions conditions.Conditions) {
	record.Status.Conditions = conditions
}

var _ conversion.Convertible = &DnsZonesCAARecord{}

// ConvertFrom populates our DnsZonesCAARecord from the provided hub DnsZonesCAARecord
func (record *DnsZonesCAARecord) ConvertFrom(hub conversion.Hub) error {
	source, ok := hub.(*storage.DnsZonesCAARecord)
	if !ok {
		return fmt.Errorf("expected network/v1api20180501/storage/DnsZonesCAARecord but received %T instead", hub)
	}

	return record.AssignProperties_From_DnsZonesCAARecord(source)
}

// ConvertTo populates the provided hub DnsZonesCAARecord from our DnsZonesCAARecord
func (record *DnsZonesCAARecord) ConvertTo(hub conversion.Hub) error {
	destination, ok := hub.(*storage.DnsZonesCAARecord)
	if !ok {
		return fmt.Errorf("expected network/v1api20180501/storage/DnsZonesCAARecord but received %T instead", hub)
	}

	return record.AssignProperties_To_DnsZonesCAARecord(destination)
}

var _ configmaps.Exporter = &DnsZonesCAARecord{}

// ConfigMapDestinationExpressions returns the Spec.OperatorSpec.ConfigMapExpressions property
func (record *DnsZonesCAARecord) ConfigMapDestinationExpressions() []*core.DestinationExpression {
	if record.Spec.OperatorSpec == nil {
		return nil
	}
	return record.Spec.OperatorSpec.ConfigMapExpressions
}

var _ secrets.Exporter = &DnsZonesCAARecord{}

// SecretDestinationExpressions returns the Spec.OperatorSpec.SecretExpressions property
func (record *DnsZonesCAARecord) SecretDestinationExpressions() []*core.DestinationExpression {
	if record.Spec.OperatorSpec == nil {
		return nil
	}
	return record.Spec.OperatorSpec.SecretExpressions
}

var _ genruntime.ImportableResource = &DnsZonesCAARecord{}

// InitializeSpec initializes the spec for this resource from the given status
func (record *DnsZonesCAARecord) InitializeSpec(status genruntime.ConvertibleStatus) error {
	if s, ok := status.(*DnsZonesCAARecord_STATUS); ok {
		return record.Spec.Initialize_From_DnsZonesCAARecord_STATUS(s)
	}

	return fmt.Errorf("expected Status of type DnsZonesCAARecord_STATUS but received %T instead", status)
}

var _ genruntime.KubernetesResource = &DnsZonesCAARecord{}

// AzureName returns the Azure name of the resource
func (record *DnsZonesCAARecord) AzureName() string {
	return record.Spec.AzureName
}

// GetAPIVersion returns the ARM API version of the resource. This is always "2018-05-01"
func (record DnsZonesCAARecord) GetAPIVersion() string {
	return "2018-05-01"
}

// GetResourceScope returns the scope of the resource
func (record *DnsZonesCAARecord) GetResourceScope() genruntime.ResourceScope {
	return genruntime.ResourceScopeResourceGroup
}

// GetSpec returns the specification of this resource
func (record *DnsZonesCAARecord) GetSpec() genruntime.ConvertibleSpec {
	return &record.Spec
}

// GetStatus returns the status of this resource
func (record *DnsZonesCAARecord) GetStatus() genruntime.ConvertibleStatus {
	return &record.Status
}

// GetSupportedOperations returns the operations supported by the resource
func (record *DnsZonesCAARecord) GetSupportedOperations() []genruntime.ResourceOperation {
	return []genruntime.ResourceOperation{
		genruntime.ResourceOperationDelete,
		genruntime.ResourceOperationGet,
		genruntime.ResourceOperationPut,
	}
}

// GetType returns the ARM Type of the resource. This is always "Microsoft.Network/dnsZones/CAA"
func (record *DnsZonesCAARecord) GetType() string {
	return "Microsoft.Network/dnsZones/CAA"
}

// NewEmptyStatus returns a new empty (blank) status
func (record *DnsZonesCAARecord) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &DnsZonesCAARecord_STATUS{}
}

// Owner returns the ResourceReference of the owner
func (record *DnsZonesCAARecord) Owner() *genruntime.ResourceReference {
	if record.Spec.Owner == nil {
		return nil
	}

	group, kind := genruntime.LookupOwnerGroupKind(record.Spec)
	return record.Spec.Owner.AsResourceReference(group, kind)
}

// SetStatus sets the status of this resource
func (record *DnsZonesCAARecord) SetStatus(status genruntime.ConvertibleStatus) error {
	// If we have exactly the right type of status, assign it
	if st, ok := status.(*DnsZonesCAARecord_STATUS); ok {
		record.Status = *st
		return nil
	}

	// Convert status to required version
	var st DnsZonesCAARecord_STATUS
	err := status.ConvertStatusTo(&st)
	if err != nil {
		return eris.Wrap(err, "failed to convert status")
	}

	record.Status = st
	return nil
}

// AssignProperties_From_DnsZonesCAARecord populates our DnsZonesCAARecord from the provided source DnsZonesCAARecord
func (record *DnsZonesCAARecord) AssignProperties_From_DnsZonesCAARecord(source *storage.DnsZonesCAARecord) error {

	// ObjectMeta
	record.ObjectMeta = *source.ObjectMeta.DeepCopy()

	// Spec
	var spec DnsZonesCAARecord_Spec
	err := spec.AssignProperties_From_DnsZonesCAARecord_Spec(&source.Spec)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_From_DnsZonesCAARecord_Spec() to populate field Spec")
	}
	record.Spec = spec

	// Status
	var status DnsZonesCAARecord_STATUS
	err = status.AssignProperties_From_DnsZonesCAARecord_STATUS(&source.Status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_From_DnsZonesCAARecord_STATUS() to populate field Status")
	}
	record.Status = status

	// No error
	return nil
}

// AssignProperties_To_DnsZonesCAARecord populates the provided destination DnsZonesCAARecord from our DnsZonesCAARecord
func (record *DnsZonesCAARecord) AssignProperties_To_DnsZonesCAARecord(destination *storage.DnsZonesCAARecord) error {

	// ObjectMeta
	destination.ObjectMeta = *record.ObjectMeta.DeepCopy()

	// Spec
	var spec storage.DnsZonesCAARecord_Spec
	err := record.Spec.AssignProperties_To_DnsZonesCAARecord_Spec(&spec)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_DnsZonesCAARecord_Spec() to populate field Spec")
	}
	destination.Spec = spec

	// Status
	var status storage.DnsZonesCAARecord_STATUS
	err = record.Status.AssignProperties_To_DnsZonesCAARecord_STATUS(&status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_DnsZonesCAARecord_STATUS() to populate field Status")
	}
	destination.Status = status

	// No error
	return nil
}

// OriginalGVK returns a GroupValueKind for the original API version used to create the resource
func (record *DnsZonesCAARecord) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: record.Spec.OriginalVersion(),
		Kind:    "DnsZonesCAARecord",
	}
}

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /dns/resource-manager/Microsoft.Network/Dns/stable/2018-05-01/dns.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/CAA/{relativeRecordSetName}
type DnsZonesCAARecordList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []DnsZonesCAARecord `json:"items"`
}

type DnsZonesCAARecord_Spec struct {
	// AAAARecords: The list of AAAA records in the record set.
	AAAARecords []AaaaRecord `json:"AAAARecords,omitempty"`

	// ARecords: The list of A records in the record set.
	ARecords []ARecord `json:"ARecords,omitempty"`

	// AzureName: The name of the resource in Azure. This is often the same as the name of the resource in Kubernetes but it
	// doesn't have to be.
	AzureName string `json:"azureName,omitempty"`

	// CNAMERecord: The CNAME record in the  record set.
	CNAMERecord *CnameRecord `json:"CNAMERecord,omitempty"`

	// CaaRecords: The list of CAA records in the record set.
	CaaRecords []CaaRecord `json:"caaRecords,omitempty"`

	// MXRecords: The list of MX records in the record set.
	MXRecords []MxRecord `json:"MXRecords,omitempty"`

	// Metadata: The metadata attached to the record set.
	Metadata map[string]string `json:"metadata,omitempty"`

	// NSRecords: The list of NS records in the record set.
	NSRecords []NsRecord `json:"NSRecords,omitempty"`

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *DnsZonesCAARecordOperatorSpec `json:"operatorSpec,omitempty"`

	// +kubebuilder:validation:Required
	// Owner: The owner of the resource. The owner controls where the resource goes when it is deployed. The owner also
	// controls the resources lifecycle. When the owner is deleted the resource will also be deleted. Owner is expected to be a
	// reference to a network.azure.com/DnsZone resource
	Owner *genruntime.KnownResourceReference `group:"network.azure.com" json:"owner,omitempty" kind:"DnsZone"`

	// PTRRecords: The list of PTR records in the record set.
	PTRRecords []PtrRecord `json:"PTRRecords,omitempty"`

	// SOARecord: The SOA record in the record set.
	SOARecord *SoaRecord `json:"SOARecord,omitempty"`

	// SRVRecords: The list of SRV records in the record set.
	SRVRecords []SrvRecord `json:"SRVRecords,omitempty"`

	// TTL: The TTL (time-to-live) of the records in the record set.
	TTL *int `json:"TTL,omitempty"`

	// TXTRecords: The list of TXT records in the record set.
	TXTRecords []TxtRecord `json:"TXTRecords,omitempty"`

	// TargetResource: A reference to an azure resource from where the dns resource value is taken.
	TargetResource *SubResource `json:"targetResource,omitempty"`
}

var _ genruntime.ARMTransformer = &DnsZonesCAARecord_Spec{}

// ConvertToARM converts from a Kubernetes CRD object to an ARM object
func (record *DnsZonesCAARecord_Spec) ConvertToARM(resolved genruntime.ConvertToARMResolvedDetails) (interface{}, error) {
	if record == nil {
		return nil, nil
	}
	result := &arm.DnsZonesCAARecord_Spec{}

	// Set property "Name":
	result.Name = resolved.Name

	// Set property "Properties":
	if record.AAAARecords != nil ||
		record.ARecords != nil ||
		record.CNAMERecord != nil ||
		record.CaaRecords != nil ||
		record.MXRecords != nil ||
		record.Metadata != nil ||
		record.NSRecords != nil ||
		record.PTRRecords != nil ||
		record.SOARecord != nil ||
		record.SRVRecords != nil ||
		record.TTL != nil ||
		record.TXTRecords != nil ||
		record.TargetResource != nil {
		result.Properties = &arm.RecordSetProperties{}
	}
	for _, item := range record.AAAARecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.AAAARecords = append(result.Properties.AAAARecords, *item_ARM.(*arm.AaaaRecord))
	}
	for _, item := range record.ARecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.ARecords = append(result.Properties.ARecords, *item_ARM.(*arm.ARecord))
	}
	if record.CNAMERecord != nil {
		cnameRecord_ARM, err := record.CNAMERecord.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		cnameRecord := *cnameRecord_ARM.(*arm.CnameRecord)
		result.Properties.CNAMERecord = &cnameRecord
	}
	for _, item := range record.CaaRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.CaaRecords = append(result.Properties.CaaRecords, *item_ARM.(*arm.CaaRecord))
	}
	for _, item := range record.MXRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.MXRecords = append(result.Properties.MXRecords, *item_ARM.(*arm.MxRecord))
	}
	if record.Metadata != nil {
		result.Properties.Metadata = make(map[string]string, len(record.Metadata))
		for key, value := range record.Metadata {
			result.Properties.Metadata[key] = value
		}
	}
	for _, item := range record.NSRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.NSRecords = append(result.Properties.NSRecords, *item_ARM.(*arm.NsRecord))
	}
	for _, item := range record.PTRRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.PTRRecords = append(result.Properties.PTRRecords, *item_ARM.(*arm.PtrRecord))
	}
	if record.SOARecord != nil {
		soaRecord_ARM, err := record.SOARecord.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		soaRecord := *soaRecord_ARM.(*arm.SoaRecord)
		result.Properties.SOARecord = &soaRecord
	}
	for _, item := range record.SRVRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.SRVRecords = append(result.Properties.SRVRecords, *item_ARM.(*arm.SrvRecord))
	}
	if record.TTL != nil {
		ttl := *record.TTL
		result.Properties.TTL = &ttl
	}
	for _, item := range record.TXTRecords {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.TXTRecords = append(result.Properties.TXTRecords, *item_ARM.(*arm.TxtRecord))
	}
	if record.TargetResource != nil {
		targetResource_ARM, err := record.TargetResource.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		targetResource := *targetResource_ARM.(*arm.SubResource)
		result.Properties.TargetResource = &targetResource
	}
	return result, nil
}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (record *DnsZonesCAARecord_Spec) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.DnsZonesCAARecord_Spec{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (record *DnsZonesCAARecord_Spec) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.DnsZonesCAARecord_Spec)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.DnsZonesCAARecord_Spec, got %T", armInput)
	}

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

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

	// Set property "AzureName":
	record.SetAzureName(genruntime.ExtractKubernetesResourceNameFromARMName(typedInput.Name))

	// Set property "CNAMERecord":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CNAMERecord != nil {
			var cnameRecord1 CnameRecord
			err := cnameRecord1.PopulateFromARM(owner, *typedInput.Properties.CNAMERecord)
			if err != nil {
				return err
			}
			cnameRecord := cnameRecord1
			record.CNAMERecord = &cnameRecord
		}
	}

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

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

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

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

	// no assignment for property "OperatorSpec"

	// Set property "Owner":
	record.Owner = &genruntime.KnownResourceReference{
		Name:  owner.Name,
		ARMID: owner.ARMID,
	}

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

	// Set property "SOARecord":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SOARecord != nil {
			var soaRecord1 SoaRecord
			err := soaRecord1.PopulateFromARM(owner, *typedInput.Properties.SOARecord)
			if err != nil {
				return err
			}
			soaRecord := soaRecord1
			record.SOARecord = &soaRecord
		}
	}

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

	// Set property "TTL":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TTL != nil {
			ttl := *typedInput.Properties.TTL
			record.TTL = &ttl
		}
	}

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

	// Set property "TargetResource":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TargetResource != nil {
			var targetResource1 SubResource
			err := targetResource1.PopulateFromARM(owner, *typedInput.Properties.TargetResource)
			if err != nil {
				return err
			}
			targetResource := targetResource1
			record.TargetResource = &targetResource
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &DnsZonesCAARecord_Spec{}

// ConvertSpecFrom populates our DnsZonesCAARecord_Spec from the provided source
func (record *DnsZonesCAARecord_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	src, ok := source.(*storage.DnsZonesCAARecord_Spec)
	if ok {
		// Populate our instance from source
		return record.AssignProperties_From_DnsZonesCAARecord_Spec(src)
	}

	// Convert to an intermediate form
	src = &storage.DnsZonesCAARecord_Spec{}
	err := src.ConvertSpecFrom(source)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertSpecFrom()")
	}

	// Update our instance from src
	err = record.AssignProperties_From_DnsZonesCAARecord_Spec(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecFrom()")
	}

	return nil
}

// ConvertSpecTo populates the provided destination from our DnsZonesCAARecord_Spec
func (record *DnsZonesCAARecord_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	dst, ok := destination.(*storage.DnsZonesCAARecord_Spec)
	if ok {
		// Populate destination from our instance
		return record.AssignProperties_To_DnsZonesCAARecord_Spec(dst)
	}

	// Convert to an intermediate form
	dst = &storage.DnsZonesCAARecord_Spec{}
	err := record.AssignProperties_To_DnsZonesCAARecord_Spec(dst)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertSpecTo()")
	}

	// Update dst from our instance
	err = dst.ConvertSpecTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertSpecTo()")
	}

	return nil
}

// AssignProperties_From_DnsZonesCAARecord_Spec populates our DnsZonesCAARecord_Spec from the provided source DnsZonesCAARecord_Spec
func (record *DnsZonesCAARecord_Spec) AssignProperties_From_DnsZonesCAARecord_Spec(source *storage.DnsZonesCAARecord_Spec) error {

	// AAAARecords
	if source.AAAARecords != nil {
		aaaaRecordList := make([]AaaaRecord, len(source.AAAARecords))
		for aaaaRecordIndex, aaaaRecordItem := range source.AAAARecords {
			var aaaaRecord AaaaRecord
			err := aaaaRecord.AssignProperties_From_AaaaRecord(&aaaaRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_AaaaRecord() to populate field AAAARecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		record.AAAARecords = aaaaRecordList
	} else {
		record.AAAARecords = nil
	}

	// ARecords
	if source.ARecords != nil {
		aRecordList := make([]ARecord, len(source.ARecords))
		for aRecordIndex, aRecordItem := range source.ARecords {
			var aRecord ARecord
			err := aRecord.AssignProperties_From_ARecord(&aRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ARecord() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		record.ARecords = aRecordList
	} else {
		record.ARecords = nil
	}

	// AzureName
	record.AzureName = source.AzureName

	// CNAMERecord
	if source.CNAMERecord != nil {
		var cnameRecord CnameRecord
		err := cnameRecord.AssignProperties_From_CnameRecord(source.CNAMERecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CnameRecord() to populate field CNAMERecord")
		}
		record.CNAMERecord = &cnameRecord
	} else {
		record.CNAMERecord = nil
	}

	// CaaRecords
	if source.CaaRecords != nil {
		caaRecordList := make([]CaaRecord, len(source.CaaRecords))
		for caaRecordIndex, caaRecordItem := range source.CaaRecords {
			var caaRecord CaaRecord
			err := caaRecord.AssignProperties_From_CaaRecord(&caaRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_CaaRecord() to populate field CaaRecords")
			}
			caaRecordList[caaRecordIndex] = caaRecord
		}
		record.CaaRecords = caaRecordList
	} else {
		record.CaaRecords = nil
	}

	// MXRecords
	if source.MXRecords != nil {
		mxRecordList := make([]MxRecord, len(source.MXRecords))
		for mxRecordIndex, mxRecordItem := range source.MXRecords {
			var mxRecord MxRecord
			err := mxRecord.AssignProperties_From_MxRecord(&mxRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_MxRecord() to populate field MXRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		record.MXRecords = mxRecordList
	} else {
		record.MXRecords = nil
	}

	// Metadata
	record.Metadata = genruntime.CloneMapOfStringToString(source.Metadata)

	// NSRecords
	if source.NSRecords != nil {
		nsRecordList := make([]NsRecord, len(source.NSRecords))
		for nsRecordIndex, nsRecordItem := range source.NSRecords {
			var nsRecord NsRecord
			err := nsRecord.AssignProperties_From_NsRecord(&nsRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_NsRecord() to populate field NSRecords")
			}
			nsRecordList[nsRecordIndex] = nsRecord
		}
		record.NSRecords = nsRecordList
	} else {
		record.NSRecords = nil
	}

	// OperatorSpec
	if source.OperatorSpec != nil {
		var operatorSpec DnsZonesCAARecordOperatorSpec
		err := operatorSpec.AssignProperties_From_DnsZonesCAARecordOperatorSpec(source.OperatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_DnsZonesCAARecordOperatorSpec() to populate field OperatorSpec")
		}
		record.OperatorSpec = &operatorSpec
	} else {
		record.OperatorSpec = nil
	}

	// Owner
	if source.Owner != nil {
		owner := source.Owner.Copy()
		record.Owner = &owner
	} else {
		record.Owner = nil
	}

	// PTRRecords
	if source.PTRRecords != nil {
		ptrRecordList := make([]PtrRecord, len(source.PTRRecords))
		for ptrRecordIndex, ptrRecordItem := range source.PTRRecords {
			var ptrRecord PtrRecord
			err := ptrRecord.AssignProperties_From_PtrRecord(&ptrRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PtrRecord() to populate field PTRRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		record.PTRRecords = ptrRecordList
	} else {
		record.PTRRecords = nil
	}

	// SOARecord
	if source.SOARecord != nil {
		var soaRecord SoaRecord
		err := soaRecord.AssignProperties_From_SoaRecord(source.SOARecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SoaRecord() to populate field SOARecord")
		}
		record.SOARecord = &soaRecord
	} else {
		record.SOARecord = nil
	}

	// SRVRecords
	if source.SRVRecords != nil {
		srvRecordList := make([]SrvRecord, len(source.SRVRecords))
		for srvRecordIndex, srvRecordItem := range source.SRVRecords {
			var srvRecord SrvRecord
			err := srvRecord.AssignProperties_From_SrvRecord(&srvRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SrvRecord() to populate field SRVRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		record.SRVRecords = srvRecordList
	} else {
		record.SRVRecords = nil
	}

	// TTL
	record.TTL = genruntime.ClonePointerToInt(source.TTL)

	// TXTRecords
	if source.TXTRecords != nil {
		txtRecordList := make([]TxtRecord, len(source.TXTRecords))
		for txtRecordIndex, txtRecordItem := range source.TXTRecords {
			var txtRecord TxtRecord
			err := txtRecord.AssignProperties_From_TxtRecord(&txtRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_TxtRecord() to populate field TXTRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		record.TXTRecords = txtRecordList
	} else {
		record.TXTRecords = nil
	}

	// TargetResource
	if source.TargetResource != nil {
		var targetResource SubResource
		err := targetResource.AssignProperties_From_SubResource(source.TargetResource)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource() to populate field TargetResource")
		}
		record.TargetResource = &targetResource
	} else {
		record.TargetResource = nil
	}

	// No error
	return nil
}

// AssignProperties_To_DnsZonesCAARecord_Spec populates the provided destination DnsZonesCAARecord_Spec from our DnsZonesCAARecord_Spec
func (record *DnsZonesCAARecord_Spec) AssignProperties_To_DnsZonesCAARecord_Spec(destination *storage.DnsZonesCAARecord_Spec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AAAARecords
	if record.AAAARecords != nil {
		aaaaRecordList := make([]storage.AaaaRecord, len(record.AAAARecords))
		for aaaaRecordIndex, aaaaRecordItem := range record.AAAARecords {
			var aaaaRecord storage.AaaaRecord
			err := aaaaRecordItem.AssignProperties_To_AaaaRecord(&aaaaRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_AaaaRecord() to populate field AAAARecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		destination.AAAARecords = aaaaRecordList
	} else {
		destination.AAAARecords = nil
	}

	// ARecords
	if record.ARecords != nil {
		aRecordList := make([]storage.ARecord, len(record.ARecords))
		for aRecordIndex, aRecordItem := range record.ARecords {
			var aRecord storage.ARecord
			err := aRecordItem.AssignProperties_To_ARecord(&aRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ARecord() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		destination.ARecords = aRecordList
	} else {
		destination.ARecords = nil
	}

	// AzureName
	destination.AzureName = record.AzureName

	// CNAMERecord
	if record.CNAMERecord != nil {
		var cnameRecord storage.CnameRecord
		err := record.CNAMERecord.AssignProperties_To_CnameRecord(&cnameRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CnameRecord() to populate field CNAMERecord")
		}
		destination.CNAMERecord = &cnameRecord
	} else {
		destination.CNAMERecord = nil
	}

	// CaaRecords
	if record.CaaRecords != nil {
		caaRecordList := make([]storage.CaaRecord, len(record.CaaRecords))
		for caaRecordIndex, caaRecordItem := range record.CaaRecords {
			var caaRecord storage.CaaRecord
			err := caaRecordItem.AssignProperties_To_CaaRecord(&caaRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_CaaRecord() to populate field CaaRecords")
			}
			caaRecordList[caaRecordIndex] = caaRecord
		}
		destination.CaaRecords = caaRecordList
	} else {
		destination.CaaRecords = nil
	}

	// MXRecords
	if record.MXRecords != nil {
		mxRecordList := make([]storage.MxRecord, len(record.MXRecords))
		for mxRecordIndex, mxRecordItem := range record.MXRecords {
			var mxRecord storage.MxRecord
			err := mxRecordItem.AssignProperties_To_MxRecord(&mxRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_MxRecord() to populate field MXRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		destination.MXRecords = mxRecordList
	} else {
		destination.MXRecords = nil
	}

	// Metadata
	destination.Metadata = genruntime.CloneMapOfStringToString(record.Metadata)

	// NSRecords
	if record.NSRecords != nil {
		nsRecordList := make([]storage.NsRecord, len(record.NSRecords))
		for nsRecordIndex, nsRecordItem := range record.NSRecords {
			var nsRecord storage.NsRecord
			err := nsRecordItem.AssignProperties_To_NsRecord(&nsRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_NsRecord() to populate field NSRecords")
			}
			nsRecordList[nsRecordIndex] = nsRecord
		}
		destination.NSRecords = nsRecordList
	} else {
		destination.NSRecords = nil
	}

	// OperatorSpec
	if record.OperatorSpec != nil {
		var operatorSpec storage.DnsZonesCAARecordOperatorSpec
		err := record.OperatorSpec.AssignProperties_To_DnsZonesCAARecordOperatorSpec(&operatorSpec)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_DnsZonesCAARecordOperatorSpec() to populate field OperatorSpec")
		}
		destination.OperatorSpec = &operatorSpec
	} else {
		destination.OperatorSpec = nil
	}

	// OriginalVersion
	destination.OriginalVersion = record.OriginalVersion()

	// Owner
	if record.Owner != nil {
		owner := record.Owner.Copy()
		destination.Owner = &owner
	} else {
		destination.Owner = nil
	}

	// PTRRecords
	if record.PTRRecords != nil {
		ptrRecordList := make([]storage.PtrRecord, len(record.PTRRecords))
		for ptrRecordIndex, ptrRecordItem := range record.PTRRecords {
			var ptrRecord storage.PtrRecord
			err := ptrRecordItem.AssignProperties_To_PtrRecord(&ptrRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PtrRecord() to populate field PTRRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		destination.PTRRecords = ptrRecordList
	} else {
		destination.PTRRecords = nil
	}

	// SOARecord
	if record.SOARecord != nil {
		var soaRecord storage.SoaRecord
		err := record.SOARecord.AssignProperties_To_SoaRecord(&soaRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SoaRecord() to populate field SOARecord")
		}
		destination.SOARecord = &soaRecord
	} else {
		destination.SOARecord = nil
	}

	// SRVRecords
	if record.SRVRecords != nil {
		srvRecordList := make([]storage.SrvRecord, len(record.SRVRecords))
		for srvRecordIndex, srvRecordItem := range record.SRVRecords {
			var srvRecord storage.SrvRecord
			err := srvRecordItem.AssignProperties_To_SrvRecord(&srvRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SrvRecord() to populate field SRVRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		destination.SRVRecords = srvRecordList
	} else {
		destination.SRVRecords = nil
	}

	// TTL
	destination.TTL = genruntime.ClonePointerToInt(record.TTL)

	// TXTRecords
	if record.TXTRecords != nil {
		txtRecordList := make([]storage.TxtRecord, len(record.TXTRecords))
		for txtRecordIndex, txtRecordItem := range record.TXTRecords {
			var txtRecord storage.TxtRecord
			err := txtRecordItem.AssignProperties_To_TxtRecord(&txtRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_TxtRecord() to populate field TXTRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		destination.TXTRecords = txtRecordList
	} else {
		destination.TXTRecords = nil
	}

	// TargetResource
	if record.TargetResource != nil {
		var targetResource storage.SubResource
		err := record.TargetResource.AssignProperties_To_SubResource(&targetResource)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource() to populate field TargetResource")
		}
		destination.TargetResource = &targetResource
	} else {
		destination.TargetResource = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Initialize_From_DnsZonesCAARecord_STATUS populates our DnsZonesCAARecord_Spec from the provided source DnsZonesCAARecord_STATUS
func (record *DnsZonesCAARecord_Spec) Initialize_From_DnsZonesCAARecord_STATUS(source *DnsZonesCAARecord_STATUS) error {

	// AAAARecords
	if source.AAAARecords != nil {
		aaaaRecordList := make([]AaaaRecord, len(source.AAAARecords))
		for aaaaRecordIndex, aaaaRecordItem := range source.AAAARecords {
			var aaaaRecord AaaaRecord
			err := aaaaRecord.Initialize_From_AaaaRecord_STATUS(&aaaaRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_AaaaRecord_STATUS() to populate field AAAARecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		record.AAAARecords = aaaaRecordList
	} else {
		record.AAAARecords = nil
	}

	// ARecords
	if source.ARecords != nil {
		aRecordList := make([]ARecord, len(source.ARecords))
		for aRecordIndex, aRecordItem := range source.ARecords {
			var aRecord ARecord
			err := aRecord.Initialize_From_ARecord_STATUS(&aRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_ARecord_STATUS() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		record.ARecords = aRecordList
	} else {
		record.ARecords = nil
	}

	// CNAMERecord
	if source.CNAMERecord != nil {
		var cnameRecord CnameRecord
		err := cnameRecord.Initialize_From_CnameRecord_STATUS(source.CNAMERecord)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_CnameRecord_STATUS() to populate field CNAMERecord")
		}
		record.CNAMERecord = &cnameRecord
	} else {
		record.CNAMERecord = nil
	}

	// CaaRecords
	if source.CaaRecords != nil {
		caaRecordList := make([]CaaRecord, len(source.CaaRecords))
		for caaRecordIndex, caaRecordItem := range source.CaaRecords {
			var caaRecord CaaRecord
			err := caaRecord.Initialize_From_CaaRecord_STATUS(&caaRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_CaaRecord_STATUS() to populate field CaaRecords")
			}
			caaRecordList[caaRecordIndex] = caaRecord
		}
		record.CaaRecords = caaRecordList
	} else {
		record.CaaRecords = nil
	}

	// MXRecords
	if source.MXRecords != nil {
		mxRecordList := make([]MxRecord, len(source.MXRecords))
		for mxRecordIndex, mxRecordItem := range source.MXRecords {
			var mxRecord MxRecord
			err := mxRecord.Initialize_From_MxRecord_STATUS(&mxRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_MxRecord_STATUS() to populate field MXRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		record.MXRecords = mxRecordList
	} else {
		record.MXRecords = nil
	}

	// Metadata
	record.Metadata = genruntime.CloneMapOfStringToString(source.Metadata)

	// NSRecords
	if source.NSRecords != nil {
		nsRecordList := make([]NsRecord, len(source.NSRecords))
		for nsRecordIndex, nsRecordItem := range source.NSRecords {
			var nsRecord NsRecord
			err := nsRecord.Initialize_From_NsRecord_STATUS(&nsRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_NsRecord_STATUS() to populate field NSRecords")
			}
			nsRecordList[nsRecordIndex] = nsRecord
		}
		record.NSRecords = nsRecordList
	} else {
		record.NSRecords = nil
	}

	// PTRRecords
	if source.PTRRecords != nil {
		ptrRecordList := make([]PtrRecord, len(source.PTRRecords))
		for ptrRecordIndex, ptrRecordItem := range source.PTRRecords {
			var ptrRecord PtrRecord
			err := ptrRecord.Initialize_From_PtrRecord_STATUS(&ptrRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_PtrRecord_STATUS() to populate field PTRRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		record.PTRRecords = ptrRecordList
	} else {
		record.PTRRecords = nil
	}

	// SOARecord
	if source.SOARecord != nil {
		var soaRecord SoaRecord
		err := soaRecord.Initialize_From_SoaRecord_STATUS(source.SOARecord)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SoaRecord_STATUS() to populate field SOARecord")
		}
		record.SOARecord = &soaRecord
	} else {
		record.SOARecord = nil
	}

	// SRVRecords
	if source.SRVRecords != nil {
		srvRecordList := make([]SrvRecord, len(source.SRVRecords))
		for srvRecordIndex, srvRecordItem := range source.SRVRecords {
			var srvRecord SrvRecord
			err := srvRecord.Initialize_From_SrvRecord_STATUS(&srvRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_SrvRecord_STATUS() to populate field SRVRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		record.SRVRecords = srvRecordList
	} else {
		record.SRVRecords = nil
	}

	// TTL
	record.TTL = genruntime.ClonePointerToInt(source.TTL)

	// TXTRecords
	if source.TXTRecords != nil {
		txtRecordList := make([]TxtRecord, len(source.TXTRecords))
		for txtRecordIndex, txtRecordItem := range source.TXTRecords {
			var txtRecord TxtRecord
			err := txtRecord.Initialize_From_TxtRecord_STATUS(&txtRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling Initialize_From_TxtRecord_STATUS() to populate field TXTRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		record.TXTRecords = txtRecordList
	} else {
		record.TXTRecords = nil
	}

	// TargetResource
	if source.TargetResource != nil {
		var targetResource SubResource
		err := targetResource.Initialize_From_SubResource_STATUS(source.TargetResource)
		if err != nil {
			return eris.Wrap(err, "calling Initialize_From_SubResource_STATUS() to populate field TargetResource")
		}
		record.TargetResource = &targetResource
	} else {
		record.TargetResource = nil
	}

	// No error
	return nil
}

// OriginalVersion returns the original API version used to create the resource.
func (record *DnsZonesCAARecord_Spec) OriginalVersion() string {
	return GroupVersion.Version
}

// SetAzureName sets the Azure name of the resource
func (record *DnsZonesCAARecord_Spec) SetAzureName(azureName string) { record.AzureName = azureName }

type DnsZonesCAARecord_STATUS struct {
	// AAAARecords: The list of AAAA records in the record set.
	AAAARecords []AaaaRecord_STATUS `json:"AAAARecords,omitempty"`

	// ARecords: The list of A records in the record set.
	ARecords []ARecord_STATUS `json:"ARecords,omitempty"`

	// CNAMERecord: The CNAME record in the  record set.
	CNAMERecord *CnameRecord_STATUS `json:"CNAMERecord,omitempty"`

	// CaaRecords: The list of CAA records in the record set.
	CaaRecords []CaaRecord_STATUS `json:"caaRecords,omitempty"`

	// Conditions: The observed state of the resource
	Conditions []conditions.Condition `json:"conditions,omitempty"`

	// Etag: The etag of the record set.
	Etag *string `json:"etag,omitempty"`

	// Fqdn: Fully qualified domain name of the record set.
	Fqdn *string `json:"fqdn,omitempty"`

	// Id: The ID of the record set.
	Id *string `json:"id,omitempty"`

	// MXRecords: The list of MX records in the record set.
	MXRecords []MxRecord_STATUS `json:"MXRecords,omitempty"`

	// Metadata: The metadata attached to the record set.
	Metadata map[string]string `json:"metadata,omitempty"`

	// NSRecords: The list of NS records in the record set.
	NSRecords []NsRecord_STATUS `json:"NSRecords,omitempty"`

	// Name: The name of the record set.
	Name *string `json:"name,omitempty"`

	// PTRRecords: The list of PTR records in the record set.
	PTRRecords []PtrRecord_STATUS `json:"PTRRecords,omitempty"`

	// ProvisioningState: provisioning State of the record set.
	ProvisioningState *string `json:"provisioningState,omitempty"`

	// SOARecord: The SOA record in the record set.
	SOARecord *SoaRecord_STATUS `json:"SOARecord,omitempty"`

	// SRVRecords: The list of SRV records in the record set.
	SRVRecords []SrvRecord_STATUS `json:"SRVRecords,omitempty"`

	// TTL: The TTL (time-to-live) of the records in the record set.
	TTL *int `json:"TTL,omitempty"`

	// TXTRecords: The list of TXT records in the record set.
	TXTRecords []TxtRecord_STATUS `json:"TXTRecords,omitempty"`

	// TargetResource: A reference to an azure resource from where the dns resource value is taken.
	TargetResource *SubResource_STATUS `json:"targetResource,omitempty"`

	// Type: The type of the record set.
	Type *string `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &DnsZonesCAARecord_STATUS{}

// ConvertStatusFrom populates our DnsZonesCAARecord_STATUS from the provided source
func (record *DnsZonesCAARecord_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	src, ok := source.(*storage.DnsZonesCAARecord_STATUS)
	if ok {
		// Populate our instance from source
		return record.AssignProperties_From_DnsZonesCAARecord_STATUS(src)
	}

	// Convert to an intermediate form
	src = &storage.DnsZonesCAARecord_STATUS{}
	err := src.ConvertStatusFrom(source)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertStatusFrom()")
	}

	// Update our instance from src
	err = record.AssignProperties_From_DnsZonesCAARecord_STATUS(src)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusFrom()")
	}

	return nil
}

// ConvertStatusTo populates the provided destination from our DnsZonesCAARecord_STATUS
func (record *DnsZonesCAARecord_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	dst, ok := destination.(*storage.DnsZonesCAARecord_STATUS)
	if ok {
		// Populate destination from our instance
		return record.AssignProperties_To_DnsZonesCAARecord_STATUS(dst)
	}

	// Convert to an intermediate form
	dst = &storage.DnsZonesCAARecord_STATUS{}
	err := record.AssignProperties_To_DnsZonesCAARecord_STATUS(dst)
	if err != nil {
		return eris.Wrap(err, "initial step of conversion in ConvertStatusTo()")
	}

	// Update dst from our instance
	err = dst.ConvertStatusTo(destination)
	if err != nil {
		return eris.Wrap(err, "final step of conversion in ConvertStatusTo()")
	}

	return nil
}

var _ genruntime.FromARMConverter = &DnsZonesCAARecord_STATUS{}

// NewEmptyARMValue returns an empty ARM value suitable for deserializing into
func (record *DnsZonesCAARecord_STATUS) NewEmptyARMValue() genruntime.ARMResourceStatus {
	return &arm.DnsZonesCAARecord_STATUS{}
}

// PopulateFromARM populates a Kubernetes CRD object from an Azure ARM object
func (record *DnsZonesCAARecord_STATUS) PopulateFromARM(owner genruntime.ArbitraryOwnerReference, armInput interface{}) error {
	typedInput, ok := armInput.(arm.DnsZonesCAARecord_STATUS)
	if !ok {
		return fmt.Errorf("unexpected type supplied for PopulateFromARM() function. Expected arm.DnsZonesCAARecord_STATUS, got %T", armInput)
	}

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

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

	// Set property "CNAMERecord":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.CNAMERecord != nil {
			var cnameRecord1 CnameRecord_STATUS
			err := cnameRecord1.PopulateFromARM(owner, *typedInput.Properties.CNAMERecord)
			if err != nil {
				return err
			}
			cnameRecord := cnameRecord1
			record.CNAMERecord = &cnameRecord
		}
	}

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

	// no assignment for property "Conditions"

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

	// Set property "Fqdn":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Fqdn != nil {
			fqdn := *typedInput.Properties.Fqdn
			record.Fqdn = &fqdn
		}
	}

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

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

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

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

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

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

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

	// Set property "SOARecord":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SOARecord != nil {
			var soaRecord1 SoaRecord_STATUS
			err := soaRecord1.PopulateFromARM(owner, *typedInput.Properties.SOARecord)
			if err != nil {
				return err
			}
			soaRecord := soaRecord1
			record.SOARecord = &soaRecord
		}
	}

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

	// Set property "TTL":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TTL != nil {
			ttl := *typedInput.Properties.TTL
			record.TTL = &ttl
		}
	}

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

	// Set property "TargetResource":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.TargetResource != nil {
			var targetResource1 SubResource_STATUS
			err := targetResource1.PopulateFromARM(owner, *typedInput.Properties.TargetResource)
			if err != nil {
				return err
			}
			targetResource := targetResource1
			record.TargetResource = &targetResource
		}
	}

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

	// No error
	return nil
}

// AssignProperties_From_DnsZonesCAARecord_STATUS populates our DnsZonesCAARecord_STATUS from the provided source DnsZonesCAARecord_STATUS
func (record *DnsZonesCAARecord_STATUS) AssignProperties_From_DnsZonesCAARecord_STATUS(source *storage.DnsZonesCAARecord_STATUS) error {

	// AAAARecords
	if source.AAAARecords != nil {
		aaaaRecordList := make([]AaaaRecord_STATUS, len(source.AAAARecords))
		for aaaaRecordIndex, aaaaRecordItem := range source.AAAARecords {
			var aaaaRecord AaaaRecord_STATUS
			err := aaaaRecord.AssignProperties_From_AaaaRecord_STATUS(&aaaaRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_AaaaRecord_STATUS() to populate field AAAARecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		record.AAAARecords = aaaaRecordList
	} else {
		record.AAAARecords = nil
	}

	// ARecords
	if source.ARecords != nil {
		aRecordList := make([]ARecord_STATUS, len(source.ARecords))
		for aRecordIndex, aRecordItem := range source.ARecords {
			var aRecord ARecord_STATUS
			err := aRecord.AssignProperties_From_ARecord_STATUS(&aRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_ARecord_STATUS() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		record.ARecords = aRecordList
	} else {
		record.ARecords = nil
	}

	// CNAMERecord
	if source.CNAMERecord != nil {
		var cnameRecord CnameRecord_STATUS
		err := cnameRecord.AssignProperties_From_CnameRecord_STATUS(source.CNAMERecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_CnameRecord_STATUS() to populate field CNAMERecord")
		}
		record.CNAMERecord = &cnameRecord
	} else {
		record.CNAMERecord = nil
	}

	// CaaRecords
	if source.CaaRecords != nil {
		caaRecordList := make([]CaaRecord_STATUS, len(source.CaaRecords))
		for caaRecordIndex, caaRecordItem := range source.CaaRecords {
			var caaRecord CaaRecord_STATUS
			err := caaRecord.AssignProperties_From_CaaRecord_STATUS(&caaRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_CaaRecord_STATUS() to populate field CaaRecords")
			}
			caaRecordList[caaRecordIndex] = caaRecord
		}
		record.CaaRecords = caaRecordList
	} else {
		record.CaaRecords = nil
	}

	// Conditions
	record.Conditions = genruntime.CloneSliceOfCondition(source.Conditions)

	// Etag
	record.Etag = genruntime.ClonePointerToString(source.Etag)

	// Fqdn
	record.Fqdn = genruntime.ClonePointerToString(source.Fqdn)

	// Id
	record.Id = genruntime.ClonePointerToString(source.Id)

	// MXRecords
	if source.MXRecords != nil {
		mxRecordList := make([]MxRecord_STATUS, len(source.MXRecords))
		for mxRecordIndex, mxRecordItem := range source.MXRecords {
			var mxRecord MxRecord_STATUS
			err := mxRecord.AssignProperties_From_MxRecord_STATUS(&mxRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_MxRecord_STATUS() to populate field MXRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		record.MXRecords = mxRecordList
	} else {
		record.MXRecords = nil
	}

	// Metadata
	record.Metadata = genruntime.CloneMapOfStringToString(source.Metadata)

	// NSRecords
	if source.NSRecords != nil {
		nsRecordList := make([]NsRecord_STATUS, len(source.NSRecords))
		for nsRecordIndex, nsRecordItem := range source.NSRecords {
			var nsRecord NsRecord_STATUS
			err := nsRecord.AssignProperties_From_NsRecord_STATUS(&nsRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_NsRecord_STATUS() to populate field NSRecords")
			}
			nsRecordList[nsRecordIndex] = nsRecord
		}
		record.NSRecords = nsRecordList
	} else {
		record.NSRecords = nil
	}

	// Name
	record.Name = genruntime.ClonePointerToString(source.Name)

	// PTRRecords
	if source.PTRRecords != nil {
		ptrRecordList := make([]PtrRecord_STATUS, len(source.PTRRecords))
		for ptrRecordIndex, ptrRecordItem := range source.PTRRecords {
			var ptrRecord PtrRecord_STATUS
			err := ptrRecord.AssignProperties_From_PtrRecord_STATUS(&ptrRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_PtrRecord_STATUS() to populate field PTRRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		record.PTRRecords = ptrRecordList
	} else {
		record.PTRRecords = nil
	}

	// ProvisioningState
	record.ProvisioningState = genruntime.ClonePointerToString(source.ProvisioningState)

	// SOARecord
	if source.SOARecord != nil {
		var soaRecord SoaRecord_STATUS
		err := soaRecord.AssignProperties_From_SoaRecord_STATUS(source.SOARecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SoaRecord_STATUS() to populate field SOARecord")
		}
		record.SOARecord = &soaRecord
	} else {
		record.SOARecord = nil
	}

	// SRVRecords
	if source.SRVRecords != nil {
		srvRecordList := make([]SrvRecord_STATUS, len(source.SRVRecords))
		for srvRecordIndex, srvRecordItem := range source.SRVRecords {
			var srvRecord SrvRecord_STATUS
			err := srvRecord.AssignProperties_From_SrvRecord_STATUS(&srvRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_SrvRecord_STATUS() to populate field SRVRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		record.SRVRecords = srvRecordList
	} else {
		record.SRVRecords = nil
	}

	// TTL
	record.TTL = genruntime.ClonePointerToInt(source.TTL)

	// TXTRecords
	if source.TXTRecords != nil {
		txtRecordList := make([]TxtRecord_STATUS, len(source.TXTRecords))
		for txtRecordIndex, txtRecordItem := range source.TXTRecords {
			var txtRecord TxtRecord_STATUS
			err := txtRecord.AssignProperties_From_TxtRecord_STATUS(&txtRecordItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_TxtRecord_STATUS() to populate field TXTRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		record.TXTRecords = txtRecordList
	} else {
		record.TXTRecords = nil
	}

	// TargetResource
	if source.TargetResource != nil {
		var targetResource SubResource_STATUS
		err := targetResource.AssignProperties_From_SubResource_STATUS(source.TargetResource)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_SubResource_STATUS() to populate field TargetResource")
		}
		record.TargetResource = &targetResource
	} else {
		record.TargetResource = nil
	}

	// Type
	record.Type = genruntime.ClonePointerToString(source.Type)

	// No error
	return nil
}

// AssignProperties_To_DnsZonesCAARecord_STATUS populates the provided destination DnsZonesCAARecord_STATUS from our DnsZonesCAARecord_STATUS
func (record *DnsZonesCAARecord_STATUS) AssignProperties_To_DnsZonesCAARecord_STATUS(destination *storage.DnsZonesCAARecord_STATUS) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// AAAARecords
	if record.AAAARecords != nil {
		aaaaRecordList := make([]storage.AaaaRecord_STATUS, len(record.AAAARecords))
		for aaaaRecordIndex, aaaaRecordItem := range record.AAAARecords {
			var aaaaRecord storage.AaaaRecord_STATUS
			err := aaaaRecordItem.AssignProperties_To_AaaaRecord_STATUS(&aaaaRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_AaaaRecord_STATUS() to populate field AAAARecords")
			}
			aaaaRecordList[aaaaRecordIndex] = aaaaRecord
		}
		destination.AAAARecords = aaaaRecordList
	} else {
		destination.AAAARecords = nil
	}

	// ARecords
	if record.ARecords != nil {
		aRecordList := make([]storage.ARecord_STATUS, len(record.ARecords))
		for aRecordIndex, aRecordItem := range record.ARecords {
			var aRecord storage.ARecord_STATUS
			err := aRecordItem.AssignProperties_To_ARecord_STATUS(&aRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_ARecord_STATUS() to populate field ARecords")
			}
			aRecordList[aRecordIndex] = aRecord
		}
		destination.ARecords = aRecordList
	} else {
		destination.ARecords = nil
	}

	// CNAMERecord
	if record.CNAMERecord != nil {
		var cnameRecord storage.CnameRecord_STATUS
		err := record.CNAMERecord.AssignProperties_To_CnameRecord_STATUS(&cnameRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_CnameRecord_STATUS() to populate field CNAMERecord")
		}
		destination.CNAMERecord = &cnameRecord
	} else {
		destination.CNAMERecord = nil
	}

	// CaaRecords
	if record.CaaRecords != nil {
		caaRecordList := make([]storage.CaaRecord_STATUS, len(record.CaaRecords))
		for caaRecordIndex, caaRecordItem := range record.CaaRecords {
			var caaRecord storage.CaaRecord_STATUS
			err := caaRecordItem.AssignProperties_To_CaaRecord_STATUS(&caaRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_CaaRecord_STATUS() to populate field CaaRecords")
			}
			caaRecordList[caaRecordIndex] = caaRecord
		}
		destination.CaaRecords = caaRecordList
	} else {
		destination.CaaRecords = nil
	}

	// Conditions
	destination.Conditions = genruntime.CloneSliceOfCondition(record.Conditions)

	// Etag
	destination.Etag = genruntime.ClonePointerToString(record.Etag)

	// Fqdn
	destination.Fqdn = genruntime.ClonePointerToString(record.Fqdn)

	// Id
	destination.Id = genruntime.ClonePointerToString(record.Id)

	// MXRecords
	if record.MXRecords != nil {
		mxRecordList := make([]storage.MxRecord_STATUS, len(record.MXRecords))
		for mxRecordIndex, mxRecordItem := range record.MXRecords {
			var mxRecord storage.MxRecord_STATUS
			err := mxRecordItem.AssignProperties_To_MxRecord_STATUS(&mxRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_MxRecord_STATUS() to populate field MXRecords")
			}
			mxRecordList[mxRecordIndex] = mxRecord
		}
		destination.MXRecords = mxRecordList
	} else {
		destination.MXRecords = nil
	}

	// Metadata
	destination.Metadata = genruntime.CloneMapOfStringToString(record.Metadata)

	// NSRecords
	if record.NSRecords != nil {
		nsRecordList := make([]storage.NsRecord_STATUS, len(record.NSRecords))
		for nsRecordIndex, nsRecordItem := range record.NSRecords {
			var nsRecord storage.NsRecord_STATUS
			err := nsRecordItem.AssignProperties_To_NsRecord_STATUS(&nsRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_NsRecord_STATUS() to populate field NSRecords")
			}
			nsRecordList[nsRecordIndex] = nsRecord
		}
		destination.NSRecords = nsRecordList
	} else {
		destination.NSRecords = nil
	}

	// Name
	destination.Name = genruntime.ClonePointerToString(record.Name)

	// PTRRecords
	if record.PTRRecords != nil {
		ptrRecordList := make([]storage.PtrRecord_STATUS, len(record.PTRRecords))
		for ptrRecordIndex, ptrRecordItem := range record.PTRRecords {
			var ptrRecord storage.PtrRecord_STATUS
			err := ptrRecordItem.AssignProperties_To_PtrRecord_STATUS(&ptrRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_PtrRecord_STATUS() to populate field PTRRecords")
			}
			ptrRecordList[ptrRecordIndex] = ptrRecord
		}
		destination.PTRRecords = ptrRecordList
	} else {
		destination.PTRRecords = nil
	}

	// ProvisioningState
	destination.ProvisioningState = genruntime.ClonePointerToString(record.ProvisioningState)

	// SOARecord
	if record.SOARecord != nil {
		var soaRecord storage.SoaRecord_STATUS
		err := record.SOARecord.AssignProperties_To_SoaRecord_STATUS(&soaRecord)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SoaRecord_STATUS() to populate field SOARecord")
		}
		destination.SOARecord = &soaRecord
	} else {
		destination.SOARecord = nil
	}

	// SRVRecords
	if record.SRVRecords != nil {
		srvRecordList := make([]storage.SrvRecord_STATUS, len(record.SRVRecords))
		for srvRecordIndex, srvRecordItem := range record.SRVRecords {
			var srvRecord storage.SrvRecord_STATUS
			err := srvRecordItem.AssignProperties_To_SrvRecord_STATUS(&srvRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_SrvRecord_STATUS() to populate field SRVRecords")
			}
			srvRecordList[srvRecordIndex] = srvRecord
		}
		destination.SRVRecords = srvRecordList
	} else {
		destination.SRVRecords = nil
	}

	// TTL
	destination.TTL = genruntime.ClonePointerToInt(record.TTL)

	// TXTRecords
	if record.TXTRecords != nil {
		txtRecordList := make([]storage.TxtRecord_STATUS, len(record.TXTRecords))
		for txtRecordIndex, txtRecordItem := range record.TXTRecords {
			var txtRecord storage.TxtRecord_STATUS
			err := txtRecordItem.AssignProperties_To_TxtRecord_STATUS(&txtRecord)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_TxtRecord_STATUS() to populate field TXTRecords")
			}
			txtRecordList[txtRecordIndex] = txtRecord
		}
		destination.TXTRecords = txtRecordList
	} else {
		destination.TXTRecords = nil
	}

	// TargetResource
	if record.TargetResource != nil {
		var targetResource storage.SubResource_STATUS
		err := record.TargetResource.AssignProperties_To_SubResource_STATUS(&targetResource)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_SubResource_STATUS() to populate field TargetResource")
		}
		destination.TargetResource = &targetResource
	} else {
		destination.TargetResource = nil
	}

	// Type
	destination.Type = genruntime.ClonePointerToString(record.Type)

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

// Details for configuring operator behavior. Fields in this struct are interpreted by the operator directly rather than being passed to Azure
type DnsZonesCAARecordOperatorSpec struct {
	// ConfigMapExpressions: configures where to place operator written dynamic ConfigMaps (created with CEL expressions).
	ConfigMapExpressions []*core.DestinationExpression `json:"configMapExpressions,omitempty"`

	// SecretExpressions: configures where to place operator written dynamic secrets (created with CEL expressions).
	SecretExpressions []*core.DestinationExpression `json:"secretExpressions,omitempty"`
}

// AssignProperties_From_DnsZonesCAARecordOperatorSpec populates our DnsZonesCAARecordOperatorSpec from the provided source DnsZonesCAARecordOperatorSpec
func (operator *DnsZonesCAARecordOperatorSpec) AssignProperties_From_DnsZonesCAARecordOperatorSpec(source *storage.DnsZonesCAARecordOperatorSpec) error {

	// ConfigMapExpressions
	if source.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(source.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range source.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		operator.ConfigMapExpressions = configMapExpressionList
	} else {
		operator.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if source.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(source.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range source.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		operator.SecretExpressions = secretExpressionList
	} else {
		operator.SecretExpressions = nil
	}

	// No error
	return nil
}

// AssignProperties_To_DnsZonesCAARecordOperatorSpec populates the provided destination DnsZonesCAARecordOperatorSpec from our DnsZonesCAARecordOperatorSpec
func (operator *DnsZonesCAARecordOperatorSpec) AssignProperties_To_DnsZonesCAARecordOperatorSpec(destination *storage.DnsZonesCAARecordOperatorSpec) error {
	// Create a new property bag
	propertyBag := genruntime.NewPropertyBag()

	// ConfigMapExpressions
	if operator.ConfigMapExpressions != nil {
		configMapExpressionList := make([]*core.DestinationExpression, len(operator.ConfigMapExpressions))
		for configMapExpressionIndex, configMapExpressionItem := range operator.ConfigMapExpressions {
			if configMapExpressionItem != nil {
				configMapExpression := *configMapExpressionItem.DeepCopy()
				configMapExpressionList[configMapExpressionIndex] = &configMapExpression
			} else {
				configMapExpressionList[configMapExpressionIndex] = nil
			}
		}
		destination.ConfigMapExpressions = configMapExpressionList
	} else {
		destination.ConfigMapExpressions = nil
	}

	// SecretExpressions
	if operator.SecretExpressions != nil {
		secretExpressionList := make([]*core.DestinationExpression, len(operator.SecretExpressions))
		for secretExpressionIndex, secretExpressionItem := range operator.SecretExpressions {
			if secretExpressionItem != nil {
				secretExpression := *secretExpressionItem.DeepCopy()
				secretExpressionList[secretExpressionIndex] = &secretExpression
			} else {
				secretExpressionList[secretExpressionIndex] = nil
			}
		}
		destination.SecretExpressions = secretExpressionList
	} else {
		destination.SecretExpressions = nil
	}

	// Update the property bag
	if len(propertyBag) > 0 {
		destination.PropertyBag = propertyBag
	} else {
		destination.PropertyBag = nil
	}

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&DnsZonesCAARecord{}, &DnsZonesCAARecordList{})
}
