// 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 Workspace_Spec struct {
	// Identity: The identity of the resource.
	Identity *ManagedServiceIdentity `json:"identity,omitempty"`
	Kind     *string                 `json:"kind,omitempty"`

	// Location: Specifies the location of the resource.
	Location *string `json:"location,omitempty"`
	Name     string  `json:"name,omitempty"`

	// Properties: The properties of the machine learning workspace.
	Properties *WorkspaceProperties `json:"properties,omitempty"`

	// Sku: The sku of the workspace.
	Sku *Sku `json:"sku,omitempty"`

	// Tags: Contains resource tags defined as key/value pairs.
	Tags map[string]string `json:"tags,omitempty"`
}

var _ genruntime.ARMResourceSpec = &Workspace_Spec{}

// GetAPIVersion returns the ARM API version of the resource. This is always "2024-04-01"
func (workspace Workspace_Spec) GetAPIVersion() string {
	return "2024-04-01"
}

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

// GetType returns the ARM Type of the resource. This is always "Microsoft.MachineLearningServices/workspaces"
func (workspace *Workspace_Spec) GetType() string {
	return "Microsoft.MachineLearningServices/workspaces"
}

// The properties of a machine learning workspace.
type WorkspaceProperties struct {
	// AllowPublicAccessWhenBehindVnet: The flag to indicate whether to allow public access when behind VNet.
	AllowPublicAccessWhenBehindVnet *bool `json:"allowPublicAccessWhenBehindVnet,omitempty"`

	// ApplicationInsights: ARM id of the application insights associated with this workspace.
	ApplicationInsights  *string  `json:"applicationInsights,omitempty"`
	AssociatedWorkspaces []string `json:"associatedWorkspaces,omitempty"`

	// ContainerRegistry: ARM id of the container registry associated with this workspace.
	ContainerRegistry *string `json:"containerRegistry,omitempty"`

	// Description: The description of this workspace.
	Description *string `json:"description,omitempty"`

	// DiscoveryUrl: Url for the discovery service to identify regional endpoints for machine learning experimentation services
	DiscoveryUrl        *string `json:"discoveryUrl,omitempty"`
	EnableDataIsolation *bool   `json:"enableDataIsolation,omitempty"`

	// Encryption: The encryption settings of Azure ML workspace.
	Encryption *EncryptionProperty `json:"encryption,omitempty"`

	// FeatureStoreSettings: Settings for feature store type workspace.
	FeatureStoreSettings *FeatureStoreSettings `json:"featureStoreSettings,omitempty"`

	// FriendlyName: The friendly name for this workspace. This name in mutable
	FriendlyName *string `json:"friendlyName,omitempty"`

	// HbiWorkspace: The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service
	HbiWorkspace  *bool   `json:"hbiWorkspace,omitempty"`
	HubResourceId *string `json:"hubResourceId,omitempty"`

	// ImageBuildCompute: The compute name for image build
	ImageBuildCompute *string `json:"imageBuildCompute,omitempty"`

	// KeyVault: ARM id of the key vault associated with this workspace. This cannot be changed once the workspace has been
	// created
	KeyVault *string `json:"keyVault,omitempty"`

	// ManagedNetwork: Managed Network settings for a machine learning workspace.
	ManagedNetwork *ManagedNetworkSettings `json:"managedNetwork,omitempty"`

	// PrimaryUserAssignedIdentity: The user assigned identity resource id that represents the workspace identity.
	PrimaryUserAssignedIdentity *string `json:"primaryUserAssignedIdentity,omitempty"`

	// PublicNetworkAccess: Whether requests from Public Network are allowed.
	PublicNetworkAccess *WorkspaceProperties_PublicNetworkAccess `json:"publicNetworkAccess,omitempty"`

	// ServerlessComputeSettings: Settings for serverless compute created in the workspace
	ServerlessComputeSettings *ServerlessComputeSettings `json:"serverlessComputeSettings,omitempty"`

	// ServiceManagedResourcesSettings: The service managed resource settings.
	ServiceManagedResourcesSettings *ServiceManagedResourcesSettings `json:"serviceManagedResourcesSettings,omitempty"`

	// SharedPrivateLinkResources: The list of shared private link resources in this workspace.
	SharedPrivateLinkResources []SharedPrivateLinkResource `json:"sharedPrivateLinkResources,omitempty"`

	// StorageAccount: ARM id of the storage account associated with this workspace. This cannot be changed once the workspace
	// has been created
	StorageAccount *string `json:"storageAccount,omitempty"`

	// V1LegacyMode: Enabling v1_legacy_mode may prevent you from using features provided by the v2 API.
	V1LegacyMode *bool `json:"v1LegacyMode,omitempty"`

	// WorkspaceHubConfig: WorkspaceHub's configuration object.
	WorkspaceHubConfig *WorkspaceHubConfig `json:"workspaceHubConfig,omitempty"`
}

