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

import (
	"fmt"
	arm "github.com/Azure/azure-service-operator/v2/api/insights/v1api20180501preview/arm"
	storage "github.com/Azure/azure-service-operator/v2/api/insights/v1api20180501preview/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,insights}
// +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: /applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/webTests_API.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}
type Webtest struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Webtest_Spec   `json:"spec,omitempty"`
	Status            Webtest_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Webtest{}

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

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

var _ conversion.Convertible = &Webtest{}

// ConvertFrom populates our Webtest from the provided hub Webtest
func (webtest *Webtest) ConvertFrom(hub conversion.Hub) error {
	// intermediate variable for conversion
	var source storage.Webtest

	err := source.ConvertFrom(hub)
	if err != nil {
		return eris.Wrap(err, "converting from hub to source")
	}

	err = webtest.AssignProperties_From_Webtest(&source)
	if err != nil {
		return eris.Wrap(err, "converting from source to webtest")
	}

	return nil
}

// ConvertTo populates the provided hub Webtest from our Webtest
func (webtest *Webtest) ConvertTo(hub conversion.Hub) error {
	// intermediate variable for conversion
	var destination storage.Webtest
	err := webtest.AssignProperties_To_Webtest(&destination)
	if err != nil {
		return eris.Wrap(err, "converting to destination from webtest")
	}
	err = destination.ConvertTo(hub)
	if err != nil {
		return eris.Wrap(err, "converting from destination to hub")
	}

	return nil
}

var _ configmaps.Exporter = &Webtest{}

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

var _ secrets.Exporter = &Webtest{}

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

var _ genruntime.KubernetesResource = &Webtest{}

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

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

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

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

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Insights/webtests"
func (webtest *Webtest) GetType() string {
	return "Microsoft.Insights/webtests"
}

// NewEmptyStatus returns a new empty (blank) status
func (webtest *Webtest) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Webtest_STATUS{}
}

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

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

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

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

	webtest.Status = st
	return nil
}

// AssignProperties_From_Webtest populates our Webtest from the provided source Webtest
func (webtest *Webtest) AssignProperties_From_Webtest(source *storage.Webtest) error {

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

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

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

	// No error
	return nil
}

