diff --git a/azurerm/internal/services/databricks/client/client.go b/azurerm/internal/services/databricks/client/client.go index 7b39583fcb3e..d0d6b711d572 100644 --- a/azurerm/internal/services/databricks/client/client.go +++ b/azurerm/internal/services/databricks/client/client.go @@ -1,7 +1,7 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/databricks/mgmt/2018-04-01/databricks" + "github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common" ) diff --git a/azurerm/internal/services/databricks/databricks_customer_managed_key_resource.go b/azurerm/internal/services/databricks/databricks_customer_managed_key_resource.go index a8b40aa4813b..0523c3182b0e 100644 --- a/azurerm/internal/services/databricks/databricks_customer_managed_key_resource.go +++ b/azurerm/internal/services/databricks/databricks_customer_managed_key_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/databricks/mgmt/2018-04-01/databricks" + "github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/locks" @@ -148,7 +148,7 @@ func DatabricksWorkspaceCustomerManagedKeyCreateUpdate(d *pluginsdk.ResourceData params := workspace.Parameters params.Encryption = &databricks.WorkspaceEncryptionParameter{ Value: &databricks.Encryption{ - KeySource: databricks.MicrosoftKeyvault, + KeySource: databricks.KeySourceMicrosoftKeyvault, KeyName: &key.Name, KeyVersion: &key.Version, KeyVaultURI: &key.KeyVaultBaseUrl, @@ -229,7 +229,7 @@ func DatabricksWorkspaceCustomerManagedKeyRead(d *pluginsdk.ResourceData, meta i // return fmt.Errorf("retrieving Databricks Workspace %q (Resource Group %q): `Workspace.WorkspaceProperties.Encryption.Value.KeySource` was expected to be %q, got %q", id.CustomerMangagedKeyName, id.ResourceGroup, string(databricks.MicrosoftKeyvault), keySource) // } - if strings.EqualFold(keySource, string(databricks.MicrosoftKeyvault)) && (keyName == "" || keyVersion == "" || keyVaultURI == "") { + if strings.EqualFold(keySource, string(databricks.KeySourceMicrosoftKeyvault)) && (keyName == "" || keyVersion == "" || keyVaultURI == "") { return fmt.Errorf("Databricks Workspace %q (Resource Group %q): `Workspace.WorkspaceProperties.Encryption.Value(s)` were nil", id.CustomerMangagedKeyName, id.ResourceGroup) } @@ -282,7 +282,7 @@ func DatabricksWorkspaceCustomerManagedKeyDelete(d *pluginsdk.ResourceData, meta params := workspace.Parameters params.Encryption = &databricks.WorkspaceEncryptionParameter{ Value: &databricks.Encryption{ - KeySource: databricks.Default, + KeySource: databricks.KeySourceDefault, }, } diff --git a/azurerm/internal/services/databricks/databricks_customer_managed_key_resource_test.go b/azurerm/internal/services/databricks/databricks_customer_managed_key_resource_test.go index 3f0788d706a1..cd22116c7819 100644 --- a/azurerm/internal/services/databricks/databricks_customer_managed_key_resource_test.go +++ b/azurerm/internal/services/databricks/databricks_customer_managed_key_resource_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/Azure/azure-sdk-for-go/services/databricks/mgmt/2018-04-01/databricks" + "github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/acceptance/check" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients" @@ -117,7 +117,7 @@ func (DatabricksWorkspaceCustomerManagedKeyResource) Exists(ctx context.Context, // This is the only way we can tell if the CMK has actually been provisioned or not... if resp.WorkspaceProperties.Parameters != nil && resp.WorkspaceProperties.Parameters.Encryption != nil { - if resp.WorkspaceProperties.Parameters.Encryption.Value.KeySource == databricks.MicrosoftKeyvault { + if resp.WorkspaceProperties.Parameters.Encryption.Value.KeySource == databricks.KeySourceMicrosoftKeyvault { return utils.Bool(true), nil } } diff --git a/azurerm/internal/services/databricks/databricks_workspace_resource.go b/azurerm/internal/services/databricks/databricks_workspace_resource.go index 2cf4d18138f4..5268f07628e7 100644 --- a/azurerm/internal/services/databricks/databricks_workspace_resource.go +++ b/azurerm/internal/services/databricks/databricks_workspace_resource.go @@ -7,7 +7,7 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/databricks/mgmt/2018-04-01/databricks" + "github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks" "github.com/hashicorp/go-azure-helpers/response" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure" "github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf" @@ -114,6 +114,13 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { AtLeastOneOf: workspaceCustomParametersString(), }, + "public_subnet_network_security_group_association_id": { + Type: pluginsdk.TypeString, + ForceNew: true, + Optional: true, + AtLeastOneOf: workspaceCustomParametersString(), + }, + "private_subnet_name": { Type: pluginsdk.TypeString, ForceNew: true, @@ -121,6 +128,13 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { AtLeastOneOf: workspaceCustomParametersString(), }, + "private_subnet_network_security_group_association_id": { + Type: pluginsdk.TypeString, + ForceNew: true, + Optional: true, + AtLeastOneOf: workspaceCustomParametersString(), + }, + "virtual_network_id": { Type: pluginsdk.TypeString, ForceNew: true, @@ -178,6 +192,18 @@ func resourceDatabricksWorkspace() *pluginsdk.Resource { _, infrastructureEncryptionEnabled := d.GetChange("infrastructure_encryption_enabled") oldSku, newSku := d.GetChange("sku") + _, customParamsRaw := d.GetChange("custom_parameters") + if customParamsRaw != nil { + customParams := expandWorkspaceCustomParameters(customParamsRaw.([]interface{}), customerEncryptionEnabled.(bool), infrastructureEncryptionEnabled.(bool)) + + if customParams.CustomVirtualNetworkID != nil && (customParams.CustomPrivateSubnetName == nil || customParams.CustomPublicSubnetName == nil) { + return fmt.Errorf("'public_subnet_name' and 'private_subnet_name' must both have values if 'virtual_network_id' is set") + } + if customParams.CustomVirtualNetworkID == nil && (customParams.CustomPrivateSubnetName != nil || customParams.CustomPublicSubnetName != nil) { + return fmt.Errorf("'virtual_network_id' must have a value if 'public_subnet_name' and/or 'private_subnet_name' are set") + } + } + if d.HasChange("sku") { if newSku == "trial" { log.Printf("[DEBUG] recreate databricks workspace, cannot be migrated to %s", newSku) @@ -510,5 +536,6 @@ func expandWorkspaceCustomParameters(input []interface{}, customerManagedKeyEnab func workspaceCustomParametersString() []string { return []string{"custom_parameters.0.machine_learning_workspace_id", "custom_parameters.0.no_public_ip", - "custom_parameters.0.public_subnet_name", "custom_parameters.0.private_subnet_name", "custom_parameters.0.virtual_network_id"} + "custom_parameters.0.public_subnet_name", "custom_parameters.0.private_subnet_name", "custom_parameters.0.virtual_network_id", + "custom_parameters.0.public_subnet_network_security_group_association_id", "custom_parameters.0.private_subnet_network_security_group_association_id"} } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/_meta.json new file mode 100644 index 000000000000..86c066542123 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "2b0b50e3e5bd467aa039a51cafa2a071593eca28", + "readme": "/_/azure-rest-api-specs/specification/databricks/resource-manager/readme.md", + "tag": "package-2021-04-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.183", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.183 --tag=package-2021-04-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/databricks/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/client.go new file mode 100644 index 000000000000..6c57631b61e0 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/client.go @@ -0,0 +1,41 @@ +// Package databricks implements the Azure ARM Databricks service API version . +// +// The Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace resources. +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Databricks + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Databricks. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/enums.go new file mode 100644 index 000000000000..7d78e4a819f1 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/enums.go @@ -0,0 +1,200 @@ +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// CustomParameterType enumerates the values for custom parameter type. +type CustomParameterType string + +const ( + // CustomParameterTypeBool ... + CustomParameterTypeBool CustomParameterType = "Bool" + // CustomParameterTypeObject ... + CustomParameterTypeObject CustomParameterType = "Object" + // CustomParameterTypeString ... + CustomParameterTypeString CustomParameterType = "String" +) + +// PossibleCustomParameterTypeValues returns an array of possible values for the CustomParameterType const type. +func PossibleCustomParameterTypeValues() []CustomParameterType { + return []CustomParameterType{CustomParameterTypeBool, CustomParameterTypeObject, CustomParameterTypeString} +} + +// KeySource enumerates the values for key source. +type KeySource string + +const ( + // KeySourceDefault ... + KeySourceDefault KeySource = "Default" + // KeySourceMicrosoftKeyvault ... + KeySourceMicrosoftKeyvault KeySource = "Microsoft.Keyvault" +) + +// PossibleKeySourceValues returns an array of possible values for the KeySource const type. +func PossibleKeySourceValues() []KeySource { + return []KeySource{KeySourceDefault, KeySourceMicrosoftKeyvault} +} + +// PeeringProvisioningState enumerates the values for peering provisioning state. +type PeeringProvisioningState string + +const ( + // PeeringProvisioningStateDeleting ... + PeeringProvisioningStateDeleting PeeringProvisioningState = "Deleting" + // PeeringProvisioningStateFailed ... + PeeringProvisioningStateFailed PeeringProvisioningState = "Failed" + // PeeringProvisioningStateSucceeded ... + PeeringProvisioningStateSucceeded PeeringProvisioningState = "Succeeded" + // PeeringProvisioningStateUpdating ... + PeeringProvisioningStateUpdating PeeringProvisioningState = "Updating" +) + +// PossiblePeeringProvisioningStateValues returns an array of possible values for the PeeringProvisioningState const type. +func PossiblePeeringProvisioningStateValues() []PeeringProvisioningState { + return []PeeringProvisioningState{PeeringProvisioningStateDeleting, PeeringProvisioningStateFailed, PeeringProvisioningStateSucceeded, PeeringProvisioningStateUpdating} +} + +// PeeringState enumerates the values for peering state. +type PeeringState string + +const ( + // PeeringStateConnected ... + PeeringStateConnected PeeringState = "Connected" + // PeeringStateDisconnected ... + PeeringStateDisconnected PeeringState = "Disconnected" + // PeeringStateInitiated ... + PeeringStateInitiated PeeringState = "Initiated" +) + +// PossiblePeeringStateValues returns an array of possible values for the PeeringState const type. +func PossiblePeeringStateValues() []PeeringState { + return []PeeringState{PeeringStateConnected, PeeringStateDisconnected, PeeringStateInitiated} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating ... + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting ... + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed ... + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded ... + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" + // PrivateEndpointConnectionProvisioningStateUpdating ... + PrivateEndpointConnectionProvisioningStateUpdating PrivateEndpointConnectionProvisioningState = "Updating" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded, PrivateEndpointConnectionProvisioningStateUpdating} +} + +// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. +type PrivateLinkServiceConnectionStatus string + +const ( + // PrivateLinkServiceConnectionStatusApproved ... + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + // PrivateLinkServiceConnectionStatusDisconnected ... + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // PrivateLinkServiceConnectionStatusPending ... + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + // PrivateLinkServiceConnectionStatusRejected ... + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{PrivateLinkServiceConnectionStatusApproved, PrivateLinkServiceConnectionStatusDisconnected, PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusRejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted ... + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreated ... + ProvisioningStateCreated ProvisioningState = "Created" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateReady ... + ProvisioningStateReady ProvisioningState = "Ready" + // ProvisioningStateRunning ... + ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateCreated, ProvisioningStateCreating, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateReady, ProvisioningStateRunning, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// RequiredNsgRules enumerates the values for required nsg rules. +type RequiredNsgRules string + +const ( + // RequiredNsgRulesAllRules ... + RequiredNsgRulesAllRules RequiredNsgRules = "AllRules" + // RequiredNsgRulesNoAzureDatabricksRules ... + RequiredNsgRulesNoAzureDatabricksRules RequiredNsgRules = "NoAzureDatabricksRules" + // RequiredNsgRulesNoAzureServiceRules ... + RequiredNsgRulesNoAzureServiceRules RequiredNsgRules = "NoAzureServiceRules" +) + +// PossibleRequiredNsgRulesValues returns an array of possible values for the RequiredNsgRules const type. +func PossibleRequiredNsgRulesValues() []RequiredNsgRules { + return []RequiredNsgRules{RequiredNsgRulesAllRules, RequiredNsgRulesNoAzureDatabricksRules, RequiredNsgRulesNoAzureServiceRules} +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/models.go new file mode 100644 index 000000000000..589bc4b44784 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/models.go @@ -0,0 +1,1865 @@ +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "github.com/gofrs/uuid" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks" + +// AddressSpace addressSpace contains an array of IP address ranges that can be used by subnets of the +// virtual network. +type AddressSpace struct { + // AddressPrefixes - A list of address blocks reserved for this virtual network in CIDR notation. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` +} + +// CreatedBy provides details of the entity that created/updated the workspace. +type CreatedBy struct { + // Oid - READ-ONLY; The Object ID that created the workspace. + Oid *uuid.UUID `json:"oid,omitempty"` + // Puid - READ-ONLY; The Personal Object ID corresponding to the object ID above + Puid *string `json:"puid,omitempty"` + // ApplicationID - READ-ONLY; The application ID of the application that initiated the creation of the workspace. For example, Azure Portal. + ApplicationID *uuid.UUID `json:"applicationId,omitempty"` +} + +// MarshalJSON is the custom marshaler for CreatedBy. +func (cb CreatedBy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Encryption the object that contains details of encryption used on the workspace. +type Encryption struct { + // KeySource - The encryption keySource (provider). Possible values (case-insensitive): Default, Microsoft.Keyvault. Possible values include: 'KeySourceDefault', 'KeySourceMicrosoftKeyvault' + KeySource KeySource `json:"keySource,omitempty"` + // KeyName - The name of KeyVault key. + KeyName *string `json:"KeyName,omitempty"` + // KeyVersion - The version of KeyVault key. + KeyVersion *string `json:"keyversion,omitempty"` + // KeyVaultURI - The Uri of KeyVault. + KeyVaultURI *string `json:"keyvaulturi,omitempty"` +} + +// EncryptionEntitiesDefinition encryption entities for databricks workspace resource. +type EncryptionEntitiesDefinition struct { + // ManagedServices - Encryption properties for the databricks managed services. + ManagedServices *EncryptionV2 `json:"managedServices,omitempty"` +} + +// EncryptionV2 the object that contains details of encryption used on the workspace. +type EncryptionV2 struct { + // KeySource - The encryption keySource (provider). Possible values (case-insensitive): Microsoft.Keyvault + KeySource *string `json:"keySource,omitempty"` + // KeyVaultProperties - Key Vault input properties for encryption. + KeyVaultProperties *EncryptionV2KeyVaultProperties `json:"keyVaultProperties,omitempty"` +} + +// EncryptionV2KeyVaultProperties key Vault input properties for encryption. +type EncryptionV2KeyVaultProperties struct { + // KeyVaultURI - The Uri of KeyVault. + KeyVaultURI *string `json:"keyVaultUri,omitempty"` + // KeyName - The name of KeyVault key. + KeyName *string `json:"keyName,omitempty"` + // KeyVersion - The version of KeyVault key. + KeyVersion *string `json:"keyVersion,omitempty"` +} + +// ErrorDetail ... +type ErrorDetail struct { + // Code - The error's code. + Code *string `json:"code,omitempty"` + // Message - A human readable error message. + Message *string `json:"message,omitempty"` + // Target - Indicates which property in the request is responsible for the error. + Target *string `json:"target,omitempty"` +} + +// ErrorInfo ... +type ErrorInfo struct { + // Code - A machine readable error code. + Code *string `json:"code,omitempty"` + // Message - A human readable error message. + Message *string `json:"message,omitempty"` + // Details - error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // Innererror - Inner error details if they exist. + Innererror *string `json:"innererror,omitempty"` +} + +// ErrorResponse contains details when the response code indicates an error. +type ErrorResponse struct { + // Error - The error details. + Error *ErrorInfo `json:"error,omitempty"` +} + +// GroupIDInformation the group information for creating a private endpoint on a workspace +type GroupIDInformation struct { + autorest.Response `json:"-"` + // Properties - The group id properties. + Properties *GroupIDInformationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for GroupIDInformation. +func (gii GroupIDInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gii.Properties != nil { + objectMap["properties"] = gii.Properties + } + return json.Marshal(objectMap) +} + +// GroupIDInformationProperties the properties for a group information object +type GroupIDInformationProperties struct { + // GroupID - The group id + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The required members for a specific group id + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The required DNS zones for a specific group id + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// ManagedIdentityConfiguration the Managed Identity details for storage account. +type ManagedIdentityConfiguration struct { + // PrincipalID - READ-ONLY; The objectId of the Managed Identity that is linked to the Managed Storage account. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant Id where the Managed Identity is created. + TenantID *uuid.UUID `json:"tenantId,omitempty"` + // Type - READ-ONLY; The type of Identity created. It can be either SystemAssigned or UserAssigned. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedIdentityConfiguration. +func (mic ManagedIdentityConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Operation REST API operation +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - The object that represents the operation. + Display *OperationDisplay `json:"display,omitempty"` +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft.ResourceProvider + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Operation type: Read, write, delete, etc. + Operation *string `json:"operation,omitempty"` +} + +// OperationListResult result of the request to list Resource Provider operations. It contains a list of +// operations and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Resource Provider operations supported by the Resource Provider resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PrivateEndpoint the private endpoint property of a private endpoint connection +type PrivateEndpoint struct { + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection the private endpoint connection of a workspace +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Properties - The private endpoint connection properties. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.Properties != nil { + objectMap["properties"] = pec.Properties + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionProperties the properties of a private endpoint connection +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - Private endpoint connection state + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - Provisioning state of the private endpoint connection. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateUpdating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} + +// PrivateEndpointConnectionsCreateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsCreateFuture.Result. +func (future *PrivateEndpointConnectionsCreateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.PrivateEndpointConnectionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.CreateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsCreateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateEndpointConnectionsList list of private link connections. +type PrivateEndpointConnectionsList struct { + autorest.Response `json:"-"` + // Value - The list of returned private endpoint connection. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - The URL to get the next set of endpoint connections. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateEndpointConnectionsListIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type PrivateEndpointConnectionsListIterator struct { + i int + page PrivateEndpointConnectionsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointConnectionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointConnectionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointConnectionsListIterator) Response() PrivateEndpointConnectionsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointConnectionsListIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionsListIterator type. +func NewPrivateEndpointConnectionsListIterator(page PrivateEndpointConnectionsListPage) PrivateEndpointConnectionsListIterator { + return PrivateEndpointConnectionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pecl PrivateEndpointConnectionsList) IsEmpty() bool { + return pecl.Value == nil || len(*pecl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pecl PrivateEndpointConnectionsList) hasNextLink() bool { + return pecl.NextLink != nil && len(*pecl.NextLink) != 0 +} + +// privateEndpointConnectionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pecl PrivateEndpointConnectionsList) privateEndpointConnectionsListPreparer(ctx context.Context) (*http.Request, error) { + if !pecl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pecl.NextLink))) +} + +// PrivateEndpointConnectionsListPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionsListPage struct { + fn func(context.Context, PrivateEndpointConnectionsList) (PrivateEndpointConnectionsList, error) + pecl PrivateEndpointConnectionsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointConnectionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pecl) + if err != nil { + return err + } + page.pecl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointConnectionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionsListPage) NotDone() bool { + return !page.pecl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionsListPage) Response() PrivateEndpointConnectionsList { + return page.pecl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionsListPage) Values() []PrivateEndpointConnection { + if page.pecl.IsEmpty() { + return nil + } + return *page.pecl.Value +} + +// Creates a new instance of the PrivateEndpointConnectionsListPage type. +func NewPrivateEndpointConnectionsListPage(cur PrivateEndpointConnectionsList, getNextPage func(context.Context, PrivateEndpointConnectionsList) (PrivateEndpointConnectionsList, error)) PrivateEndpointConnectionsListPage { + return PrivateEndpointConnectionsListPage{ + fn: getNextPage, + pecl: cur, + } +} + +// PrivateLinkResourcesList the available private link resources for a workspace +type PrivateLinkResourcesList struct { + autorest.Response `json:"-"` + // Value - The list of available private link resources for a workspace + Value *[]GroupIDInformation `json:"value,omitempty"` + // NextLink - The URL to get the next set of private link resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// PrivateLinkResourcesListIterator provides access to a complete listing of GroupIDInformation values. +type PrivateLinkResourcesListIterator struct { + i int + page PrivateLinkResourcesListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateLinkResourcesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateLinkResourcesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkResourcesListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateLinkResourcesListIterator) Response() PrivateLinkResourcesList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateLinkResourcesListIterator) Value() GroupIDInformation { + if !iter.page.NotDone() { + return GroupIDInformation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkResourcesListIterator type. +func NewPrivateLinkResourcesListIterator(page PrivateLinkResourcesListPage) PrivateLinkResourcesListIterator { + return PrivateLinkResourcesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plrl PrivateLinkResourcesList) IsEmpty() bool { + return plrl.Value == nil || len(*plrl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plrl PrivateLinkResourcesList) hasNextLink() bool { + return plrl.NextLink != nil && len(*plrl.NextLink) != 0 +} + +// privateLinkResourcesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plrl PrivateLinkResourcesList) privateLinkResourcesListPreparer(ctx context.Context) (*http.Request, error) { + if !plrl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plrl.NextLink))) +} + +// PrivateLinkResourcesListPage contains a page of GroupIDInformation values. +type PrivateLinkResourcesListPage struct { + fn func(context.Context, PrivateLinkResourcesList) (PrivateLinkResourcesList, error) + plrl PrivateLinkResourcesList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateLinkResourcesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plrl) + if err != nil { + return err + } + page.plrl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateLinkResourcesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkResourcesListPage) NotDone() bool { + return !page.plrl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkResourcesListPage) Response() PrivateLinkResourcesList { + return page.plrl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkResourcesListPage) Values() []GroupIDInformation { + if page.plrl.IsEmpty() { + return nil + } + return *page.plrl.Value +} + +// Creates a new instance of the PrivateLinkResourcesListPage type. +func NewPrivateLinkResourcesListPage(cur PrivateLinkResourcesList, getNextPage func(context.Context, PrivateLinkResourcesList) (PrivateLinkResourcesList, error)) PrivateLinkResourcesListPage { + return PrivateLinkResourcesListPage{ + fn: getNextPage, + plrl: cur, + } +} + +// PrivateLinkServiceConnectionState the current state of a private endpoint connection +type PrivateLinkServiceConnectionState struct { + // Status - The status of a private endpoint connection. Possible values include: 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + // Description - The description for the current state of a private endpoint connection + Description *string `json:"description,omitempty"` + // ActionRequired - Actions required for a private endpoint connection + ActionRequired *string `json:"actionRequired,omitempty"` +} + +// Resource the core properties of ARM resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Sku SKU for the resource. +type Sku struct { + // Name - The SKU name. + Name *string `json:"name,omitempty"` + // Tier - The SKU tier. + Tier *string `json:"tier,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackedResource the resource model definition for a ARM tracked top level resource +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// VirtualNetworkPeering peerings in a VirtualNetwork resource +type VirtualNetworkPeering struct { + autorest.Response `json:"-"` + // VirtualNetworkPeeringPropertiesFormat - List of properties for vNet Peering + *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"` + // Name - READ-ONLY; Name of the virtual network peering resource + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; type of the virtual network peering resource + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPeering. +func (vnp VirtualNetworkPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnp.VirtualNetworkPeeringPropertiesFormat != nil { + objectMap["properties"] = vnp.VirtualNetworkPeeringPropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkPeering struct. +func (vnp *VirtualNetworkPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkPeeringPropertiesFormat VirtualNetworkPeeringPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkPeeringPropertiesFormat) + if err != nil { + return err + } + vnp.VirtualNetworkPeeringPropertiesFormat = &virtualNetworkPeeringPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnp.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnp.ID = &ID + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnp.Type = &typeVar + } + } + } + + return nil +} + +// VirtualNetworkPeeringList gets all virtual network peerings under a workspace. +type VirtualNetworkPeeringList struct { + autorest.Response `json:"-"` + // Value - List of virtual network peerings on workspace. + Value *[]VirtualNetworkPeering `json:"value,omitempty"` + // NextLink - URL to get the next set of virtual network peering list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkPeeringListIterator provides access to a complete listing of VirtualNetworkPeering values. +type VirtualNetworkPeeringListIterator struct { + i int + page VirtualNetworkPeeringListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkPeeringListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkPeeringListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkPeeringListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkPeeringListIterator) Response() VirtualNetworkPeeringList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkPeeringListIterator) Value() VirtualNetworkPeering { + if !iter.page.NotDone() { + return VirtualNetworkPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkPeeringListIterator type. +func NewVirtualNetworkPeeringListIterator(page VirtualNetworkPeeringListPage) VirtualNetworkPeeringListIterator { + return VirtualNetworkPeeringListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnpl VirtualNetworkPeeringList) IsEmpty() bool { + return vnpl.Value == nil || len(*vnpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnpl VirtualNetworkPeeringList) hasNextLink() bool { + return vnpl.NextLink != nil && len(*vnpl.NextLink) != 0 +} + +// virtualNetworkPeeringListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnpl VirtualNetworkPeeringList) virtualNetworkPeeringListPreparer(ctx context.Context) (*http.Request, error) { + if !vnpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnpl.NextLink))) +} + +// VirtualNetworkPeeringListPage contains a page of VirtualNetworkPeering values. +type VirtualNetworkPeeringListPage struct { + fn func(context.Context, VirtualNetworkPeeringList) (VirtualNetworkPeeringList, error) + vnpl VirtualNetworkPeeringList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkPeeringListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnpl) + if err != nil { + return err + } + page.vnpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkPeeringListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkPeeringListPage) NotDone() bool { + return !page.vnpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkPeeringListPage) Response() VirtualNetworkPeeringList { + return page.vnpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkPeeringListPage) Values() []VirtualNetworkPeering { + if page.vnpl.IsEmpty() { + return nil + } + return *page.vnpl.Value +} + +// Creates a new instance of the VirtualNetworkPeeringListPage type. +func NewVirtualNetworkPeeringListPage(cur VirtualNetworkPeeringList, getNextPage func(context.Context, VirtualNetworkPeeringList) (VirtualNetworkPeeringList, error)) VirtualNetworkPeeringListPage { + return VirtualNetworkPeeringListPage{ + fn: getNextPage, + vnpl: cur, + } +} + +// VirtualNetworkPeeringPropertiesFormat properties of the virtual network peering. +type VirtualNetworkPeeringPropertiesFormat struct { + // AllowVirtualNetworkAccess - Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. + AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` + // AllowForwardedTraffic - Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. + AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` + // AllowGatewayTransit - If gateway links can be used in remote virtual networking to link to this virtual network. + AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` + // UseRemoteGateways - If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. + UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` + // DatabricksVirtualNetwork - The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). + DatabricksVirtualNetwork *VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork `json:"databricksVirtualNetwork,omitempty"` + // DatabricksAddressSpace - The reference to the databricks virtual network address space. + DatabricksAddressSpace *AddressSpace `json:"databricksAddressSpace,omitempty"` + // RemoteVirtualNetwork - The remote virtual network should be in the same region. See here to learn more (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). + RemoteVirtualNetwork *VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork `json:"remoteVirtualNetwork,omitempty"` + // RemoteAddressSpace - The reference to the remote virtual network address space. + RemoteAddressSpace *AddressSpace `json:"remoteAddressSpace,omitempty"` + // PeeringState - READ-ONLY; The status of the virtual network peering. Possible values include: 'PeeringStateInitiated', 'PeeringStateConnected', 'PeeringStateDisconnected' + PeeringState PeeringState `json:"peeringState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network peering resource. Possible values include: 'PeeringProvisioningStateSucceeded', 'PeeringProvisioningStateUpdating', 'PeeringProvisioningStateDeleting', 'PeeringProvisioningStateFailed' + ProvisioningState PeeringProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPeeringPropertiesFormat. +func (vnppf VirtualNetworkPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnppf.AllowVirtualNetworkAccess != nil { + objectMap["allowVirtualNetworkAccess"] = vnppf.AllowVirtualNetworkAccess + } + if vnppf.AllowForwardedTraffic != nil { + objectMap["allowForwardedTraffic"] = vnppf.AllowForwardedTraffic + } + if vnppf.AllowGatewayTransit != nil { + objectMap["allowGatewayTransit"] = vnppf.AllowGatewayTransit + } + if vnppf.UseRemoteGateways != nil { + objectMap["useRemoteGateways"] = vnppf.UseRemoteGateways + } + if vnppf.DatabricksVirtualNetwork != nil { + objectMap["databricksVirtualNetwork"] = vnppf.DatabricksVirtualNetwork + } + if vnppf.DatabricksAddressSpace != nil { + objectMap["databricksAddressSpace"] = vnppf.DatabricksAddressSpace + } + if vnppf.RemoteVirtualNetwork != nil { + objectMap["remoteVirtualNetwork"] = vnppf.RemoteVirtualNetwork + } + if vnppf.RemoteAddressSpace != nil { + objectMap["remoteAddressSpace"] = vnppf.RemoteAddressSpace + } + return json.Marshal(objectMap) +} + +// VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork the remote virtual network should be in +// the same region. See here to learn more +// (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). +type VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork struct { + // ID - The Id of the databricks virtual network. + ID *string `json:"id,omitempty"` +} + +// VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork the remote virtual network should be in the +// same region. See here to learn more +// (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering). +type VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork struct { + // ID - The Id of the remote virtual network. + ID *string `json:"id,omitempty"` +} + +// VNetPeeringCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VNetPeeringCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VNetPeeringClient) (VirtualNetworkPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VNetPeeringCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VNetPeeringCreateOrUpdateFuture.Result. +func (future *VNetPeeringCreateOrUpdateFuture) result(client VNetPeeringClient) (vnp VirtualNetworkPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vnp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.VNetPeeringCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnp.Response.Response, err = future.GetResult(sender); err == nil && vnp.Response.Response.StatusCode != http.StatusNoContent { + vnp, err = client.CreateOrUpdateResponder(vnp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringCreateOrUpdateFuture", "Result", vnp.Response.Response, "Failure responding to request") + } + } + return +} + +// VNetPeeringDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VNetPeeringDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VNetPeeringClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VNetPeeringDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VNetPeeringDeleteFuture.Result. +func (future *VNetPeeringDeleteFuture) result(client VNetPeeringClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.VNetPeeringDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Workspace information about workspace. +type Workspace struct { + autorest.Response `json:"-"` + // WorkspaceProperties - The workspace properties. + *WorkspaceProperties `json:"properties,omitempty"` + // Sku - The SKU of the resource. + Sku *Sku `json:"sku,omitempty"` + // SystemData - READ-ONLY; The system metadata relating to this resource + SystemData *SystemData `json:"systemData,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Workspace. +func (w Workspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WorkspaceProperties != nil { + objectMap["properties"] = w.WorkspaceProperties + } + if w.Sku != nil { + objectMap["sku"] = w.Sku + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + if w.Location != nil { + objectMap["location"] = w.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Workspace struct. +func (w *Workspace) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var workspaceProperties WorkspaceProperties + err = json.Unmarshal(*v, &workspaceProperties) + if err != nil { + return err + } + w.WorkspaceProperties = &workspaceProperties + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + w.Sku = &sku + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + w.SystemData = &systemData + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + } + } + + return nil +} + +// WorkspaceCustomBooleanParameter the value which should be used for this field. +type WorkspaceCustomBooleanParameter struct { + // Type - The type of variable that this is. Possible values include: 'CustomParameterTypeBool', 'CustomParameterTypeObject', 'CustomParameterTypeString' + Type CustomParameterType `json:"type,omitempty"` + // Value - The value which should be used for this field. + Value *bool `json:"value,omitempty"` +} + +// WorkspaceCustomObjectParameter the value which should be used for this field. +type WorkspaceCustomObjectParameter struct { + // Type - The type of variable that this is. Possible values include: 'CustomParameterTypeBool', 'CustomParameterTypeObject', 'CustomParameterTypeString' + Type CustomParameterType `json:"type,omitempty"` + // Value - The value which should be used for this field. + Value interface{} `json:"value,omitempty"` +} + +// WorkspaceCustomParameters custom Parameters used for Cluster Creation. +type WorkspaceCustomParameters struct { + // AmlWorkspaceID - The ID of a Azure Machine Learning workspace to link with Databricks workspace + AmlWorkspaceID *WorkspaceCustomStringParameter `json:"amlWorkspaceId,omitempty"` + // CustomVirtualNetworkID - The ID of a Virtual Network where this Databricks Cluster should be created + CustomVirtualNetworkID *WorkspaceCustomStringParameter `json:"customVirtualNetworkId,omitempty"` + // CustomPublicSubnetName - The name of a Public Subnet within the Virtual Network + CustomPublicSubnetName *WorkspaceCustomStringParameter `json:"customPublicSubnetName,omitempty"` + // CustomPrivateSubnetName - The name of the Private Subnet within the Virtual Network + CustomPrivateSubnetName *WorkspaceCustomStringParameter `json:"customPrivateSubnetName,omitempty"` + // EnableNoPublicIP - Should the Public IP be Disabled? + EnableNoPublicIP *WorkspaceCustomBooleanParameter `json:"enableNoPublicIp,omitempty"` + // LoadBalancerBackendPoolName - Name of the outbound Load Balancer Backend Pool for Secure Cluster Connectivity (No Public IP). + LoadBalancerBackendPoolName *WorkspaceCustomStringParameter `json:"loadBalancerBackendPoolName,omitempty"` + // LoadBalancerID - Resource URI of Outbound Load balancer for Secure Cluster Connectivity (No Public IP) workspace. + LoadBalancerID *WorkspaceCustomStringParameter `json:"loadBalancerId,omitempty"` + // NatGatewayName - Name of the NAT gateway for Secure Cluster Connectivity (No Public IP) workspace subnets. + NatGatewayName *WorkspaceCustomStringParameter `json:"natGatewayName,omitempty"` + // PublicIPName - Name of the Public IP for No Public IP workspace with managed vNet. + PublicIPName *WorkspaceCustomStringParameter `json:"publicIpName,omitempty"` + // PrepareEncryption - Prepare the workspace for encryption. Enables the Managed Identity for managed storage account. + PrepareEncryption *WorkspaceCustomBooleanParameter `json:"prepareEncryption,omitempty"` + // Encryption - Contains the encryption details for Customer-Managed Key (CMK) enabled workspace. + Encryption *WorkspaceEncryptionParameter `json:"encryption,omitempty"` + // RequireInfrastructureEncryption - A boolean indicating whether or not the DBFS root file system will be enabled with secondary layer of encryption with platform managed keys for data at rest. + RequireInfrastructureEncryption *WorkspaceCustomBooleanParameter `json:"requireInfrastructureEncryption,omitempty"` + // StorageAccountName - Default DBFS storage account name. + StorageAccountName *WorkspaceCustomStringParameter `json:"storageAccountName,omitempty"` + // StorageAccountSkuName - Storage account SKU name, ex: Standard_GRS, Standard_LRS. Refer https://aka.ms/storageskus for valid inputs. + StorageAccountSkuName *WorkspaceCustomStringParameter `json:"storageAccountSkuName,omitempty"` + // VnetAddressPrefix - Address prefix for Managed virtual network. Default value for this input is 10.139. + VnetAddressPrefix *WorkspaceCustomStringParameter `json:"vnetAddressPrefix,omitempty"` + // ResourceTags - READ-ONLY; Tags applied to resources under Managed resource group. These can be updated by updating tags at workspace level. + ResourceTags *WorkspaceCustomObjectParameter `json:"resourceTags,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceCustomParameters. +func (wcp WorkspaceCustomParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wcp.AmlWorkspaceID != nil { + objectMap["amlWorkspaceId"] = wcp.AmlWorkspaceID + } + if wcp.CustomVirtualNetworkID != nil { + objectMap["customVirtualNetworkId"] = wcp.CustomVirtualNetworkID + } + if wcp.CustomPublicSubnetName != nil { + objectMap["customPublicSubnetName"] = wcp.CustomPublicSubnetName + } + if wcp.CustomPrivateSubnetName != nil { + objectMap["customPrivateSubnetName"] = wcp.CustomPrivateSubnetName + } + if wcp.EnableNoPublicIP != nil { + objectMap["enableNoPublicIp"] = wcp.EnableNoPublicIP + } + if wcp.LoadBalancerBackendPoolName != nil { + objectMap["loadBalancerBackendPoolName"] = wcp.LoadBalancerBackendPoolName + } + if wcp.LoadBalancerID != nil { + objectMap["loadBalancerId"] = wcp.LoadBalancerID + } + if wcp.NatGatewayName != nil { + objectMap["natGatewayName"] = wcp.NatGatewayName + } + if wcp.PublicIPName != nil { + objectMap["publicIpName"] = wcp.PublicIPName + } + if wcp.PrepareEncryption != nil { + objectMap["prepareEncryption"] = wcp.PrepareEncryption + } + if wcp.Encryption != nil { + objectMap["encryption"] = wcp.Encryption + } + if wcp.RequireInfrastructureEncryption != nil { + objectMap["requireInfrastructureEncryption"] = wcp.RequireInfrastructureEncryption + } + if wcp.StorageAccountName != nil { + objectMap["storageAccountName"] = wcp.StorageAccountName + } + if wcp.StorageAccountSkuName != nil { + objectMap["storageAccountSkuName"] = wcp.StorageAccountSkuName + } + if wcp.VnetAddressPrefix != nil { + objectMap["vnetAddressPrefix"] = wcp.VnetAddressPrefix + } + return json.Marshal(objectMap) +} + +// WorkspaceCustomStringParameter the Value. +type WorkspaceCustomStringParameter struct { + // Type - The type of variable that this is. Possible values include: 'CustomParameterTypeBool', 'CustomParameterTypeObject', 'CustomParameterTypeString' + Type CustomParameterType `json:"type,omitempty"` + // Value - The value which should be used for this field. + Value *string `json:"value,omitempty"` +} + +// WorkspaceEncryptionParameter the object that contains details of encryption used on the workspace. +type WorkspaceEncryptionParameter struct { + // Type - The type of variable that this is. Possible values include: 'CustomParameterTypeBool', 'CustomParameterTypeObject', 'CustomParameterTypeString' + Type CustomParameterType `json:"type,omitempty"` + // Value - The value which should be used for this field. + Value *Encryption `json:"value,omitempty"` +} + +// WorkspaceListResult list of workspaces. +type WorkspaceListResult struct { + autorest.Response `json:"-"` + // Value - The array of workspaces. + Value *[]Workspace `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// WorkspaceListResultIterator provides access to a complete listing of Workspace values. +type WorkspaceListResultIterator struct { + i int + page WorkspaceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WorkspaceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WorkspaceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WorkspaceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WorkspaceListResultIterator) Response() WorkspaceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WorkspaceListResultIterator) Value() Workspace { + if !iter.page.NotDone() { + return Workspace{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WorkspaceListResultIterator type. +func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator { + return WorkspaceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wlr WorkspaceListResult) IsEmpty() bool { + return wlr.Value == nil || len(*wlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wlr WorkspaceListResult) hasNextLink() bool { + return wlr.NextLink != nil && len(*wlr.NextLink) != 0 +} + +// workspaceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wlr WorkspaceListResult) workspaceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wlr.NextLink))) +} + +// WorkspaceListResultPage contains a page of Workspace values. +type WorkspaceListResultPage struct { + fn func(context.Context, WorkspaceListResult) (WorkspaceListResult, error) + wlr WorkspaceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WorkspaceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wlr) + if err != nil { + return err + } + page.wlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WorkspaceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WorkspaceListResultPage) NotDone() bool { + return !page.wlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WorkspaceListResultPage) Response() WorkspaceListResult { + return page.wlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WorkspaceListResultPage) Values() []Workspace { + if page.wlr.IsEmpty() { + return nil + } + return *page.wlr.Value +} + +// Creates a new instance of the WorkspaceListResultPage type. +func NewWorkspaceListResultPage(cur WorkspaceListResult, getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage { + return WorkspaceListResultPage{ + fn: getNextPage, + wlr: cur, + } +} + +// WorkspaceProperties the workspace properties. +type WorkspaceProperties struct { + // ManagedResourceGroupID - The managed resource group Id. + ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"` + // Parameters - The workspace's custom parameters. + Parameters *WorkspaceCustomParameters `json:"parameters,omitempty"` + // ProvisioningState - READ-ONLY; The workspace provisioning state. Possible values include: 'ProvisioningStateAccepted', 'ProvisioningStateRunning', 'ProvisioningStateReady', 'ProvisioningStateCreating', 'ProvisioningStateCreated', 'ProvisioningStateDeleting', 'ProvisioningStateDeleted', 'ProvisioningStateCanceled', 'ProvisioningStateFailed', 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // UIDefinitionURI - The blob URI where the UI definition file is located. + UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"` + // Authorizations - The workspace provider authorizations. + Authorizations *[]WorkspaceProviderAuthorization `json:"authorizations,omitempty"` + // CreatedBy - Indicates the Object ID, PUID and Application ID of entity that created the workspace. + CreatedBy *CreatedBy `json:"createdBy,omitempty"` + // UpdatedBy - Indicates the Object ID, PUID and Application ID of entity that last updated the workspace. + UpdatedBy *CreatedBy `json:"updatedBy,omitempty"` + // CreatedDateTime - Specifies the date and time when the workspace is created. + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` + // WorkspaceID - READ-ONLY; The unique identifier of the databricks workspace in databricks control plane. + WorkspaceID *string `json:"workspaceId,omitempty"` + // WorkspaceURL - READ-ONLY; The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net' + WorkspaceURL *string `json:"workspaceUrl,omitempty"` + // StorageAccountIdentity - The details of Managed Identity of Storage Account + StorageAccountIdentity *ManagedIdentityConfiguration `json:"storageAccountIdentity,omitempty"` + // Encryption - Encryption properties for databricks workspace + Encryption *WorkspacePropertiesEncryption `json:"encryption,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Private endpoint connections created on the workspace + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // PublicNetworkAccess - The network access type for accessing workspace. Set value to disabled to access workspace only via private link. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + // RequiredNsgRules - Gets or sets a value indicating whether data plane (clusters) to control plane communication happen over private endpoint. Supported values are 'AllRules' and 'NoAzureDatabricksRules'. 'NoAzureServiceRules' value is for internal use only. Possible values include: 'RequiredNsgRulesAllRules', 'RequiredNsgRulesNoAzureDatabricksRules', 'RequiredNsgRulesNoAzureServiceRules' + RequiredNsgRules RequiredNsgRules `json:"requiredNsgRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for WorkspaceProperties. +func (wp WorkspaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.ManagedResourceGroupID != nil { + objectMap["managedResourceGroupId"] = wp.ManagedResourceGroupID + } + if wp.Parameters != nil { + objectMap["parameters"] = wp.Parameters + } + if wp.UIDefinitionURI != nil { + objectMap["uiDefinitionUri"] = wp.UIDefinitionURI + } + if wp.Authorizations != nil { + objectMap["authorizations"] = wp.Authorizations + } + if wp.CreatedBy != nil { + objectMap["createdBy"] = wp.CreatedBy + } + if wp.UpdatedBy != nil { + objectMap["updatedBy"] = wp.UpdatedBy + } + if wp.CreatedDateTime != nil { + objectMap["createdDateTime"] = wp.CreatedDateTime + } + if wp.StorageAccountIdentity != nil { + objectMap["storageAccountIdentity"] = wp.StorageAccountIdentity + } + if wp.Encryption != nil { + objectMap["encryption"] = wp.Encryption + } + if wp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = wp.PublicNetworkAccess + } + if wp.RequiredNsgRules != "" { + objectMap["requiredNsgRules"] = wp.RequiredNsgRules + } + return json.Marshal(objectMap) +} + +// WorkspacePropertiesEncryption encryption properties for databricks workspace +type WorkspacePropertiesEncryption struct { + // Entities - Encryption entities definition for the workspace. + Entities *EncryptionEntitiesDefinition `json:"entities,omitempty"` +} + +// WorkspaceProviderAuthorization the workspace provider authorization. +type WorkspaceProviderAuthorization struct { + // PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the workspace resources. + PrincipalID *uuid.UUID `json:"principalId,omitempty"` + // RoleDefinitionID - The provider's role definition identifier. This role will define all the permissions that the provider must have on the workspace's container resource group. This role definition cannot have permission to delete the resource group. + RoleDefinitionID *uuid.UUID `json:"roleDefinitionId,omitempty"` +} + +// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WorkspacesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (Workspace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WorkspacesCreateOrUpdateFuture.Result. +func (future *WorkspacesCreateOrUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { + w, err = client.CreateOrUpdateResponder(w.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + return +} + +// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WorkspacesDeleteFuture.Result. +func (future *WorkspacesDeleteFuture) result(client WorkspacesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WorkspacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WorkspacesUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspacesClient) (Workspace, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspacesUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WorkspacesUpdateFuture.Result. +func (future *WorkspacesUpdateFuture) result(client WorkspacesClient) (w Workspace, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + w.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent { + w, err = client.UpdateResponder(w.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesUpdateFuture", "Result", w.Response.Response, "Failure responding to request") + } + } + return +} + +// WorkspaceUpdate an update to a workspace. +type WorkspaceUpdate struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WorkspaceUpdate. +func (wu WorkspaceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wu.Tags != nil { + objectMap["tags"] = wu.Tags + } + return json.Marshal(objectMap) +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/operations.go new file mode 100644 index 000000000000..d0c19472acf7 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/operations.go @@ -0,0 +1,141 @@ +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace +// resources. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available RP operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Databricks/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databricks.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privateendpointconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privateendpointconnections.go new file mode 100644 index 000000000000..3efa62d9f0fc --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privateendpointconnections.go @@ -0,0 +1,442 @@ +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the the Microsoft Azure management APIs allow end users to operate on Azure +// Databricks Workspace resources. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create update the status of a private endpoint connection with the specified name +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// privateEndpointConnectionName - the name of the private endpoint connection +// privateEndpointConnection - the private endpoint connection with updated properties +func (client PrivateEndpointConnectionsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: privateEndpointConnection, + Constraints: []validation.Constraint{{Target: "privateEndpointConnection.Properties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "privateEndpointConnection.Properties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("databricks.PrivateEndpointConnectionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName, privateEndpointConnection) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Create", nil, "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client PrivateEndpointConnectionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + privateEndpointConnection.ID = nil + privateEndpointConnection.Name = nil + privateEndpointConnection.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointConnection), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) CreateSender(req *http.Request) (future PrivateEndpointConnectionsCreateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete remove private endpoint connection with the specified name +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// privateEndpointConnectionName - the name of the private endpoint connection +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a private endpoint connection properties for a workspace +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// privateEndpointConnectionName - the name of the private endpoint connection +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private endpoint connections of the workspace +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.pecl.Response.Response != nil { + sc = result.pecl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pecl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.pecl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.pecl.hasNextLink() && result.pecl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointConnectionsList) (result PrivateEndpointConnectionsList, err error) { + req, err := lastResults.privateEndpointConnectionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateEndpointConnectionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privatelinkresources.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privatelinkresources.go new file mode 100644 index 000000000000..9296d50ea8e9 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/privatelinkresources.go @@ -0,0 +1,252 @@ +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the the Microsoft Azure management APIs allow end users to operate on Azure Databricks +// Workspace resources. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the specified private link resource for the given group id (sub-resource) +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// groupID - the name of the private link resource +func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, groupID string) (result GroupIDInformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateLinkResourcesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, groupID) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, groupID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupId": autorest.Encode("path", groupID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources/{groupId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result GroupIDInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private link resources for a given workspace +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourcesListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.plrl.Response.Response != nil { + sc = result.plrl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.PrivateLinkResourcesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plrl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result.plrl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.plrl.hasNextLink() && result.plrl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourcesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults PrivateLinkResourcesList) (result PrivateLinkResourcesList, err error) { + req, err := lastResults.privateLinkResourcesListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.PrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result PrivateLinkResourcesListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/version.go new file mode 100644 index 000000000000..db235e40ea70 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/version.go @@ -0,0 +1,19 @@ +package databricks + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " databricks/2021-04-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/vnetpeering.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/vnetpeering.go new file mode 100644 index 000000000000..c44a70ccfc69 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/vnetpeering.go @@ -0,0 +1,441 @@ +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VNetPeeringClient is the the Microsoft Azure management APIs allow end users to operate on Azure Databricks +// Workspace resources. +type VNetPeeringClient struct { + BaseClient +} + +// NewVNetPeeringClient creates an instance of the VNetPeeringClient client. +func NewVNetPeeringClient(subscriptionID string) VNetPeeringClient { + return NewVNetPeeringClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVNetPeeringClientWithBaseURI creates an instance of the VNetPeeringClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVNetPeeringClientWithBaseURI(baseURI string, subscriptionID string) VNetPeeringClient { + return VNetPeeringClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates vNet Peering for workspace. +// Parameters: +// virtualNetworkPeeringParameters - parameters supplied to the create workspace vNet Peering. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// peeringName - the name of the workspace vNet peering. +func (client VNetPeeringClient) CreateOrUpdate(ctx context.Context, virtualNetworkPeeringParameters VirtualNetworkPeering, resourceGroupName string, workspaceName string, peeringName string) (result VNetPeeringCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: virtualNetworkPeeringParameters, + Constraints: []validation.Constraint{{Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat.RemoteVirtualNetwork", Name: validation.Null, Rule: true, Chain: nil}}}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.VNetPeeringClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, virtualNetworkPeeringParameters, resourceGroupName, workspaceName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VNetPeeringClient) CreateOrUpdatePreparer(ctx context.Context, virtualNetworkPeeringParameters VirtualNetworkPeering, resourceGroupName string, workspaceName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2018-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + virtualNetworkPeeringParameters.Name = nil + virtualNetworkPeeringParameters.ID = nil + virtualNetworkPeeringParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}", pathParameters), + autorest.WithJSON(virtualNetworkPeeringParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VNetPeeringClient) CreateOrUpdateSender(req *http.Request) (future VNetPeeringCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VNetPeeringClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the workspace vNetPeering. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// peeringName - the name of the workspace vNet peering. +func (client VNetPeeringClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (result VNetPeeringDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.VNetPeeringClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VNetPeeringClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2018-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VNetPeeringClient) DeleteSender(req *http.Request) (future VNetPeeringDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VNetPeeringClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the workspace vNet Peering. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// peeringName - the name of the workspace vNet peering. +func (client VNetPeeringClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (result VirtualNetworkPeering, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.VNetPeeringClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VNetPeeringClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2018-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VNetPeeringClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VNetPeeringClient) GetResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByWorkspace lists the workspace vNet Peerings. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client VNetPeeringClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string) (result VirtualNetworkPeeringListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.ListByWorkspace") + defer func() { + sc := -1 + if result.vnpl.Response.Response != nil { + sc = result.vnpl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.VNetPeeringClient", "ListByWorkspace", err.Error()) + } + + result.fn = client.listByWorkspaceNextResults + req, err := client.ListByWorkspacePreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "ListByWorkspace", nil, "Failure preparing request") + return + } + + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.vnpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "ListByWorkspace", resp, "Failure sending request") + return + } + + result.vnpl, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "ListByWorkspace", resp, "Failure responding to request") + return + } + if result.vnpl.hasNextLink() && result.vnpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByWorkspacePreparer prepares the ListByWorkspace request. +func (client VNetPeeringClient) ListByWorkspacePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2018-04-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}/virtualNetworkPeerings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the +// http.Response Body if it receives an error. +func (client VNetPeeringClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always +// closes the http.Response Body. +func (client VNetPeeringClient) ListByWorkspaceResponder(resp *http.Response) (result VirtualNetworkPeeringList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByWorkspaceNextResults retrieves the next set of results, if any. +func (client VNetPeeringClient) listByWorkspaceNextResults(ctx context.Context, lastResults VirtualNetworkPeeringList) (result VirtualNetworkPeeringList, err error) { + req, err := lastResults.virtualNetworkPeeringListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "listByWorkspaceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByWorkspaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "listByWorkspaceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByWorkspaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.VNetPeeringClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required. +func (client VNetPeeringClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result VirtualNetworkPeeringListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VNetPeeringClient.ListByWorkspace") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName) + return +} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/workspaces.go b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/workspaces.go new file mode 100644 index 000000000000..24dd8ed422d3 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks/workspaces.go @@ -0,0 +1,680 @@ +package databricks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkspacesClient is the the Microsoft Azure management APIs allow end users to operate on Azure Databricks Workspace +// resources. +type WorkspacesClient struct { + BaseClient +} + +// NewWorkspacesClient creates an instance of the WorkspacesClient client. +func NewWorkspacesClient(subscriptionID string) WorkspacesClient { + return NewWorkspacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspacesClientWithBaseURI creates an instance of the WorkspacesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string) WorkspacesClient { + return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new workspace. +// Parameters: +// parameters - parameters supplied to the create or update a workspace. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspacesClient) CreateOrUpdate(ctx context.Context, parameters Workspace, resourceGroupName string, workspaceName string) (result WorkspacesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.WorkspaceProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.ManagedResourceGroupID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Parameters", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.AmlWorkspaceID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.AmlWorkspaceID.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.CustomVirtualNetworkID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.CustomVirtualNetworkID.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.CustomPublicSubnetName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.CustomPublicSubnetName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.CustomPrivateSubnetName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.CustomPrivateSubnetName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.EnableNoPublicIP", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.EnableNoPublicIP.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.LoadBalancerBackendPoolName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.LoadBalancerBackendPoolName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.LoadBalancerID", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.LoadBalancerID.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.NatGatewayName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.NatGatewayName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.PublicIPName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.PublicIPName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.PrepareEncryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.PrepareEncryption.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.RequireInfrastructureEncryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.RequireInfrastructureEncryption.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.StorageAccountName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.StorageAccountName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.StorageAccountSkuName", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.StorageAccountSkuName.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.VnetAddressPrefix", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.VnetAddressPrefix.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.WorkspaceProperties.Parameters.ResourceTags", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Parameters.ResourceTags.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.WorkspaceProperties.Encryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.Entities", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeySource", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeyVaultProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeyVaultProperties.KeyVaultURI", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeyVaultProperties.KeyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.WorkspaceProperties.Encryption.Entities.ManagedServices.KeyVaultProperties.KeyVersion", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}, + }}, + }}, + }}, + {Target: "parameters.Sku", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Sku.Name", Name: validation.Null, Rule: true, Chain: nil}}}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkspacesClient) CreateOrUpdatePreparer(ctx context.Context, parameters Workspace, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) CreateOrUpdateSender(req *http.Request) (future WorkspacesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) CreateOrUpdateResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspacesClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string) (result WorkspacesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkspacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) DeleteSender(req *http.Request) (future WorkspacesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the workspace. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspacesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string) (result Workspace, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkspacesClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) GetResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets all the workspaces within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client WorkspacesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WorkspaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkspacesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListByResourceGroupResponder(resp *http.Response) (result WorkspaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client WorkspacesClient) listByResourceGroupNextResults(ctx context.Context, lastResults WorkspaceListResult) (result WorkspaceListResult, err error) { + req, err := lastResults.workspaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspacesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WorkspaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListBySubscription gets all the workspaces within a subscription. +func (client WorkspacesClient) ListBySubscription(ctx context.Context) (result WorkspaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client WorkspacesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Databricks/workspaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) ListBySubscriptionResponder(resp *http.Response) (result WorkspaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client WorkspacesClient) listBySubscriptionNextResults(ctx context.Context, lastResults WorkspaceListResult) (result WorkspaceListResult, err error) { + req, err := lastResults.workspaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspacesClient) ListBySubscriptionComplete(ctx context.Context) (result WorkspaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// Update updates a workspace. +// Parameters: +// parameters - the update to the workspace. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspacesClient) Update(ctx context.Context, parameters WorkspaceUpdate, resourceGroupName string, workspaceName string) (result WorkspacesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: workspaceName, + Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 64, Chain: nil}, + {Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("databricks.WorkspacesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, parameters, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databricks.WorkspacesClient", "Update", nil, "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkspacesClient) UpdatePreparer(ctx context.Context, parameters WorkspaceUpdate, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-04-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Databricks/workspaces/{workspaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) UpdateSender(req *http.Request) (future WorkspacesUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) UpdateResponder(resp *http.Response) (result Workspace, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 85ad16c3fdb9..df4b7a7b179c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -80,6 +80,7 @@ github.com/Azure/azure-sdk-for-go/services/preview/automation/mgmt/2018-06-30-pr github.com/Azure/azure-sdk-for-go/services/preview/blueprint/mgmt/2018-11-01-preview/blueprint github.com/Azure/azure-sdk-for-go/services/preview/containerregistry/mgmt/2020-11-01-preview/containerregistry github.com/Azure/azure-sdk-for-go/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders +github.com/Azure/azure-sdk-for-go/services/preview/databricks/mgmt/2021-04-01-preview/databricks github.com/Azure/azure-sdk-for-go/services/preview/desktopvirtualization/mgmt/2020-11-02-preview/desktopvirtualization github.com/Azure/azure-sdk-for-go/services/preview/eventgrid/mgmt/2020-10-15-preview/eventgrid github.com/Azure/azure-sdk-for-go/services/preview/eventhub/mgmt/2018-01-01-preview/eventhub