type EncryptionProperty struct {
	// Identity: The identity that will be used to access the key vault for encryption at rest.
	Identity *IdentityForCmk `json:"identity,omitempty"`

	// KeyVaultProperties: Customer Key vault properties.
	KeyVaultProperties *EncryptionKeyVaultProperties `json:"keyVaultProperties,omitempty"`
}

// Settings for feature store type workspace.
type FeatureStoreSettings struct {
	// ComputeRuntime: Compute runtime config for feature store type workspace.
	ComputeRuntime             *ComputeRuntimeDto `json:"computeRuntime,omitempty"`
	OfflineStoreConnectionName *string            `json:"offlineStoreConnectionName,omitempty"`
	OnlineStoreConnectionName  *string            `json:"onlineStoreConnectionName,omitempty"`
}

// Managed Network settings for a machine learning workspace.
type ManagedNetworkSettings struct {
	// IsolationMode: Isolation mode for the managed network of a machine learning workspace.
	IsolationMode *IsolationMode          `json:"isolationMode,omitempty"`
	OutboundRules map[string]OutboundRule `json:"outboundRules,omitempty"`

	// Status: Status of the Provisioning for the managed network of a machine learning workspace.
	Status *ManagedNetworkProvisionStatus `json:"status,omitempty"`
}

type ServerlessComputeSettings struct {
	// ServerlessComputeCustomSubnet: The resource ID of an existing virtual network subnet in which serverless compute nodes
	// should be deployed
	ServerlessComputeCustomSubnet *string `json:"serverlessComputeCustomSubnet,omitempty"`

	// ServerlessComputeNoPublicIP: The flag to signal if serverless compute nodes deployed in custom vNet would have no public
	// IP addresses for a workspace with private endpoint
	ServerlessComputeNoPublicIP *bool `json:"serverlessComputeNoPublicIP,omitempty"`
}

type ServiceManagedResourcesSettings struct {
	// CosmosDb: The settings for the service managed cosmosdb account.
	CosmosDb *CosmosDbSettings `json:"cosmosDb,omitempty"`
}

type SharedPrivateLinkResource struct {
	// Name: Unique name of the private link.
	Name *string `json:"name,omitempty"`

	// Properties: Resource properties.
	Properties *SharedPrivateLinkResourceProperty `json:"properties,omitempty"`
}

// WorkspaceHub's configuration object.
type WorkspaceHubConfig struct {
	AdditionalWorkspaceStorageAccounts []string `json:"additionalWorkspaceStorageAccounts,omitempty"`
	DefaultWorkspaceResourceGroup      *string  `json:"defaultWorkspaceResourceGroup,omitempty"`
}

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

const (
	WorkspaceProperties_PublicNetworkAccess_Disabled = WorkspaceProperties_PublicNetworkAccess("Disabled")
	WorkspaceProperties_PublicNetworkAccess_Enabled  = WorkspaceProperties_PublicNetworkAccess("Enabled")
)

// Mapping from string to WorkspaceProperties_PublicNetworkAccess
var workspaceProperties_PublicNetworkAccess_Values = map[string]WorkspaceProperties_PublicNetworkAccess{
	"disabled": WorkspaceProperties_PublicNetworkAccess_Disabled,
	"enabled":  WorkspaceProperties_PublicNetworkAccess_Enabled,
}