// AssignProperties_To_Webtest populates the provided destination Webtest from our Webtest
func (webtest *Webtest) AssignProperties_To_Webtest(destination *storage.Webtest) error {

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

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

	// Status
	var status storage.Webtest_STATUS
	err = webtest.Status.AssignProperties_To_Webtest_STATUS(&status)
	if err != nil {
		return eris.Wrap(err, "calling AssignProperties_To_Webtest_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 (webtest *Webtest) OriginalGVK() *schema.GroupVersionKind {
	return &schema.GroupVersionKind{
		Group:   GroupVersion.Group,
		Version: webtest.Spec.OriginalVersion(),
		Kind:    "Webtest",
	}
}

// +kubebuilder:object:root=true
// Generator information:
// - Generated from: /applicationinsights/resource-manager/Microsoft.Insights/preview/2018-05-01-preview/webTests_API.json
// - ARM URI: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}
type WebtestList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Webtest `json:"items"`
}

// +kubebuilder:validation:Enum={"2018-05-01-preview"}
type APIVersion string

const APIVersion_Value = APIVersion("2018-05-01-preview")

type Webtest_Spec struct {
	// 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"`

	// Configuration: An XML configuration specification for a WebTest.
	Configuration *WebTestProperties_Configuration `json:"Configuration,omitempty"`

	// Description: User defined description for this WebTest.
	Description *string `json:"Description,omitempty"`

	// Enabled: Is the test actively being monitored.
	Enabled *bool `json:"Enabled,omitempty"`

	// Frequency: Interval in seconds between test runs for this WebTest. Default value is 300.
	Frequency *int `json:"Frequency,omitempty"`

	// +kubebuilder:validation:Required
	// Kind: The kind of web test this is, valid choices are ping, multistep, basic, and standard.
	Kind *WebTestProperties_Kind `json:"Kind,omitempty"`

	// +kubebuilder:validation:Required
	// Location: Resource location
	Location *string `json:"location,omitempty"`

	// +kubebuilder:validation:Required
	// Locations: A list of where to physically run the tests from to give global coverage for accessibility of your
	// application.
	Locations []WebTestGeolocation `json:"Locations,omitempty"`

	// +kubebuilder:validation:Required
	// Name: User defined name if this WebTest.
	Name *string `json:"Name,omitempty"`

	// OperatorSpec: The specification for configuring operator behavior. This field is interpreted by the operator and not
	// passed directly to Azure
	OperatorSpec *WebtestOperatorSpec `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 resources.azure.com/ResourceGroup resource
	Owner *genruntime.KnownResourceReference `group:"resources.azure.com" json:"owner,omitempty" kind:"ResourceGroup"`

	// Request: The collection of request properties
	Request *WebTestProperties_Request `json:"Request,omitempty"`

	// RetryEnabled: Allow for retries should this WebTest fail.
	RetryEnabled *bool `json:"RetryEnabled,omitempty"`

	// +kubebuilder:validation:Required
	// SyntheticMonitorId: Unique ID of this WebTest. This is typically the same value as the Name field.
	SyntheticMonitorId *string `json:"SyntheticMonitorId,omitempty"`

	// Tags: Resource tags
	Tags map[string]string `json:"tags,omitempty"`

	// Timeout: Seconds until this WebTest will timeout and fail. Default value is 30.
	Timeout *int `json:"Timeout,omitempty"`

	// ValidationRules: The collection of validation rule properties
	ValidationRules *WebTestProperties_ValidationRules `json:"ValidationRules,omitempty"`
}

var _ genruntime.ARMTransformer = &Webtest_Spec{}

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

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

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

	// Set property "Properties":
	if webtest.Configuration != nil ||
		webtest.Description != nil ||
		webtest.Enabled != nil ||
		webtest.Frequency != nil ||
		webtest.Kind != nil ||
		webtest.Locations != nil ||
		webtest.Name != nil ||
		webtest.Request != nil ||
		webtest.RetryEnabled != nil ||
		webtest.SyntheticMonitorId != nil ||
		webtest.Timeout != nil ||
		webtest.ValidationRules != nil {
		result.Properties = &arm.WebTestProperties{}
	}
	if webtest.Configuration != nil {
		configuration_ARM, err := webtest.Configuration.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		configuration := *configuration_ARM.(*arm.WebTestProperties_Configuration)
		result.Properties.Configuration = &configuration
	}
	if webtest.Description != nil {
		description := *webtest.Description
		result.Properties.Description = &description
	}
	if webtest.Enabled != nil {
		enabled := *webtest.Enabled
		result.Properties.Enabled = &enabled
	}
	if webtest.Frequency != nil {
		frequency := *webtest.Frequency
		result.Properties.Frequency = &frequency
	}
	if webtest.Kind != nil {
		var temp string
		temp = string(*webtest.Kind)
		kind := arm.WebTestProperties_Kind(temp)
		result.Properties.Kind = &kind
	}
	for _, item := range webtest.Locations {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Properties.Locations = append(result.Properties.Locations, *item_ARM.(*arm.WebTestGeolocation))
	}
	if webtest.Name != nil {
		name := *webtest.Name
		result.Properties.Name = &name
	}
	if webtest.Request != nil {
		request_ARM, err := webtest.Request.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		request := *request_ARM.(*arm.WebTestProperties_Request)
		result.Properties.Request = &request
	}
	if webtest.RetryEnabled != nil {
		retryEnabled := *webtest.RetryEnabled
		result.Properties.RetryEnabled = &retryEnabled
	}
	if webtest.SyntheticMonitorId != nil {
		syntheticMonitorId := *webtest.SyntheticMonitorId
		result.Properties.SyntheticMonitorId = &syntheticMonitorId
	}
	if webtest.Timeout != nil {
		timeout := *webtest.Timeout
		result.Properties.Timeout = &timeout
	}
	if webtest.ValidationRules != nil {
		validationRules_ARM, err := webtest.ValidationRules.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		validationRules := *validationRules_ARM.(*arm.WebTestProperties_ValidationRules)
		result.Properties.ValidationRules = &validationRules
	}

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

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

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

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

	// Set property "Configuration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Configuration != nil {
			var configuration1 WebTestProperties_Configuration
			err := configuration1.PopulateFromARM(owner, *typedInput.Properties.Configuration)
			if err != nil {
				return err
			}
			configuration := configuration1
			webtest.Configuration = &configuration
		}
	}

	// Set property "Description":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Description != nil {
			description := *typedInput.Properties.Description
			webtest.Description = &description
		}
	}

	// Set property "Enabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Enabled != nil {
			enabled := *typedInput.Properties.Enabled
			webtest.Enabled = &enabled
		}
	}

	// Set property "Frequency":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Frequency != nil {
			frequency := *typedInput.Properties.Frequency
			webtest.Frequency = &frequency
		}
	}

	// Set property "Kind":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Kind != nil {
			var temp string
			temp = string(*typedInput.Properties.Kind)
			kind := WebTestProperties_Kind(temp)
			webtest.Kind = &kind
		}
	}

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

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

	// Set property "Name":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Name != nil {
			name := *typedInput.Properties.Name
			webtest.Name = &name
		}
	}

	// no assignment for property "OperatorSpec"

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

	// Set property "Request":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Request != nil {
			var request1 WebTestProperties_Request
			err := request1.PopulateFromARM(owner, *typedInput.Properties.Request)
			if err != nil {
				return err
			}
			request := request1
			webtest.Request = &request
		}
	}

	// Set property "RetryEnabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RetryEnabled != nil {
			retryEnabled := *typedInput.Properties.RetryEnabled
			webtest.RetryEnabled = &retryEnabled
		}
	}

	// Set property "SyntheticMonitorId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SyntheticMonitorId != nil {
			syntheticMonitorId := *typedInput.Properties.SyntheticMonitorId
			webtest.SyntheticMonitorId = &syntheticMonitorId
		}
	}

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

	// Set property "Timeout":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Timeout != nil {
			timeout := *typedInput.Properties.Timeout
			webtest.Timeout = &timeout
		}
	}

	// Set property "ValidationRules":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ValidationRules != nil {
			var validationRules1 WebTestProperties_ValidationRules
			err := validationRules1.PopulateFromARM(owner, *typedInput.Properties.ValidationRules)
			if err != nil {
				return err
			}
			validationRules := validationRules1
			webtest.ValidationRules = &validationRules
		}
	}

	// No error
	return nil
}

var _ genruntime.ConvertibleSpec = &Webtest_Spec{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Webtest_Spec{}
	err := webtest.AssignProperties_To_Webtest_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_Webtest_Spec populates our Webtest_Spec from the provided source Webtest_Spec
func (webtest *Webtest_Spec) AssignProperties_From_Webtest_Spec(source *storage.Webtest_Spec) error {

	// AzureName
	webtest.AzureName = source.AzureName

	// Configuration
	if source.Configuration != nil {
		var configuration WebTestProperties_Configuration
		err := configuration.AssignProperties_From_WebTestProperties_Configuration(source.Configuration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WebTestProperties_Configuration() to populate field Configuration")
		}
		webtest.Configuration = &configuration
	} else {
		webtest.Configuration = nil
	}

	// Description
	webtest.Description = genruntime.ClonePointerToString(source.Description)

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		webtest.Enabled = &enabled
	} else {
		webtest.Enabled = nil
	}

	// Frequency
	webtest.Frequency = genruntime.ClonePointerToInt(source.Frequency)

	// Kind
	if source.Kind != nil {
		kind := *source.Kind
		kindTemp := genruntime.ToEnum(kind, webTestProperties_Kind_Values)
		webtest.Kind = &kindTemp
	} else {
		webtest.Kind = nil
	}

	// Location
	webtest.Location = genruntime.ClonePointerToString(source.Location)

	// Locations
	if source.Locations != nil {
		locationList := make([]WebTestGeolocation, len(source.Locations))
		for locationIndex, locationItem := range source.Locations {
			var location WebTestGeolocation
			err := location.AssignProperties_From_WebTestGeolocation(&locationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_WebTestGeolocation() to populate field Locations")
			}
			locationList[locationIndex] = location
		}
		webtest.Locations = locationList
	} else {
		webtest.Locations = nil
	}

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

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

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

	// Request
	if source.Request != nil {
		var request WebTestProperties_Request
		err := request.AssignProperties_From_WebTestProperties_Request(source.Request)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WebTestProperties_Request() to populate field Request")
		}
		webtest.Request = &request
	} else {
		webtest.Request = nil
	}

	// RetryEnabled
	if source.RetryEnabled != nil {
		retryEnabled := *source.RetryEnabled
		webtest.RetryEnabled = &retryEnabled
	} else {
		webtest.RetryEnabled = nil
	}

	// SyntheticMonitorId
	webtest.SyntheticMonitorId = genruntime.ClonePointerToString(source.SyntheticMonitorId)

	// Tags
	webtest.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// Timeout
	webtest.Timeout = genruntime.ClonePointerToInt(source.Timeout)

	// ValidationRules
	if source.ValidationRules != nil {
		var validationRule WebTestProperties_ValidationRules
		err := validationRule.AssignProperties_From_WebTestProperties_ValidationRules(source.ValidationRules)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WebTestProperties_ValidationRules() to populate field ValidationRules")
		}
		webtest.ValidationRules = &validationRule
	} else {
		webtest.ValidationRules = nil
	}

	// No error
	return nil
}

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

	// AzureName
	destination.AzureName = webtest.AzureName

	// Configuration
	if webtest.Configuration != nil {
		var configuration storage.WebTestProperties_Configuration
		err := webtest.Configuration.AssignProperties_To_WebTestProperties_Configuration(&configuration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WebTestProperties_Configuration() to populate field Configuration")
		}
		destination.Configuration = &configuration
	} else {
		destination.Configuration = nil
	}

	// Description
	destination.Description = genruntime.ClonePointerToString(webtest.Description)

	// Enabled
	if webtest.Enabled != nil {
		enabled := *webtest.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

	// Frequency
	destination.Frequency = genruntime.ClonePointerToInt(webtest.Frequency)

	// Kind
	if webtest.Kind != nil {
		kind := string(*webtest.Kind)
		destination.Kind = &kind
	} else {
		destination.Kind = nil
	}

	// Location
	destination.Location = genruntime.ClonePointerToString(webtest.Location)

	// Locations
	if webtest.Locations != nil {
		locationList := make([]storage.WebTestGeolocation, len(webtest.Locations))
		for locationIndex, locationItem := range webtest.Locations {
			var location storage.WebTestGeolocation
			err := locationItem.AssignProperties_To_WebTestGeolocation(&location)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_WebTestGeolocation() to populate field Locations")
			}
			locationList[locationIndex] = location
		}
		destination.Locations = locationList
	} else {
		destination.Locations = nil
	}

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

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

	// OriginalVersion
	destination.OriginalVersion = webtest.OriginalVersion()

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

	// Request
	if webtest.Request != nil {
		var request storage.WebTestProperties_Request
		err := webtest.Request.AssignProperties_To_WebTestProperties_Request(&request)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WebTestProperties_Request() to populate field Request")
		}
		destination.Request = &request
	} else {
		destination.Request = nil
	}

	// RetryEnabled
	if webtest.RetryEnabled != nil {
		retryEnabled := *webtest.RetryEnabled
		destination.RetryEnabled = &retryEnabled
	} else {
		destination.RetryEnabled = nil
	}

	// SyntheticMonitorId
	destination.SyntheticMonitorId = genruntime.ClonePointerToString(webtest.SyntheticMonitorId)

	// Tags
	destination.Tags = genruntime.CloneMapOfStringToString(webtest.Tags)

	// Timeout
	destination.Timeout = genruntime.ClonePointerToInt(webtest.Timeout)

	// ValidationRules
	if webtest.ValidationRules != nil {
		var validationRule storage.WebTestProperties_ValidationRules
		err := webtest.ValidationRules.AssignProperties_To_WebTestProperties_ValidationRules(&validationRule)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WebTestProperties_ValidationRules() to populate field ValidationRules")
		}
		destination.ValidationRules = &validationRule
	} else {
		destination.ValidationRules = nil
	}

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

	// No error
	return nil
}

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

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

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

	// Configuration: An XML configuration specification for a WebTest.
	Configuration *WebTestProperties_Configuration_STATUS `json:"Configuration,omitempty"`

	// Description: User defined description for this WebTest.
	Description *string `json:"Description,omitempty"`

	// Enabled: Is the test actively being monitored.
	Enabled *bool `json:"Enabled,omitempty"`

	// Frequency: Interval in seconds between test runs for this WebTest. Default value is 300.
	Frequency *int `json:"Frequency,omitempty"`

	// Id: Azure resource Id
	Id *string `json:"id,omitempty"`

	// Kind: The kind of web test this is, valid choices are ping, multistep, basic, and standard.
	Kind *WebTestProperties_Kind_STATUS `json:"Kind,omitempty"`

	// Location: Resource location
	Location *string `json:"location,omitempty"`

	// Locations: A list of where to physically run the tests from to give global coverage for accessibility of your
	// application.
	Locations []WebTestGeolocation_STATUS `json:"Locations,omitempty"`

	// Name: Azure resource name
	Name *string `json:"name,omitempty"`

	// PropertiesName: User defined name if this WebTest.
	PropertiesName *string `json:"properties_name,omitempty"`

	// ProvisioningState: Current state of this component, whether or not is has been provisioned within the resource group it
	// is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying,
	// Canceled, and Failed.
	ProvisioningState *string `json:"provisioningState,omitempty"`

	// Request: The collection of request properties
	Request *WebTestProperties_Request_STATUS `json:"Request,omitempty"`

	// RetryEnabled: Allow for retries should this WebTest fail.
	RetryEnabled *bool `json:"RetryEnabled,omitempty"`

	// SyntheticMonitorId: Unique ID of this WebTest. This is typically the same value as the Name field.
	SyntheticMonitorId *string `json:"SyntheticMonitorId,omitempty"`

	// Tags: Resource tags
	Tags map[string]string `json:"tags,omitempty"`

	// Timeout: Seconds until this WebTest will timeout and fail. Default value is 30.
	Timeout *int `json:"Timeout,omitempty"`

	// Type: Azure resource type
	Type *string `json:"type,omitempty"`

	// ValidationRules: The collection of validation rule properties
	ValidationRules *WebTestProperties_ValidationRules_STATUS `json:"ValidationRules,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Webtest_STATUS{}

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

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

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

	return nil
}

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

	// Convert to an intermediate form
	dst = &storage.Webtest_STATUS{}
	err := webtest.AssignProperties_To_Webtest_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 = &Webtest_STATUS{}

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

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

	// no assignment for property "Conditions"

	// Set property "Configuration":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Configuration != nil {
			var configuration1 WebTestProperties_Configuration_STATUS
			err := configuration1.PopulateFromARM(owner, *typedInput.Properties.Configuration)
			if err != nil {
				return err
			}
			configuration := configuration1
			webtest.Configuration = &configuration
		}
	}

	// Set property "Description":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Description != nil {
			description := *typedInput.Properties.Description
			webtest.Description = &description
		}
	}

	// Set property "Enabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Enabled != nil {
			enabled := *typedInput.Properties.Enabled
			webtest.Enabled = &enabled
		}
	}

	// Set property "Frequency":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Frequency != nil {
			frequency := *typedInput.Properties.Frequency
			webtest.Frequency = &frequency
		}
	}

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

	// Set property "Kind":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Kind != nil {
			var temp string
			temp = string(*typedInput.Properties.Kind)
			kind := WebTestProperties_Kind_STATUS(temp)
			webtest.Kind = &kind
		}
	}

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

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

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

	// Set property "PropertiesName":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Name != nil {
			propertiesName := *typedInput.Properties.Name
			webtest.PropertiesName = &propertiesName
		}
	}

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

	// Set property "Request":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Request != nil {
			var request1 WebTestProperties_Request_STATUS
			err := request1.PopulateFromARM(owner, *typedInput.Properties.Request)
			if err != nil {
				return err
			}
			request := request1
			webtest.Request = &request
		}
	}

	// Set property "RetryEnabled":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.RetryEnabled != nil {
			retryEnabled := *typedInput.Properties.RetryEnabled
			webtest.RetryEnabled = &retryEnabled
		}
	}

	// Set property "SyntheticMonitorId":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.SyntheticMonitorId != nil {
			syntheticMonitorId := *typedInput.Properties.SyntheticMonitorId
			webtest.SyntheticMonitorId = &syntheticMonitorId
		}
	}

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

	// Set property "Timeout":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.Timeout != nil {
			timeout := *typedInput.Properties.Timeout
			webtest.Timeout = &timeout
		}
	}

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

	// Set property "ValidationRules":
	// copying flattened property:
	if typedInput.Properties != nil {
		if typedInput.Properties.ValidationRules != nil {
			var validationRules1 WebTestProperties_ValidationRules_STATUS
			err := validationRules1.PopulateFromARM(owner, *typedInput.Properties.ValidationRules)
			if err != nil {
				return err
			}
			validationRules := validationRules1
			webtest.ValidationRules = &validationRules
		}
	}

	// No error
	return nil
}

