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

import (
	"encoding/json"
	"github.com/Azure/azure-service-operator/v2/pkg/genruntime"
)

type Server_Spec struct {
	// Location: The location the resource resides in.
	Location *string `json:"location,omitempty"`
	Name     string  `json:"name,omitempty"`

	// Properties: Properties of the server.
	Properties *ServerPropertiesForCreate `json:"properties,omitempty"`

	// Sku: The SKU (pricing tier) of the server.
	Sku *Sku `json:"sku,omitempty"`

	// Tags: Application-specific metadata in the form of key-value pairs.
	Tags map[string]string `json:"tags,omitempty"`
}

var _ genruntime.ARMResourceSpec = &Server_Spec{}

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

// GetName returns the Name of the resource
func (server *Server_Spec) GetName() string {
	return server.Name
}

// GetType returns the ARM Type of the resource. This is always "Microsoft.DBforMariaDB/servers"
func (server *Server_Spec) GetType() string {
	return "Microsoft.DBforMariaDB/servers"
}

type ServerPropertiesForCreate struct {
	// Default: Mutually exclusive with all other properties
	Default *ServerPropertiesForDefaultCreate `json:"default,omitempty"`

	// GeoRestore: Mutually exclusive with all other properties
	GeoRestore *ServerPropertiesForGeoRestore `json:"geoRestore,omitempty"`

	// PointInTimeRestore: Mutually exclusive with all other properties
	PointInTimeRestore *ServerPropertiesForRestore `json:"pointInTimeRestore,omitempty"`

	// Replica: Mutually exclusive with all other properties
	Replica *ServerPropertiesForReplica `json:"replica,omitempty"`
}

// MarshalJSON defers JSON marshaling to the first non-nil property, because ServerPropertiesForCreate represents a discriminated union (JSON OneOf)
func (create ServerPropertiesForCreate) MarshalJSON() ([]byte, error) {
	if create.Default != nil {
		return json.Marshal(create.Default)
	}

	if create.GeoRestore != nil {
		return json.Marshal(create.GeoRestore)
	}

	if create.PointInTimeRestore != nil {
		return json.Marshal(create.PointInTimeRestore)
	}

	if create.Replica != nil {
		return json.Marshal(create.Replica)
	}

	return nil, nil
}

// UnmarshalJSON unmarshals the ServerPropertiesForCreate
func (create *ServerPropertiesForCreate) UnmarshalJSON(data []byte) error {
	var rawJson map[string]interface{}
	err := json.Unmarshal(data, &rawJson)
	if err != nil {
		return err
	}
	discriminator := rawJson["createMode"]
	if discriminator == "Default" {
		create.Default = &ServerPropertiesForDefaultCreate{}
		return json.Unmarshal(data, create.Default)
	}
	if discriminator == "GeoRestore" {
		create.GeoRestore = &ServerPropertiesForGeoRestore{}
		return json.Unmarshal(data, create.GeoRestore)
	}
	if discriminator == "PointInTimeRestore" {
		create.PointInTimeRestore = &ServerPropertiesForRestore{}
		return json.Unmarshal(data, create.PointInTimeRestore)
	}
	if discriminator == "Replica" {
		create.Replica = &ServerPropertiesForReplica{}
		return json.Unmarshal(data, create.Replica)
	}

	// No error
	return nil
}

// Billing information related properties of a server.
type Sku struct {
	// Capacity: The scale up/out capacity, representing server's compute units.
	Capacity *int `json:"capacity,omitempty"`

	// Family: The family of hardware.
	Family *string `json:"family,omitempty"`

	// Name: The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8.
	Name *string `json:"name,omitempty"`

	// Size: The size code, to be interpreted by resource as appropriate.
	Size *string `json:"size,omitempty"`

	// Tier: The tier of the particular SKU, e.g. Basic.
	Tier *Sku_Tier `json:"tier,omitempty"`
}