// Compute runtime config for feature store type workspace.
type ComputeRuntimeDto struct {
	SparkRuntimeVersion *string `json:"sparkRuntimeVersion,omitempty"`
}

type CosmosDbSettings struct {
	// CollectionsThroughput: The throughput of the collections in cosmosdb database
	CollectionsThroughput *int `json:"collectionsThroughput,omitempty"`
}

type EncryptionKeyVaultProperties struct {
	// IdentityClientId: For future use - The client id of the identity which will be used to access key vault.
	IdentityClientId *string `json:"identityClientId,omitempty" optionalConfigMapPair:"IdentityClientId"`

	// KeyIdentifier: Key vault uri to access the encryption key.
	KeyIdentifier *string `json:"keyIdentifier,omitempty"`

	// KeyVaultArmId: The ArmId of the keyVault where the customer owned encryption key is present.
	KeyVaultArmId *string `json:"keyVaultArmId,omitempty"`
}

// Identity that will be used to access key vault for encryption at rest
type IdentityForCmk struct {
	// UserAssignedIdentity: The ArmId of the user assigned identity that will be used to access the customer managed key vault
	UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"`
}

// Isolation mode for the managed network of a machine learning workspace.
// +kubebuilder:validation:Enum={"AllowInternetOutbound","AllowOnlyApprovedOutbound","Disabled"}
type IsolationMode string

const (
	IsolationMode_AllowInternetOutbound     = IsolationMode("AllowInternetOutbound")
	IsolationMode_AllowOnlyApprovedOutbound = IsolationMode("AllowOnlyApprovedOutbound")
	IsolationMode_Disabled                  = IsolationMode("Disabled")
)

// Mapping from string to IsolationMode
var isolationMode_Values = map[string]IsolationMode{
	"allowinternetoutbound":     IsolationMode_AllowInternetOutbound,
	"allowonlyapprovedoutbound": IsolationMode_AllowOnlyApprovedOutbound,
	"disabled":                  IsolationMode_Disabled,
}

// Status of the Provisioning for the managed network of a machine learning workspace.
type ManagedNetworkProvisionStatus struct {
	SparkReady *bool `json:"sparkReady,omitempty"`

	// Status: Status for the managed network of a machine learning workspace.
	Status *ManagedNetworkStatus `json:"status,omitempty"`
}

type OutboundRule struct {
	// FQDN: Mutually exclusive with all other properties
	FQDN *FqdnOutboundRule `json:"fqdn,omitempty"`

	// PrivateEndpoint: Mutually exclusive with all other properties
	PrivateEndpoint *PrivateEndpointOutboundRule `json:"privateEndpoint,omitempty"`

	// ServiceTag: Mutually exclusive with all other properties
	ServiceTag *ServiceTagOutboundRule `json:"serviceTag,omitempty"`
}

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

	if rule.PrivateEndpoint != nil {
		return json.Marshal(rule.PrivateEndpoint)
	}

	if rule.ServiceTag != nil {
		return json.Marshal(rule.ServiceTag)
	}

	return nil, nil
}

// UnmarshalJSON unmarshals the OutboundRule
func (rule *OutboundRule) UnmarshalJSON(data []byte) error {
	var rawJson map[string]interface{}
	err := json.Unmarshal(data, &rawJson)
	if err != nil {
		return err
	}
	discriminator := rawJson["type"]
	if discriminator == "FQDN" {
		rule.FQDN = &FqdnOutboundRule{}
		return json.Unmarshal(data, rule.FQDN)
	}
	if discriminator == "PrivateEndpoint" {
		rule.PrivateEndpoint = &PrivateEndpointOutboundRule{}
		return json.Unmarshal(data, rule.PrivateEndpoint)
	}
	if discriminator == "ServiceTag" {
		rule.ServiceTag = &ServiceTagOutboundRule{}
		return json.Unmarshal(data, rule.ServiceTag)
	}

	// No error
	return nil
}