// AssignProperties_From_Webtest_STATUS populates our Webtest_STATUS from the provided source Webtest_STATUS
func (webtest *Webtest_STATUS) AssignProperties_From_Webtest_STATUS(source *storage.Webtest_STATUS) error {

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

	// Configuration
	if source.Configuration != nil {
		var configuration WebTestProperties_Configuration_STATUS
		err := configuration.AssignProperties_From_WebTestProperties_Configuration_STATUS(source.Configuration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WebTestProperties_Configuration_STATUS() to populate field Configuration")
		}
		webtest.Configuration = &configuration
	} else {
		webtest.Configuration = nil
	}

	// Description
	webtest.Description = genruntime.ClonePointerToString(source.Description)

	// Enabled
	if source.Enabled != nil {
		enabled := *source.Enabled
		webtest.Enabled = &enabled
	} else {
		webtest.Enabled = nil
	}

	// Frequency
	webtest.Frequency = genruntime.ClonePointerToInt(source.Frequency)

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

	// Kind
	if source.Kind != nil {
		kind := *source.Kind
		kindTemp := genruntime.ToEnum(kind, webTestProperties_Kind_STATUS_Values)
		webtest.Kind = &kindTemp
	} else {
		webtest.Kind = nil
	}

	// Location
	webtest.Location = genruntime.ClonePointerToString(source.Location)

	// Locations
	if source.Locations != nil {
		locationList := make([]WebTestGeolocation_STATUS, len(source.Locations))
		for locationIndex, locationItem := range source.Locations {
			var location WebTestGeolocation_STATUS
			err := location.AssignProperties_From_WebTestGeolocation_STATUS(&locationItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_WebTestGeolocation_STATUS() to populate field Locations")
			}
			locationList[locationIndex] = location
		}
		webtest.Locations = locationList
	} else {
		webtest.Locations = nil
	}

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

	// PropertiesName
	webtest.PropertiesName = genruntime.ClonePointerToString(source.PropertiesName)

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

	// Request
	if source.Request != nil {
		var request WebTestProperties_Request_STATUS
		err := request.AssignProperties_From_WebTestProperties_Request_STATUS(source.Request)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WebTestProperties_Request_STATUS() to populate field Request")
		}
		webtest.Request = &request
	} else {
		webtest.Request = nil
	}

	// RetryEnabled
	if source.RetryEnabled != nil {
		retryEnabled := *source.RetryEnabled
		webtest.RetryEnabled = &retryEnabled
	} else {
		webtest.RetryEnabled = nil
	}

	// SyntheticMonitorId
	webtest.SyntheticMonitorId = genruntime.ClonePointerToString(source.SyntheticMonitorId)

	// Tags
	webtest.Tags = genruntime.CloneMapOfStringToString(source.Tags)

	// Timeout
	webtest.Timeout = genruntime.ClonePointerToInt(source.Timeout)

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

	// ValidationRules
	if source.ValidationRules != nil {
		var validationRule WebTestProperties_ValidationRules_STATUS
		err := validationRule.AssignProperties_From_WebTestProperties_ValidationRules_STATUS(source.ValidationRules)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WebTestProperties_ValidationRules_STATUS() to populate field ValidationRules")
		}
		webtest.ValidationRules = &validationRule
	} else {
		webtest.ValidationRules = nil
	}

	// No error
	return nil
}

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

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

	// Configuration
	if webtest.Configuration != nil {
		var configuration storage.WebTestProperties_Configuration_STATUS
		err := webtest.Configuration.AssignProperties_To_WebTestProperties_Configuration_STATUS(&configuration)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WebTestProperties_Configuration_STATUS() to populate field Configuration")
		}
		destination.Configuration = &configuration
	} else {
		destination.Configuration = nil
	}

	// Description
	destination.Description = genruntime.ClonePointerToString(webtest.Description)

	// Enabled
	if webtest.Enabled != nil {
		enabled := *webtest.Enabled
		destination.Enabled = &enabled
	} else {
		destination.Enabled = nil
	}

	// Frequency
	destination.Frequency = genruntime.ClonePointerToInt(webtest.Frequency)

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

	// Kind
	if webtest.Kind != nil {
		kind := string(*webtest.Kind)
		destination.Kind = &kind
	} else {
		destination.Kind = nil
	}

	// Location
	destination.Location = genruntime.ClonePointerToString(webtest.Location)

	// Locations
	if webtest.Locations != nil {
		locationList := make([]storage.WebTestGeolocation_STATUS, len(webtest.Locations))
		for locationIndex, locationItem := range webtest.Locations {
			var location storage.WebTestGeolocation_STATUS
			err := locationItem.AssignProperties_To_WebTestGeolocation_STATUS(&location)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_WebTestGeolocation_STATUS() to populate field Locations")
			}
			locationList[locationIndex] = location
		}
		destination.Locations = locationList
	} else {
		destination.Locations = nil
	}

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

	// PropertiesName
	destination.PropertiesName = genruntime.ClonePointerToString(webtest.PropertiesName)

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

	// Request
	if webtest.Request != nil {
		var request storage.WebTestProperties_Request_STATUS
		err := webtest.Request.AssignProperties_To_WebTestProperties_Request_STATUS(&request)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WebTestProperties_Request_STATUS() to populate field Request")
		}
		destination.Request = &request
	} else {
		destination.Request = nil
	}

	// RetryEnabled
	if webtest.RetryEnabled != nil {
		retryEnabled := *webtest.RetryEnabled
		destination.RetryEnabled = &retryEnabled
	} else {
		destination.RetryEnabled = nil
	}

	// SyntheticMonitorId
	destination.SyntheticMonitorId = genruntime.ClonePointerToString(webtest.SyntheticMonitorId)

	// Tags
	destination.Tags = genruntime.CloneMapOfStringToString(webtest.Tags)

	// Timeout
	destination.Timeout = genruntime.ClonePointerToInt(webtest.Timeout)

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

	// ValidationRules
	if webtest.ValidationRules != nil {
		var validationRule storage.WebTestProperties_ValidationRules_STATUS
		err := webtest.ValidationRules.AssignProperties_To_WebTestProperties_ValidationRules_STATUS(&validationRule)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WebTestProperties_ValidationRules_STATUS() to populate field ValidationRules")
		}
		destination.ValidationRules = &validationRule
	} else {
		destination.ValidationRules = nil
	}

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

	// No error
	return nil
}

