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

import (
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime/conditions"
	"github.com/pkg/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
)

// +kubebuilder:rbac:groups=subscription.azure.com,resources=aliases,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=subscription.azure.com,resources={aliases/status,aliases/finalizers},verbs=get;update;patch

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +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"
// Storage version of v1api20211001.Alias
// Generator information:
// - Generated from: /subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/subscriptions.json
// - ARM URI: /providers/Microsoft.Subscription/aliases/{aliasName}
type Alias struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              Alias_Spec   `json:"spec,omitempty"`
	Status            Alias_STATUS `json:"status,omitempty"`
}

var _ conditions.Conditioner = &Alias{}

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

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

var _ genruntime.KubernetesResource = &Alias{}

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

// GetAPIVersion returns the ARM API version of the resource. This is always "2021-10-01"
func (alias Alias) GetAPIVersion() string {
	return string(APIVersion_Value)
}

// GetResourceScope returns the scope of the resource
func (alias *Alias) GetResourceScope() genruntime.ResourceScope {
	return genruntime.ResourceScopeTenant
}

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

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.Subscription/aliases"
func (alias *Alias) GetType() string {
	return "Microsoft.Subscription/aliases"
}

// NewEmptyStatus returns a new empty (blank) status
func (alias *Alias) NewEmptyStatus() genruntime.ConvertibleStatus {
	return &Alias_STATUS{}
}

// Owner returns nil as Tenant scoped resources never have an owner
func (alias *Alias) Owner() *genruntime.ResourceReference {
	return nil
}

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

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

	alias.Status = st
	return nil
}

// Hub marks that this Alias is the hub type for conversion
func (alias *Alias) Hub() {}

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

// +kubebuilder:object:root=true
// Storage version of v1api20211001.Alias
// Generator information:
// - Generated from: /subscription/resource-manager/Microsoft.Subscription/stable/2021-10-01/subscriptions.json
// - ARM URI: /providers/Microsoft.Subscription/aliases/{aliasName}
type AliasList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Alias `json:"items"`
}

// Storage version of v1api20211001.Alias_Spec
type Alias_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"`
	OriginalVersion string                     `json:"originalVersion,omitempty"`
	Properties      *PutAliasRequestProperties `json:"properties,omitempty"`
	PropertyBag     genruntime.PropertyBag     `json:"$propertyBag,omitempty"`
}

var _ genruntime.ConvertibleSpec = &Alias_Spec{}

// ConvertSpecFrom populates our Alias_Spec from the provided source
func (alias *Alias_Spec) ConvertSpecFrom(source genruntime.ConvertibleSpec) error {
	if source == alias {
		return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec")
	}

	return source.ConvertSpecTo(alias)
}

// ConvertSpecTo populates the provided destination from our Alias_Spec
func (alias *Alias_Spec) ConvertSpecTo(destination genruntime.ConvertibleSpec) error {
	if destination == alias {
		return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleSpec")
	}

	return destination.ConvertSpecFrom(alias)
}

// Storage version of v1api20211001.Alias_STATUS
type Alias_STATUS struct {
	Conditions  []conditions.Condition                      `json:"conditions,omitempty"`
	Id          *string                                     `json:"id,omitempty"`
	Name        *string                                     `json:"name,omitempty"`
	Properties  *SubscriptionAliasResponseProperties_STATUS `json:"properties,omitempty"`
	PropertyBag genruntime.PropertyBag                      `json:"$propertyBag,omitempty"`
	SystemData  *SystemData_STATUS                          `json:"systemData,omitempty"`
	Type        *string                                     `json:"type,omitempty"`
}

var _ genruntime.ConvertibleStatus = &Alias_STATUS{}

// ConvertStatusFrom populates our Alias_STATUS from the provided source
func (alias *Alias_STATUS) ConvertStatusFrom(source genruntime.ConvertibleStatus) error {
	if source == alias {
		return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus")
	}

	return source.ConvertStatusTo(alias)
}

// ConvertStatusTo populates the provided destination from our Alias_STATUS
func (alias *Alias_STATUS) ConvertStatusTo(destination genruntime.ConvertibleStatus) error {
	if destination == alias {
		return errors.New("attempted conversion between unrelated implementations of github.com/Azure/azure-service-operator/v2/pkg/genruntime/ConvertibleStatus")
	}

	return destination.ConvertStatusFrom(alias)
}

// Storage version of v1api20211001.APIVersion
// +kubebuilder:validation:Enum={"2021-10-01"}
type APIVersion string

const APIVersion_Value = APIVersion("2021-10-01")

// Storage version of v1api20211001.PutAliasRequestProperties
// Put subscription properties.
type PutAliasRequestProperties struct {
	AdditionalProperties *PutAliasRequestAdditionalProperties `json:"additionalProperties,omitempty"`
	BillingScope         *string                              `json:"billingScope,omitempty"`
	DisplayName          *string                              `json:"displayName,omitempty"`
	PropertyBag          genruntime.PropertyBag               `json:"$propertyBag,omitempty"`
	ResellerId           *string                              `json:"resellerId,omitempty"`
	SubscriptionId       *string                              `json:"subscriptionId,omitempty"`
	Workload             *string                              `json:"workload,omitempty"`
}

// Storage version of v1api20211001.SubscriptionAliasResponseProperties_STATUS
// Put subscription creation result properties.
type SubscriptionAliasResponseProperties_STATUS struct {
	AcceptOwnershipState *string                `json:"acceptOwnershipState,omitempty"`
	AcceptOwnershipUrl   *string                `json:"acceptOwnershipUrl,omitempty"`
	BillingScope         *string                `json:"billingScope,omitempty"`
	CreatedTime          *string                `json:"createdTime,omitempty"`
	DisplayName          *string                `json:"displayName,omitempty"`
	ManagementGroupId    *string                `json:"managementGroupId,omitempty"`
	PropertyBag          genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	ProvisioningState    *string                `json:"provisioningState,omitempty"`
	ResellerId           *string                `json:"resellerId,omitempty"`
	SubscriptionId       *string                `json:"subscriptionId,omitempty"`
	SubscriptionOwnerId  *string                `json:"subscriptionOwnerId,omitempty"`
	Tags                 map[string]string      `json:"tags,omitempty"`
	Workload             *string                `json:"workload,omitempty"`
}

// Storage version of v1api20211001.SystemData_STATUS
// Metadata pertaining to creation and last modification of the resource.
type SystemData_STATUS struct {
	CreatedAt          *string                `json:"createdAt,omitempty"`
	CreatedBy          *string                `json:"createdBy,omitempty"`
	CreatedByType      *string                `json:"createdByType,omitempty"`
	LastModifiedAt     *string                `json:"lastModifiedAt,omitempty"`
	LastModifiedBy     *string                `json:"lastModifiedBy,omitempty"`
	LastModifiedByType *string                `json:"lastModifiedByType,omitempty"`
	PropertyBag        genruntime.PropertyBag `json:"$propertyBag,omitempty"`
}

// Storage version of v1api20211001.PutAliasRequestAdditionalProperties
// Put subscription additional properties.
type PutAliasRequestAdditionalProperties struct {
	ManagementGroupId    *string                `json:"managementGroupId,omitempty"`
	PropertyBag          genruntime.PropertyBag `json:"$propertyBag,omitempty"`
	SubscriptionOwnerId  *string                `json:"subscriptionOwnerId,omitempty"`
	SubscriptionTenantId *string                `json:"subscriptionTenantId,omitempty"`
	Tags                 map[string]string      `json:"tags,omitempty"`
}

func init() {
	SchemeBuilder.Register(&Alias{}, &AliasList{})
}