// Properties of a shared private link resource.
type SharedPrivateLinkResourceProperty struct {
	// GroupId: The private link resource group id.
	GroupId *string `json:"groupId,omitempty"`

	// PrivateLinkResourceId: The resource id that private link links to.
	PrivateLinkResourceId *string `json:"privateLinkResourceId,omitempty"`

	// RequestMessage: Request message.
	RequestMessage *string `json:"requestMessage,omitempty"`

	// Status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service.
	Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"`
}

type FqdnOutboundRule struct {
	// Category: Category of a managed network Outbound Rule of a machine learning workspace.
	Category    *RuleCategory `json:"category,omitempty"`
	Destination *string       `json:"destination,omitempty"`

	// Status: Type of a managed network Outbound Rule of a machine learning workspace.
	Status *RuleStatus           `json:"status,omitempty"`
	Type   FqdnOutboundRule_Type `json:"type,omitempty"`
}

// Status for the managed network of a machine learning workspace.
// +kubebuilder:validation:Enum={"Active","Inactive"}
type ManagedNetworkStatus string

const (
	ManagedNetworkStatus_Active   = ManagedNetworkStatus("Active")
	ManagedNetworkStatus_Inactive = ManagedNetworkStatus("Inactive")
)

// Mapping from string to ManagedNetworkStatus
var managedNetworkStatus_Values = map[string]ManagedNetworkStatus{
	"active":   ManagedNetworkStatus_Active,
	"inactive": ManagedNetworkStatus_Inactive,
}

type PrivateEndpointOutboundRule struct {
	// Category: Category of a managed network Outbound Rule of a machine learning workspace.
	Category *RuleCategory `json:"category,omitempty"`

	// Destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine
	// learning  workspace.
	Destination *PrivateEndpointDestination `json:"destination,omitempty"`

	// Status: Type of a managed network Outbound Rule of a machine learning workspace.
	Status *RuleStatus                      `json:"status,omitempty"`
	Type   PrivateEndpointOutboundRule_Type `json:"type,omitempty"`
}

// The private endpoint connection status.
// +kubebuilder:validation:Enum={"Approved","Disconnected","Pending","Rejected","Timeout"}
type PrivateEndpointServiceConnectionStatus string

const (
	PrivateEndpointServiceConnectionStatus_Approved     = PrivateEndpointServiceConnectionStatus("Approved")
	PrivateEndpointServiceConnectionStatus_Disconnected = PrivateEndpointServiceConnectionStatus("Disconnected")
	PrivateEndpointServiceConnectionStatus_Pending      = PrivateEndpointServiceConnectionStatus("Pending")
	PrivateEndpointServiceConnectionStatus_Rejected     = PrivateEndpointServiceConnectionStatus("Rejected")
	PrivateEndpointServiceConnectionStatus_Timeout      = PrivateEndpointServiceConnectionStatus("Timeout")
)

// Mapping from string to PrivateEndpointServiceConnectionStatus
var privateEndpointServiceConnectionStatus_Values = map[string]PrivateEndpointServiceConnectionStatus{
	"approved":     PrivateEndpointServiceConnectionStatus_Approved,
	"disconnected": PrivateEndpointServiceConnectionStatus_Disconnected,
	"pending":      PrivateEndpointServiceConnectionStatus_Pending,
	"rejected":     PrivateEndpointServiceConnectionStatus_Rejected,
	"timeout":      PrivateEndpointServiceConnectionStatus_Timeout,
}

type ServiceTagOutboundRule struct {
	// Category: Category of a managed network Outbound Rule of a machine learning workspace.
	Category *RuleCategory `json:"category,omitempty"`

	// Destination: Service Tag destination for a Service Tag Outbound Rule for the managed network of a machine learning
	// workspace.
	Destination *ServiceTagDestination `json:"destination,omitempty"`

	// Status: Type of a managed network Outbound Rule of a machine learning workspace.
	Status *RuleStatus                 `json:"status,omitempty"`
	Type   ServiceTagOutboundRule_Type `json:"type,omitempty"`
}