// Geo-physical location to run a WebTest from. You must specify one or more locations for the test to run from.
type WebTestGeolocation struct {
	// Id: Location ID for the WebTest to run from.
	Id *string `json:"Id,omitempty"`
}

var _ genruntime.ARMTransformer = &WebTestGeolocation{}

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

	// Set property "Id":
	if geolocation.Id != nil {
		id := *geolocation.Id
		result.Id = &id
	}
	return result, nil
}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_WebTestGeolocation populates our WebTestGeolocation from the provided source WebTestGeolocation
func (geolocation *WebTestGeolocation) AssignProperties_From_WebTestGeolocation(source *storage.WebTestGeolocation) error {

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

	// No error
	return nil
}

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

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

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

	// No error
	return nil
}

// Geo-physical location to run a WebTest from. You must specify one or more locations for the test to run from.
type WebTestGeolocation_STATUS struct {
	// Id: Location ID for the WebTest to run from.
	Id *string `json:"Id,omitempty"`
}

var _ genruntime.FromARMConverter = &WebTestGeolocation_STATUS{}

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

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

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

	// No error
	return nil
}

// AssignProperties_From_WebTestGeolocation_STATUS populates our WebTestGeolocation_STATUS from the provided source WebTestGeolocation_STATUS
func (geolocation *WebTestGeolocation_STATUS) AssignProperties_From_WebTestGeolocation_STATUS(source *storage.WebTestGeolocation_STATUS) error {

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

	// No error
	return nil
}

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

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

	// 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 WebtestOperatorSpec 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_WebtestOperatorSpec populates our WebtestOperatorSpec from the provided source WebtestOperatorSpec
func (operator *WebtestOperatorSpec) AssignProperties_From_WebtestOperatorSpec(source *storage.WebtestOperatorSpec) 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_WebtestOperatorSpec populates the provided destination WebtestOperatorSpec from our WebtestOperatorSpec
func (operator *WebtestOperatorSpec) AssignProperties_To_WebtestOperatorSpec(destination *storage.WebtestOperatorSpec) 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
}

type WebTestProperties_Configuration struct {
	// WebTest: The XML specification of a WebTest to run against an application.
	WebTest *string `json:"WebTest,omitempty"`
}

var _ genruntime.ARMTransformer = &WebTestProperties_Configuration{}

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

	// Set property "WebTest":
	if configuration.WebTest != nil {
		webTest := *configuration.WebTest
		result.WebTest = &webTest
	}
	return result, nil
}

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

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

	// Set property "WebTest":
	if typedInput.WebTest != nil {
		webTest := *typedInput.WebTest
		configuration.WebTest = &webTest
	}

	// No error
	return nil
}

// AssignProperties_From_WebTestProperties_Configuration populates our WebTestProperties_Configuration from the provided source WebTestProperties_Configuration
func (configuration *WebTestProperties_Configuration) AssignProperties_From_WebTestProperties_Configuration(source *storage.WebTestProperties_Configuration) error {

	// WebTest
	configuration.WebTest = genruntime.ClonePointerToString(source.WebTest)

	// No error
	return nil
}

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

	// WebTest
	destination.WebTest = genruntime.ClonePointerToString(configuration.WebTest)

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

	// No error
	return nil
}

type WebTestProperties_Configuration_STATUS struct {
	// WebTest: The XML specification of a WebTest to run against an application.
	WebTest *string `json:"WebTest,omitempty"`
}

var _ genruntime.FromARMConverter = &WebTestProperties_Configuration_STATUS{}

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

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

	// Set property "WebTest":
	if typedInput.WebTest != nil {
		webTest := *typedInput.WebTest
		configuration.WebTest = &webTest
	}

	// No error
	return nil
}

// AssignProperties_From_WebTestProperties_Configuration_STATUS populates our WebTestProperties_Configuration_STATUS from the provided source WebTestProperties_Configuration_STATUS
func (configuration *WebTestProperties_Configuration_STATUS) AssignProperties_From_WebTestProperties_Configuration_STATUS(source *storage.WebTestProperties_Configuration_STATUS) error {

	// WebTest
	configuration.WebTest = genruntime.ClonePointerToString(source.WebTest)

	// No error
	return nil
}

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

	// WebTest
	destination.WebTest = genruntime.ClonePointerToString(configuration.WebTest)

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

	// No error
	return nil
}

// +kubebuilder:validation:Enum={"basic","multistep","ping","standard"}
type WebTestProperties_Kind string

const (
	WebTestProperties_Kind_Basic     = WebTestProperties_Kind("basic")
	WebTestProperties_Kind_Multistep = WebTestProperties_Kind("multistep")
	WebTestProperties_Kind_Ping      = WebTestProperties_Kind("ping")
	WebTestProperties_Kind_Standard  = WebTestProperties_Kind("standard")
)

// Mapping from string to WebTestProperties_Kind
var webTestProperties_Kind_Values = map[string]WebTestProperties_Kind{
	"basic":     WebTestProperties_Kind_Basic,
	"multistep": WebTestProperties_Kind_Multistep,
	"ping":      WebTestProperties_Kind_Ping,
	"standard":  WebTestProperties_Kind_Standard,
}

type WebTestProperties_Kind_STATUS string

const (
	WebTestProperties_Kind_STATUS_Basic     = WebTestProperties_Kind_STATUS("basic")
	WebTestProperties_Kind_STATUS_Multistep = WebTestProperties_Kind_STATUS("multistep")
	WebTestProperties_Kind_STATUS_Ping      = WebTestProperties_Kind_STATUS("ping")
	WebTestProperties_Kind_STATUS_Standard  = WebTestProperties_Kind_STATUS("standard")
)