type ServerPropertiesForDefaultCreate struct {
	// AdministratorLogin: The administrator's login name of a server. Can only be specified when the server is being created
	// (and is required for creation).
	AdministratorLogin *string `json:"administratorLogin,omitempty"`

	// AdministratorLoginPassword: The password of the administrator login.
	AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"`

	// CreateMode: The mode to create a new server.
	CreateMode ServerPropertiesForDefaultCreate_CreateMode `json:"createMode,omitempty"`

	// MinimalTlsVersion: Enforce a minimal Tls version for the server.
	MinimalTlsVersion *MinimalTlsVersion `json:"minimalTlsVersion,omitempty"`

	// PublicNetworkAccess: Whether or not public network access is allowed for this server. Value is optional but if passed
	// in, must be 'Enabled' or 'Disabled'
	PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

	// SslEnforcement: Enable ssl enforcement or not when connect to server.
	SslEnforcement *SslEnforcement `json:"sslEnforcement,omitempty"`

	// StorageProfile: Storage profile of a server.
	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`

	// Version: Server version.
	Version *ServerVersion `json:"version,omitempty"`
}

type ServerPropertiesForGeoRestore struct {
	// CreateMode: The mode to create a new server.
	CreateMode ServerPropertiesForGeoRestore_CreateMode `json:"createMode,omitempty"`

	// MinimalTlsVersion: Enforce a minimal Tls version for the server.
	MinimalTlsVersion *MinimalTlsVersion `json:"minimalTlsVersion,omitempty"`

	// PublicNetworkAccess: Whether or not public network access is allowed for this server. Value is optional but if passed
	// in, must be 'Enabled' or 'Disabled'
	PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

	// SourceServerId: The source server id to restore from.
	SourceServerId *string `json:"sourceServerId,omitempty"`

	// SslEnforcement: Enable ssl enforcement or not when connect to server.
	SslEnforcement *SslEnforcement `json:"sslEnforcement,omitempty"`

	// StorageProfile: Storage profile of a server.
	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`

	// Version: Server version.
	Version *ServerVersion `json:"version,omitempty"`
}