// +kubebuilder:validation:Enum={"FQDN"}
type FqdnOutboundRule_Type string

const FqdnOutboundRule_Type_FQDN = FqdnOutboundRule_Type("FQDN")

// Mapping from string to FqdnOutboundRule_Type
var fqdnOutboundRule_Type_Values = map[string]FqdnOutboundRule_Type{
	"fqdn": FqdnOutboundRule_Type_FQDN,
}

// Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a machine learning
// workspace.
type PrivateEndpointDestination struct {
	ServiceResourceId *string `json:"serviceResourceId,omitempty"`
	SparkEnabled      *bool   `json:"sparkEnabled,omitempty"`

	// SparkStatus: Type of a managed network Outbound Rule of a machine learning workspace.
	SparkStatus       *RuleStatus `json:"sparkStatus,omitempty"`
	SubresourceTarget *string     `json:"subresourceTarget,omitempty"`
}

// +kubebuilder:validation:Enum={"PrivateEndpoint"}
type PrivateEndpointOutboundRule_Type string

const PrivateEndpointOutboundRule_Type_PrivateEndpoint = PrivateEndpointOutboundRule_Type("PrivateEndpoint")

// Mapping from string to PrivateEndpointOutboundRule_Type
var privateEndpointOutboundRule_Type_Values = map[string]PrivateEndpointOutboundRule_Type{
	"privateendpoint": PrivateEndpointOutboundRule_Type_PrivateEndpoint,
}

// Category of a managed network Outbound Rule of a machine learning workspace.
// +kubebuilder:validation:Enum={"Dependency","Recommended","Required","UserDefined"}
type RuleCategory string

const (
	RuleCategory_Dependency  = RuleCategory("Dependency")
	RuleCategory_Recommended = RuleCategory("Recommended")
	RuleCategory_Required    = RuleCategory("Required")
	RuleCategory_UserDefined = RuleCategory("UserDefined")
)

// Mapping from string to RuleCategory
var ruleCategory_Values = map[string]RuleCategory{
	"dependency":  RuleCategory_Dependency,
	"recommended": RuleCategory_Recommended,
	"required":    RuleCategory_Required,
	"userdefined": RuleCategory_UserDefined,
}

// Type of a managed network Outbound Rule of a machine learning workspace.
// +kubebuilder:validation:Enum={"Active","Inactive"}
type RuleStatus string

const (
	RuleStatus_Active   = RuleStatus("Active")
	RuleStatus_Inactive = RuleStatus("Inactive")
)

// Mapping from string to RuleStatus
var ruleStatus_Values = map[string]RuleStatus{
	"active":   RuleStatus_Active,
	"inactive": RuleStatus_Inactive,
}

// Service Tag destination for a Service Tag Outbound Rule for the managed network of a machine learning workspace.
type ServiceTagDestination struct {
	// Action: The action enum for networking rule.
	Action     *RuleAction `json:"action,omitempty"`
	PortRanges *string     `json:"portRanges,omitempty"`
	Protocol   *string     `json:"protocol,omitempty"`
	ServiceTag *string     `json:"serviceTag,omitempty"`
}

// +kubebuilder:validation:Enum={"ServiceTag"}
type ServiceTagOutboundRule_Type string

const ServiceTagOutboundRule_Type_ServiceTag = ServiceTagOutboundRule_Type("ServiceTag")

// Mapping from string to ServiceTagOutboundRule_Type
var serviceTagOutboundRule_Type_Values = map[string]ServiceTagOutboundRule_Type{
	"servicetag": ServiceTagOutboundRule_Type_ServiceTag,
}

// The action enum for networking rule.
// +kubebuilder:validation:Enum={"Allow","Deny"}
type RuleAction string

const (
	RuleAction_Allow = RuleAction("Allow")
	RuleAction_Deny  = RuleAction("Deny")
)

// Mapping from string to RuleAction
var ruleAction_Values = map[string]RuleAction{
	"allow": RuleAction_Allow,
	"deny":  RuleAction_Deny,
}