// Mapping from string to WebTestProperties_Kind_STATUS
var webTestProperties_Kind_STATUS_Values = map[string]WebTestProperties_Kind_STATUS{
	"basic":     WebTestProperties_Kind_STATUS_Basic,
	"multistep": WebTestProperties_Kind_STATUS_Multistep,
	"ping":      WebTestProperties_Kind_STATUS_Ping,
	"standard":  WebTestProperties_Kind_STATUS_Standard,
}

type WebTestProperties_Request struct {
	// FollowRedirects: Follow redirects for this web test.
	FollowRedirects *bool `json:"FollowRedirects,omitempty"`

	// Headers: List of headers and their values to add to the WebTest call.
	Headers []HeaderField `json:"Headers,omitempty"`

	// HttpVerb: Http verb to use for this web test.
	HttpVerb *string `json:"HttpVerb,omitempty"`

	// ParseDependentRequests: Parse Dependent request for this WebTest.
	ParseDependentRequests *bool `json:"ParseDependentRequests,omitempty"`

	// RequestBody: Base64 encoded string body to send with this web test.
	RequestBody *string `json:"RequestBody,omitempty"`

	// RequestUrl: Url location to test.
	RequestUrl *string `json:"RequestUrl,omitempty"`
}

var _ genruntime.ARMTransformer = &WebTestProperties_Request{}

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

	// Set property "FollowRedirects":
	if request.FollowRedirects != nil {
		followRedirects := *request.FollowRedirects
		result.FollowRedirects = &followRedirects
	}

	// Set property "Headers":
	for _, item := range request.Headers {
		item_ARM, err := item.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		result.Headers = append(result.Headers, *item_ARM.(*arm.HeaderField))
	}

	// Set property "HttpVerb":
	if request.HttpVerb != nil {
		httpVerb := *request.HttpVerb
		result.HttpVerb = &httpVerb
	}

	// Set property "ParseDependentRequests":
	if request.ParseDependentRequests != nil {
		parseDependentRequests := *request.ParseDependentRequests
		result.ParseDependentRequests = &parseDependentRequests
	}

	// Set property "RequestBody":
	if request.RequestBody != nil {
		requestBody := *request.RequestBody
		result.RequestBody = &requestBody
	}

	// Set property "RequestUrl":
	if request.RequestUrl != nil {
		requestUrl := *request.RequestUrl
		result.RequestUrl = &requestUrl
	}
	return result, nil
}

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

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

	// Set property "FollowRedirects":
	if typedInput.FollowRedirects != nil {
		followRedirects := *typedInput.FollowRedirects
		request.FollowRedirects = &followRedirects
	}

	// Set property "Headers":
	for _, item := range typedInput.Headers {
		var item1 HeaderField
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		request.Headers = append(request.Headers, item1)
	}

	// Set property "HttpVerb":
	if typedInput.HttpVerb != nil {
		httpVerb := *typedInput.HttpVerb
		request.HttpVerb = &httpVerb
	}

	// Set property "ParseDependentRequests":
	if typedInput.ParseDependentRequests != nil {
		parseDependentRequests := *typedInput.ParseDependentRequests
		request.ParseDependentRequests = &parseDependentRequests
	}

	// Set property "RequestBody":
	if typedInput.RequestBody != nil {
		requestBody := *typedInput.RequestBody
		request.RequestBody = &requestBody
	}

	// Set property "RequestUrl":
	if typedInput.RequestUrl != nil {
		requestUrl := *typedInput.RequestUrl
		request.RequestUrl = &requestUrl
	}

	// No error
	return nil
}

// AssignProperties_From_WebTestProperties_Request populates our WebTestProperties_Request from the provided source WebTestProperties_Request
func (request *WebTestProperties_Request) AssignProperties_From_WebTestProperties_Request(source *storage.WebTestProperties_Request) error {

	// FollowRedirects
	if source.FollowRedirects != nil {
		followRedirect := *source.FollowRedirects
		request.FollowRedirects = &followRedirect
	} else {
		request.FollowRedirects = nil
	}

	// Headers
	if source.Headers != nil {
		headerList := make([]HeaderField, len(source.Headers))
		for headerIndex, headerItem := range source.Headers {
			var header HeaderField
			err := header.AssignProperties_From_HeaderField(&headerItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_HeaderField() to populate field Headers")
			}
			headerList[headerIndex] = header
		}
		request.Headers = headerList
	} else {
		request.Headers = nil
	}

	// HttpVerb
	request.HttpVerb = genruntime.ClonePointerToString(source.HttpVerb)

	// ParseDependentRequests
	if source.ParseDependentRequests != nil {
		parseDependentRequest := *source.ParseDependentRequests
		request.ParseDependentRequests = &parseDependentRequest
	} else {
		request.ParseDependentRequests = nil
	}

	// RequestBody
	request.RequestBody = genruntime.ClonePointerToString(source.RequestBody)

	// RequestUrl
	request.RequestUrl = genruntime.ClonePointerToString(source.RequestUrl)

	// No error
	return nil
}

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

	// FollowRedirects
	if request.FollowRedirects != nil {
		followRedirect := *request.FollowRedirects
		destination.FollowRedirects = &followRedirect
	} else {
		destination.FollowRedirects = nil
	}

	// Headers
	if request.Headers != nil {
		headerList := make([]storage.HeaderField, len(request.Headers))
		for headerIndex, headerItem := range request.Headers {
			var header storage.HeaderField
			err := headerItem.AssignProperties_To_HeaderField(&header)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_HeaderField() to populate field Headers")
			}
			headerList[headerIndex] = header
		}
		destination.Headers = headerList
	} else {
		destination.Headers = nil
	}

	// HttpVerb
	destination.HttpVerb = genruntime.ClonePointerToString(request.HttpVerb)

	// ParseDependentRequests
	if request.ParseDependentRequests != nil {
		parseDependentRequest := *request.ParseDependentRequests
		destination.ParseDependentRequests = &parseDependentRequest
	} else {
		destination.ParseDependentRequests = nil
	}

	// RequestBody
	destination.RequestBody = genruntime.ClonePointerToString(request.RequestBody)

	// RequestUrl
	destination.RequestUrl = genruntime.ClonePointerToString(request.RequestUrl)

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

	// No error
	return nil
}

type WebTestProperties_Request_STATUS struct {
	// FollowRedirects: Follow redirects for this web test.
	FollowRedirects *bool `json:"FollowRedirects,omitempty"`

	// Headers: List of headers and their values to add to the WebTest call.
	Headers []HeaderField_STATUS `json:"Headers,omitempty"`

	// HttpVerb: Http verb to use for this web test.
	HttpVerb *string `json:"HttpVerb,omitempty"`

	// ParseDependentRequests: Parse Dependent request for this WebTest.
	ParseDependentRequests *bool `json:"ParseDependentRequests,omitempty"`

	// RequestBody: Base64 encoded string body to send with this web test.
	RequestBody *string `json:"RequestBody,omitempty"`

	// RequestUrl: Url location to test.
	RequestUrl *string `json:"RequestUrl,omitempty"`
}

var _ genruntime.FromARMConverter = &WebTestProperties_Request_STATUS{}

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

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

	// Set property "FollowRedirects":
	if typedInput.FollowRedirects != nil {
		followRedirects := *typedInput.FollowRedirects
		request.FollowRedirects = &followRedirects
	}

	// Set property "Headers":
	for _, item := range typedInput.Headers {
		var item1 HeaderField_STATUS
		err := item1.PopulateFromARM(owner, item)
		if err != nil {
			return err
		}
		request.Headers = append(request.Headers, item1)
	}

	// Set property "HttpVerb":
	if typedInput.HttpVerb != nil {
		httpVerb := *typedInput.HttpVerb
		request.HttpVerb = &httpVerb
	}

	// Set property "ParseDependentRequests":
	if typedInput.ParseDependentRequests != nil {
		parseDependentRequests := *typedInput.ParseDependentRequests
		request.ParseDependentRequests = &parseDependentRequests
	}

	// Set property "RequestBody":
	if typedInput.RequestBody != nil {
		requestBody := *typedInput.RequestBody
		request.RequestBody = &requestBody
	}

	// Set property "RequestUrl":
	if typedInput.RequestUrl != nil {
		requestUrl := *typedInput.RequestUrl
		request.RequestUrl = &requestUrl
	}

	// No error
	return nil
}