type ServerPropertiesForReplica struct {
	// CreateMode: The mode to create a new server.
	CreateMode ServerPropertiesForReplica_CreateMode `json:"createMode,omitempty"`

	// MinimalTlsVersion: Enforce a minimal Tls version for the server.
	MinimalTlsVersion *MinimalTlsVersion `json:"minimalTlsVersion,omitempty"`

	// PublicNetworkAccess: Whether or not public network access is allowed for this server. Value is optional but if passed
	// in, must be 'Enabled' or 'Disabled'
	PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

	// SourceServerId: The master server id to create replica from.
	SourceServerId *string `json:"sourceServerId,omitempty"`

	// SslEnforcement: Enable ssl enforcement or not when connect to server.
	SslEnforcement *SslEnforcement `json:"sslEnforcement,omitempty"`

	// StorageProfile: Storage profile of a server.
	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`

	// Version: Server version.
	Version *ServerVersion `json:"version,omitempty"`
}

type ServerPropertiesForRestore struct {
	// CreateMode: The mode to create a new server.
	CreateMode ServerPropertiesForRestore_CreateMode `json:"createMode,omitempty"`

	// MinimalTlsVersion: Enforce a minimal Tls version for the server.
	MinimalTlsVersion *MinimalTlsVersion `json:"minimalTlsVersion,omitempty"`

	// PublicNetworkAccess: Whether or not public network access is allowed for this server. Value is optional but if passed
	// in, must be 'Enabled' or 'Disabled'
	PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

	// RestorePointInTime: Restore point creation time (ISO8601 format), specifying the time to restore from.
	RestorePointInTime *string `json:"restorePointInTime,omitempty"`

	// SourceServerId: The source server id to restore from.
	SourceServerId *string `json:"sourceServerId,omitempty"`

	// SslEnforcement: Enable ssl enforcement or not when connect to server.
	SslEnforcement *SslEnforcement `json:"sslEnforcement,omitempty"`

	// StorageProfile: Storage profile of a server.
	StorageProfile *StorageProfile `json:"storageProfile,omitempty"`

	// Version: Server version.
	Version *ServerVersion `json:"version,omitempty"`
}

// +kubebuilder:validation:Enum={"Basic","GeneralPurpose","MemoryOptimized"}
type Sku_Tier string

const (
	Sku_Tier_Basic           = Sku_Tier("Basic")
	Sku_Tier_GeneralPurpose  = Sku_Tier("GeneralPurpose")
	Sku_Tier_MemoryOptimized = Sku_Tier("MemoryOptimized")
)

// Mapping from string to Sku_Tier
var sku_Tier_Values = map[string]Sku_Tier{
	"basic":           Sku_Tier_Basic,
	"generalpurpose":  Sku_Tier_GeneralPurpose,
	"memoryoptimized": Sku_Tier_MemoryOptimized,
}

// Enforce a minimal Tls version for the server.
// +kubebuilder:validation:Enum={"TLS1_0","TLS1_1","TLS1_2","TLSEnforcementDisabled"}
type MinimalTlsVersion string

const (
	MinimalTlsVersion_TLS1_0                 = MinimalTlsVersion("TLS1_0")
	MinimalTlsVersion_TLS1_1                 = MinimalTlsVersion("TLS1_1")
	MinimalTlsVersion_TLS1_2                 = MinimalTlsVersion("TLS1_2")
	MinimalTlsVersion_TLSEnforcementDisabled = MinimalTlsVersion("TLSEnforcementDisabled")
)

// Mapping from string to MinimalTlsVersion
var minimalTlsVersion_Values = map[string]MinimalTlsVersion{
	"tls1_0":                 MinimalTlsVersion_TLS1_0,
	"tls1_1":                 MinimalTlsVersion_TLS1_1,
	"tls1_2":                 MinimalTlsVersion_TLS1_2,
	"tlsenforcementdisabled": MinimalTlsVersion_TLSEnforcementDisabled,
}

// Whether or not public network access is allowed for this server. Value is optional but if passed in, must be 'Enabled'
// or 'Disabled'
// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type PublicNetworkAccess string

const (
	PublicNetworkAccess_Disabled = PublicNetworkAccess("Disabled")
	PublicNetworkAccess_Enabled  = PublicNetworkAccess("Enabled")
)

// Mapping from string to PublicNetworkAccess
var publicNetworkAccess_Values = map[string]PublicNetworkAccess{
	"disabled": PublicNetworkAccess_Disabled,
	"enabled":  PublicNetworkAccess_Enabled,
}

// +kubebuilder:validation:Enum={"Default"}
type ServerPropertiesForDefaultCreate_CreateMode string

const ServerPropertiesForDefaultCreate_CreateMode_Default = ServerPropertiesForDefaultCreate_CreateMode("Default")

// Mapping from string to ServerPropertiesForDefaultCreate_CreateMode
var serverPropertiesForDefaultCreate_CreateMode_Values = map[string]ServerPropertiesForDefaultCreate_CreateMode{
	"default": ServerPropertiesForDefaultCreate_CreateMode_Default,
}

// +kubebuilder:validation:Enum={"GeoRestore"}
type ServerPropertiesForGeoRestore_CreateMode string

const ServerPropertiesForGeoRestore_CreateMode_GeoRestore = ServerPropertiesForGeoRestore_CreateMode("GeoRestore")

// Mapping from string to ServerPropertiesForGeoRestore_CreateMode
var serverPropertiesForGeoRestore_CreateMode_Values = map[string]ServerPropertiesForGeoRestore_CreateMode{
	"georestore": ServerPropertiesForGeoRestore_CreateMode_GeoRestore,
}

// +kubebuilder:validation:Enum={"Replica"}
type ServerPropertiesForReplica_CreateMode string

const ServerPropertiesForReplica_CreateMode_Replica = ServerPropertiesForReplica_CreateMode("Replica")

// Mapping from string to ServerPropertiesForReplica_CreateMode
var serverPropertiesForReplica_CreateMode_Values = map[string]ServerPropertiesForReplica_CreateMode{
	"replica": ServerPropertiesForReplica_CreateMode_Replica,
}

// +kubebuilder:validation:Enum={"PointInTimeRestore"}
type ServerPropertiesForRestore_CreateMode string

const ServerPropertiesForRestore_CreateMode_PointInTimeRestore = ServerPropertiesForRestore_CreateMode("PointInTimeRestore")

// Mapping from string to ServerPropertiesForRestore_CreateMode
var serverPropertiesForRestore_CreateMode_Values = map[string]ServerPropertiesForRestore_CreateMode{
	"pointintimerestore": ServerPropertiesForRestore_CreateMode_PointInTimeRestore,
}

// The version of a server.
// +kubebuilder:validation:Enum={"10.2","10.3"}
type ServerVersion string

const (
	ServerVersion_102 = ServerVersion("10.2")
	ServerVersion_103 = ServerVersion("10.3")
)

// Mapping from string to ServerVersion
var serverVersion_Values = map[string]ServerVersion{
	"10.2": ServerVersion_102,
	"10.3": ServerVersion_103,
}

// Enable ssl enforcement or not when connect to server.
// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type SslEnforcement string

const (
	SslEnforcement_Disabled = SslEnforcement("Disabled")
	SslEnforcement_Enabled  = SslEnforcement("Enabled")
)

// Mapping from string to SslEnforcement
var sslEnforcement_Values = map[string]SslEnforcement{
	"disabled": SslEnforcement_Disabled,
	"enabled":  SslEnforcement_Enabled,
}

// Storage Profile properties of a server
type StorageProfile struct {
	// BackupRetentionDays: Backup retention days for the server.
	BackupRetentionDays *int `json:"backupRetentionDays,omitempty"`

	// GeoRedundantBackup: Enable Geo-redundant or not for server backup.
	GeoRedundantBackup *StorageProfile_GeoRedundantBackup `json:"geoRedundantBackup,omitempty"`

	// StorageAutogrow: Enable Storage Auto Grow.
	StorageAutogrow *StorageProfile_StorageAutogrow `json:"storageAutogrow,omitempty"`

	// StorageMB: Max storage allowed for a server.
	StorageMB *int `json:"storageMB,omitempty"`
}

// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type StorageProfile_GeoRedundantBackup string

const (
	StorageProfile_GeoRedundantBackup_Disabled = StorageProfile_GeoRedundantBackup("Disabled")
	StorageProfile_GeoRedundantBackup_Enabled  = StorageProfile_GeoRedundantBackup("Enabled")
)

// Mapping from string to StorageProfile_GeoRedundantBackup
var storageProfile_GeoRedundantBackup_Values = map[string]StorageProfile_GeoRedundantBackup{
	"disabled": StorageProfile_GeoRedundantBackup_Disabled,
	"enabled":  StorageProfile_GeoRedundantBackup_Enabled,
}

// +kubebuilder:validation:Enum={"Disabled","Enabled"}
type StorageProfile_StorageAutogrow string

const (
	StorageProfile_StorageAutogrow_Disabled = StorageProfile_StorageAutogrow("Disabled")
	StorageProfile_StorageAutogrow_Enabled  = StorageProfile_StorageAutogrow("Enabled")
)

// Mapping from string to StorageProfile_StorageAutogrow
var storageProfile_StorageAutogrow_Values = map[string]StorageProfile_StorageAutogrow{
	"disabled": StorageProfile_StorageAutogrow_Disabled,
	"enabled":  StorageProfile_StorageAutogrow_Enabled,
}