// AssignProperties_From_WebTestProperties_Request_STATUS populates our WebTestProperties_Request_STATUS from the provided source WebTestProperties_Request_STATUS
func (request *WebTestProperties_Request_STATUS) AssignProperties_From_WebTestProperties_Request_STATUS(source *storage.WebTestProperties_Request_STATUS) error {

	// FollowRedirects
	if source.FollowRedirects != nil {
		followRedirect := *source.FollowRedirects
		request.FollowRedirects = &followRedirect
	} else {
		request.FollowRedirects = nil
	}

	// Headers
	if source.Headers != nil {
		headerList := make([]HeaderField_STATUS, len(source.Headers))
		for headerIndex, headerItem := range source.Headers {
			var header HeaderField_STATUS
			err := header.AssignProperties_From_HeaderField_STATUS(&headerItem)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_From_HeaderField_STATUS() to populate field Headers")
			}
			headerList[headerIndex] = header
		}
		request.Headers = headerList
	} else {
		request.Headers = nil
	}

	// HttpVerb
	request.HttpVerb = genruntime.ClonePointerToString(source.HttpVerb)

	// ParseDependentRequests
	if source.ParseDependentRequests != nil {
		parseDependentRequest := *source.ParseDependentRequests
		request.ParseDependentRequests = &parseDependentRequest
	} else {
		request.ParseDependentRequests = nil
	}

	// RequestBody
	request.RequestBody = genruntime.ClonePointerToString(source.RequestBody)

	// RequestUrl
	request.RequestUrl = genruntime.ClonePointerToString(source.RequestUrl)

	// No error
	return nil
}

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

	// FollowRedirects
	if request.FollowRedirects != nil {
		followRedirect := *request.FollowRedirects
		destination.FollowRedirects = &followRedirect
	} else {
		destination.FollowRedirects = nil
	}

	// Headers
	if request.Headers != nil {
		headerList := make([]storage.HeaderField_STATUS, len(request.Headers))
		for headerIndex, headerItem := range request.Headers {
			var header storage.HeaderField_STATUS
			err := headerItem.AssignProperties_To_HeaderField_STATUS(&header)
			if err != nil {
				return eris.Wrap(err, "calling AssignProperties_To_HeaderField_STATUS() to populate field Headers")
			}
			headerList[headerIndex] = header
		}
		destination.Headers = headerList
	} else {
		destination.Headers = nil
	}

	// HttpVerb
	destination.HttpVerb = genruntime.ClonePointerToString(request.HttpVerb)

	// ParseDependentRequests
	if request.ParseDependentRequests != nil {
		parseDependentRequest := *request.ParseDependentRequests
		destination.ParseDependentRequests = &parseDependentRequest
	} else {
		destination.ParseDependentRequests = nil
	}

	// RequestBody
	destination.RequestBody = genruntime.ClonePointerToString(request.RequestBody)

	// RequestUrl
	destination.RequestUrl = genruntime.ClonePointerToString(request.RequestUrl)

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

	// No error
	return nil
}

type WebTestProperties_ValidationRules struct {
	// ContentValidation: The collection of content validation properties
	ContentValidation *WebTestProperties_ValidationRules_ContentValidation `json:"ContentValidation,omitempty"`

	// ExpectedHttpStatusCode: Validate that the WebTest returns the http status code provided.
	ExpectedHttpStatusCode *int `json:"ExpectedHttpStatusCode,omitempty"`

	// IgnoreHttpsStatusCode: When set, validation will ignore the status code.
	IgnoreHttpsStatusCode *bool `json:"IgnoreHttpsStatusCode,omitempty"`

	// SSLCertRemainingLifetimeCheck: A number of days to check still remain before the the existing SSL cert expires.  Value
	// must be positive and the SSLCheck must be set to true.
	SSLCertRemainingLifetimeCheck *int `json:"SSLCertRemainingLifetimeCheck,omitempty"`

	// SSLCheck: Checks to see if the SSL cert is still valid.
	SSLCheck *bool `json:"SSLCheck,omitempty"`
}

var _ genruntime.ARMTransformer = &WebTestProperties_ValidationRules{}

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

	// Set property "ContentValidation":
	if rules.ContentValidation != nil {
		contentValidation_ARM, err := rules.ContentValidation.ConvertToARM(resolved)
		if err != nil {
			return nil, err
		}
		contentValidation := *contentValidation_ARM.(*arm.WebTestProperties_ValidationRules_ContentValidation)
		result.ContentValidation = &contentValidation
	}

	// Set property "ExpectedHttpStatusCode":
	if rules.ExpectedHttpStatusCode != nil {
		expectedHttpStatusCode := *rules.ExpectedHttpStatusCode
		result.ExpectedHttpStatusCode = &expectedHttpStatusCode
	}

	// Set property "IgnoreHttpsStatusCode":
	if rules.IgnoreHttpsStatusCode != nil {
		ignoreHttpsStatusCode := *rules.IgnoreHttpsStatusCode
		result.IgnoreHttpsStatusCode = &ignoreHttpsStatusCode
	}

	// Set property "SSLCertRemainingLifetimeCheck":
	if rules.SSLCertRemainingLifetimeCheck != nil {
		sslCertRemainingLifetimeCheck := *rules.SSLCertRemainingLifetimeCheck
		result.SSLCertRemainingLifetimeCheck = &sslCertRemainingLifetimeCheck
	}

	// Set property "SSLCheck":
	if rules.SSLCheck != nil {
		sslCheck := *rules.SSLCheck
		result.SSLCheck = &sslCheck
	}
	return result, nil
}

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

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

	// Set property "ContentValidation":
	if typedInput.ContentValidation != nil {
		var contentValidation1 WebTestProperties_ValidationRules_ContentValidation
		err := contentValidation1.PopulateFromARM(owner, *typedInput.ContentValidation)
		if err != nil {
			return err
		}
		contentValidation := contentValidation1
		rules.ContentValidation = &contentValidation
	}

	// Set property "ExpectedHttpStatusCode":
	if typedInput.ExpectedHttpStatusCode != nil {
		expectedHttpStatusCode := *typedInput.ExpectedHttpStatusCode
		rules.ExpectedHttpStatusCode = &expectedHttpStatusCode
	}

	// Set property "IgnoreHttpsStatusCode":
	if typedInput.IgnoreHttpsStatusCode != nil {
		ignoreHttpsStatusCode := *typedInput.IgnoreHttpsStatusCode
		rules.IgnoreHttpsStatusCode = &ignoreHttpsStatusCode
	}

	// Set property "SSLCertRemainingLifetimeCheck":
	if typedInput.SSLCertRemainingLifetimeCheck != nil {
		sslCertRemainingLifetimeCheck := *typedInput.SSLCertRemainingLifetimeCheck
		rules.SSLCertRemainingLifetimeCheck = &sslCertRemainingLifetimeCheck
	}

	// Set property "SSLCheck":
	if typedInput.SSLCheck != nil {
		sslCheck := *typedInput.SSLCheck
		rules.SSLCheck = &sslCheck
	}

	// No error
	return nil
}

// AssignProperties_From_WebTestProperties_ValidationRules populates our WebTestProperties_ValidationRules from the provided source WebTestProperties_ValidationRules
func (rules *WebTestProperties_ValidationRules) AssignProperties_From_WebTestProperties_ValidationRules(source *storage.WebTestProperties_ValidationRules) error {

	// ContentValidation
	if source.ContentValidation != nil {
		var contentValidation WebTestProperties_ValidationRules_ContentValidation
		err := contentValidation.AssignProperties_From_WebTestProperties_ValidationRules_ContentValidation(source.ContentValidation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WebTestProperties_ValidationRules_ContentValidation() to populate field ContentValidation")
		}
		rules.ContentValidation = &contentValidation
	} else {
		rules.ContentValidation = nil
	}

	// ExpectedHttpStatusCode
	rules.ExpectedHttpStatusCode = genruntime.ClonePointerToInt(source.ExpectedHttpStatusCode)

	// IgnoreHttpsStatusCode
	if source.IgnoreHttpsStatusCode != nil {
		ignoreHttpsStatusCode := *source.IgnoreHttpsStatusCode
		rules.IgnoreHttpsStatusCode = &ignoreHttpsStatusCode
	} else {
		rules.IgnoreHttpsStatusCode = nil
	}

	// SSLCertRemainingLifetimeCheck
	rules.SSLCertRemainingLifetimeCheck = genruntime.ClonePointerToInt(source.SSLCertRemainingLifetimeCheck)

	// SSLCheck
	if source.SSLCheck != nil {
		sslCheck := *source.SSLCheck
		rules.SSLCheck = &sslCheck
	} else {
		rules.SSLCheck = nil
	}

	// No error
	return nil
}

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

	// ContentValidation
	if rules.ContentValidation != nil {
		var contentValidation storage.WebTestProperties_ValidationRules_ContentValidation
		err := rules.ContentValidation.AssignProperties_To_WebTestProperties_ValidationRules_ContentValidation(&contentValidation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WebTestProperties_ValidationRules_ContentValidation() to populate field ContentValidation")
		}
		destination.ContentValidation = &contentValidation
	} else {
		destination.ContentValidation = nil
	}

	// ExpectedHttpStatusCode
	destination.ExpectedHttpStatusCode = genruntime.ClonePointerToInt(rules.ExpectedHttpStatusCode)

	// IgnoreHttpsStatusCode
	if rules.IgnoreHttpsStatusCode != nil {
		ignoreHttpsStatusCode := *rules.IgnoreHttpsStatusCode
		destination.IgnoreHttpsStatusCode = &ignoreHttpsStatusCode
	} else {
		destination.IgnoreHttpsStatusCode = nil
	}

	// SSLCertRemainingLifetimeCheck
	destination.SSLCertRemainingLifetimeCheck = genruntime.ClonePointerToInt(rules.SSLCertRemainingLifetimeCheck)

	// SSLCheck
	if rules.SSLCheck != nil {
		sslCheck := *rules.SSLCheck
		destination.SSLCheck = &sslCheck
	} else {
		destination.SSLCheck = nil
	}

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

	// No error
	return nil
}

type WebTestProperties_ValidationRules_STATUS struct {
	// ContentValidation: The collection of content validation properties
	ContentValidation *WebTestProperties_ValidationRules_ContentValidation_STATUS `json:"ContentValidation,omitempty"`

	// ExpectedHttpStatusCode: Validate that the WebTest returns the http status code provided.
	ExpectedHttpStatusCode *int `json:"ExpectedHttpStatusCode,omitempty"`

	// IgnoreHttpsStatusCode: When set, validation will ignore the status code.
	IgnoreHttpsStatusCode *bool `json:"IgnoreHttpsStatusCode,omitempty"`

	// SSLCertRemainingLifetimeCheck: A number of days to check still remain before the the existing SSL cert expires.  Value
	// must be positive and the SSLCheck must be set to true.
	SSLCertRemainingLifetimeCheck *int `json:"SSLCertRemainingLifetimeCheck,omitempty"`

	// SSLCheck: Checks to see if the SSL cert is still valid.
	SSLCheck *bool `json:"SSLCheck,omitempty"`
}

var _ genruntime.FromARMConverter = &WebTestProperties_ValidationRules_STATUS{}

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

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

	// Set property "ContentValidation":
	if typedInput.ContentValidation != nil {
		var contentValidation1 WebTestProperties_ValidationRules_ContentValidation_STATUS
		err := contentValidation1.PopulateFromARM(owner, *typedInput.ContentValidation)
		if err != nil {
			return err
		}
		contentValidation := contentValidation1
		rules.ContentValidation = &contentValidation
	}

	// Set property "ExpectedHttpStatusCode":
	if typedInput.ExpectedHttpStatusCode != nil {
		expectedHttpStatusCode := *typedInput.ExpectedHttpStatusCode
		rules.ExpectedHttpStatusCode = &expectedHttpStatusCode
	}

	// Set property "IgnoreHttpsStatusCode":
	if typedInput.IgnoreHttpsStatusCode != nil {
		ignoreHttpsStatusCode := *typedInput.IgnoreHttpsStatusCode
		rules.IgnoreHttpsStatusCode = &ignoreHttpsStatusCode
	}

	// Set property "SSLCertRemainingLifetimeCheck":
	if typedInput.SSLCertRemainingLifetimeCheck != nil {
		sslCertRemainingLifetimeCheck := *typedInput.SSLCertRemainingLifetimeCheck
		rules.SSLCertRemainingLifetimeCheck = &sslCertRemainingLifetimeCheck
	}

	// Set property "SSLCheck":
	if typedInput.SSLCheck != nil {
		sslCheck := *typedInput.SSLCheck
		rules.SSLCheck = &sslCheck
	}

	// No error
	return nil
}

// AssignProperties_From_WebTestProperties_ValidationRules_STATUS populates our WebTestProperties_ValidationRules_STATUS from the provided source WebTestProperties_ValidationRules_STATUS
func (rules *WebTestProperties_ValidationRules_STATUS) AssignProperties_From_WebTestProperties_ValidationRules_STATUS(source *storage.WebTestProperties_ValidationRules_STATUS) error {

	// ContentValidation
	if source.ContentValidation != nil {
		var contentValidation WebTestProperties_ValidationRules_ContentValidation_STATUS
		err := contentValidation.AssignProperties_From_WebTestProperties_ValidationRules_ContentValidation_STATUS(source.ContentValidation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_From_WebTestProperties_ValidationRules_ContentValidation_STATUS() to populate field ContentValidation")
		}
		rules.ContentValidation = &contentValidation
	} else {
		rules.ContentValidation = nil
	}

	// ExpectedHttpStatusCode
	rules.ExpectedHttpStatusCode = genruntime.ClonePointerToInt(source.ExpectedHttpStatusCode)

	// IgnoreHttpsStatusCode
	if source.IgnoreHttpsStatusCode != nil {
		ignoreHttpsStatusCode := *source.IgnoreHttpsStatusCode
		rules.IgnoreHttpsStatusCode = &ignoreHttpsStatusCode
	} else {
		rules.IgnoreHttpsStatusCode = nil
	}

	// SSLCertRemainingLifetimeCheck
	rules.SSLCertRemainingLifetimeCheck = genruntime.ClonePointerToInt(source.SSLCertRemainingLifetimeCheck)

	// SSLCheck
	if source.SSLCheck != nil {
		sslCheck := *source.SSLCheck
		rules.SSLCheck = &sslCheck
	} else {
		rules.SSLCheck = nil
	}

	// No error
	return nil
}

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

	// ContentValidation
	if rules.ContentValidation != nil {
		var contentValidation storage.WebTestProperties_ValidationRules_ContentValidation_STATUS
		err := rules.ContentValidation.AssignProperties_To_WebTestProperties_ValidationRules_ContentValidation_STATUS(&contentValidation)
		if err != nil {
			return eris.Wrap(err, "calling AssignProperties_To_WebTestProperties_ValidationRules_ContentValidation_STATUS() to populate field ContentValidation")
		}
		destination.ContentValidation = &contentValidation
	} else {
		destination.ContentValidation = nil
	}

	// ExpectedHttpStatusCode
	destination.ExpectedHttpStatusCode = genruntime.ClonePointerToInt(rules.ExpectedHttpStatusCode)

	// IgnoreHttpsStatusCode
	if rules.IgnoreHttpsStatusCode != nil {
		ignoreHttpsStatusCode := *rules.IgnoreHttpsStatusCode
		destination.IgnoreHttpsStatusCode = &ignoreHttpsStatusCode
	} else {
		destination.IgnoreHttpsStatusCode = nil
	}

	// SSLCertRemainingLifetimeCheck
	destination.SSLCertRemainingLifetimeCheck = genruntime.ClonePointerToInt(rules.SSLCertRemainingLifetimeCheck)

	// SSLCheck
	if rules.SSLCheck != nil {
		sslCheck := *rules.SSLCheck
		destination.SSLCheck = &sslCheck
	} else {
		destination.SSLCheck = nil
	}

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

	// No error
	return nil
}

// A header to add to the WebTest.
type HeaderField struct {
	// Key: The name of the header.
	Key *string `json:"key,omitempty"`

	// Value: The value of the header.
	Value *string `json:"value,omitempty"`
}

var _ genruntime.ARMTransformer = &HeaderField{}

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

	// Set property "Key":
	if field.Key != nil {
		key := *field.Key
		result.Key = &key
	}

	// Set property "Value":
	if field.Value != nil {
		value := *field.Value
		result.Value = &value
	}
	return result, nil
}

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

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

	// Set property "Key":
	if typedInput.Key != nil {
		key := *typedInput.Key
		field.Key = &key
	}

	// Set property "Value":
	if typedInput.Value != nil {
		value := *typedInput.Value
		field.Value = &value
	}

	// No error
	return nil
}

// AssignProperties_From_HeaderField populates our HeaderField from the provided source HeaderField
func (field *HeaderField) AssignProperties_From_HeaderField(source *storage.HeaderField) error {

	// Key
	field.Key = genruntime.ClonePointerToString(source.Key)

	// Value
	field.Value = genruntime.ClonePointerToString(source.Value)

	// No error
	return nil
}

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

	// Key
	destination.Key = genruntime.ClonePointerToString(field.Key)

	// Value
	destination.Value = genruntime.ClonePointerToString(field.Value)

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

	// No error
	return nil
}

// A header to add to the WebTest.
type HeaderField_STATUS struct {
	// Key: The name of the header.
	Key *string `json:"key,omitempty"`

	// Value: The value of the header.
	Value *string `json:"value,omitempty"`
}

var _ genruntime.FromARMConverter = &HeaderField_STATUS{}

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

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

	// Set property "Key":
	if typedInput.Key != nil {
		key := *typedInput.Key
		field.Key = &key
	}

	// Set property "Value":
	if typedInput.Value != nil {
		value := *typedInput.Value
		field.Value = &value
	}

	// No error
	return nil
}

// AssignProperties_From_HeaderField_STATUS populates our HeaderField_STATUS from the provided source HeaderField_STATUS
func (field *HeaderField_STATUS) AssignProperties_From_HeaderField_STATUS(source *storage.HeaderField_STATUS) error {

	// Key
	field.Key = genruntime.ClonePointerToString(source.Key)

	// Value
	field.Value = genruntime.ClonePointerToString(source.Value)

	// No error
	return nil
}

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

	// Key
	destination.Key = genruntime.ClonePointerToString(field.Key)

	// Value
	destination.Value = genruntime.ClonePointerToString(field.Value)

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

	// No error
	return nil
}

type WebTestProperties_ValidationRules_ContentValidation struct {
	// ContentMatch: Content to look for in the return of the WebTest.  Must not be null or empty.
	ContentMatch *string `json:"ContentMatch,omitempty"`

	// IgnoreCase: When set, this value makes the ContentMatch validation case insensitive.
	IgnoreCase *bool `json:"IgnoreCase,omitempty"`

	// PassIfTextFound: When true, validation will pass if there is a match for the ContentMatch string.  If false, validation
	// will fail if there is a match
	PassIfTextFound *bool `json:"PassIfTextFound,omitempty"`
}

var _ genruntime.ARMTransformer = &WebTestProperties_ValidationRules_ContentValidation{}

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

	// Set property "ContentMatch":
	if validation.ContentMatch != nil {
		contentMatch := *validation.ContentMatch
		result.ContentMatch = &contentMatch
	}

	// Set property "IgnoreCase":
	if validation.IgnoreCase != nil {
		ignoreCase := *validation.IgnoreCase
		result.IgnoreCase = &ignoreCase
	}

	// Set property "PassIfTextFound":
	if validation.PassIfTextFound != nil {
		passIfTextFound := *validation.PassIfTextFound
		result.PassIfTextFound = &passIfTextFound
	}
	return result, nil
}

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

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

	// Set property "ContentMatch":
	if typedInput.ContentMatch != nil {
		contentMatch := *typedInput.ContentMatch
		validation.ContentMatch = &contentMatch
	}

	// Set property "IgnoreCase":
	if typedInput.IgnoreCase != nil {
		ignoreCase := *typedInput.IgnoreCase
		validation.IgnoreCase = &ignoreCase
	}

	// Set property "PassIfTextFound":
	if typedInput.PassIfTextFound != nil {
		passIfTextFound := *typedInput.PassIfTextFound
		validation.PassIfTextFound = &passIfTextFound
	}

	// No error
	return nil
}

// AssignProperties_From_WebTestProperties_ValidationRules_ContentValidation populates our WebTestProperties_ValidationRules_ContentValidation from the provided source WebTestProperties_ValidationRules_ContentValidation
func (validation *WebTestProperties_ValidationRules_ContentValidation) AssignProperties_From_WebTestProperties_ValidationRules_ContentValidation(source *storage.WebTestProperties_ValidationRules_ContentValidation) error {

	// ContentMatch
	validation.ContentMatch = genruntime.ClonePointerToString(source.ContentMatch)

	// IgnoreCase
	if source.IgnoreCase != nil {
		ignoreCase := *source.IgnoreCase
		validation.IgnoreCase = &ignoreCase
	} else {
		validation.IgnoreCase = nil
	}

	// PassIfTextFound
	if source.PassIfTextFound != nil {
		passIfTextFound := *source.PassIfTextFound
		validation.PassIfTextFound = &passIfTextFound
	} else {
		validation.PassIfTextFound = nil
	}

	// No error
	return nil
}

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

	// ContentMatch
	destination.ContentMatch = genruntime.ClonePointerToString(validation.ContentMatch)

	// IgnoreCase
	if validation.IgnoreCase != nil {
		ignoreCase := *validation.IgnoreCase
		destination.IgnoreCase = &ignoreCase
	} else {
		destination.IgnoreCase = nil
	}

	// PassIfTextFound
	if validation.PassIfTextFound != nil {
		passIfTextFound := *validation.PassIfTextFound
		destination.PassIfTextFound = &passIfTextFound
	} else {
		destination.PassIfTextFound = nil
	}

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

	// No error
	return nil
}

type WebTestProperties_ValidationRules_ContentValidation_STATUS struct {
	// ContentMatch: Content to look for in the return of the WebTest.  Must not be null or empty.
	ContentMatch *string `json:"ContentMatch,omitempty"`

	// IgnoreCase: When set, this value makes the ContentMatch validation case insensitive.
	IgnoreCase *bool `json:"IgnoreCase,omitempty"`

	// PassIfTextFound: When true, validation will pass if there is a match for the ContentMatch string.  If false, validation
	// will fail if there is a match
	PassIfTextFound *bool `json:"PassIfTextFound,omitempty"`
}

var _ genruntime.FromARMConverter = &WebTestProperties_ValidationRules_ContentValidation_STATUS{}

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

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

	// Set property "ContentMatch":
	if typedInput.ContentMatch != nil {
		contentMatch := *typedInput.ContentMatch
		validation.ContentMatch = &contentMatch
	}

	// Set property "IgnoreCase":
	if typedInput.IgnoreCase != nil {
		ignoreCase := *typedInput.IgnoreCase
		validation.IgnoreCase = &ignoreCase
	}

	// Set property "PassIfTextFound":
	if typedInput.PassIfTextFound != nil {
		passIfTextFound := *typedInput.PassIfTextFound
		validation.PassIfTextFound = &passIfTextFound
	}

	// No error
	return nil
}

// AssignProperties_From_WebTestProperties_ValidationRules_ContentValidation_STATUS populates our WebTestProperties_ValidationRules_ContentValidation_STATUS from the provided source WebTestProperties_ValidationRules_ContentValidation_STATUS
func (validation *WebTestProperties_ValidationRules_ContentValidation_STATUS) AssignProperties_From_WebTestProperties_ValidationRules_ContentValidation_STATUS(source *storage.WebTestProperties_ValidationRules_ContentValidation_STATUS) error {

	// ContentMatch
	validation.ContentMatch = genruntime.ClonePointerToString(source.ContentMatch)

	// IgnoreCase
	if source.IgnoreCase != nil {
		ignoreCase := *source.IgnoreCase
		validation.IgnoreCase = &ignoreCase
	} else {
		validation.IgnoreCase = nil
	}

	// PassIfTextFound
	if source.PassIfTextFound != nil {
		passIfTextFound := *source.PassIfTextFound
		validation.PassIfTextFound = &passIfTextFound
	} else {
		validation.PassIfTextFound = nil
	}

	// No error
	return nil
}

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

	// ContentMatch
	destination.ContentMatch = genruntime.ClonePointerToString(validation.ContentMatch)

	// IgnoreCase
	if validation.IgnoreCase != nil {
		ignoreCase := *validation.IgnoreCase
		destination.IgnoreCase = &ignoreCase
	} else {
		destination.IgnoreCase = nil
	}

	// PassIfTextFound
	if validation.PassIfTextFound != nil {
		passIfTextFound := *validation.PassIfTextFound
		destination.PassIfTextFound = &passIfTextFound
	} else {
		destination.PassIfTextFound = nil
	}

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

	// No error
	return nil
}

func init() {
	SchemeBuilder.Register(&Webtest{}, &WebtestList{})
}
