diff --git a/profiles/latest/kusto/mgmt/kusto/kustoapi/models.go b/profiles/latest/kusto/mgmt/kusto/kustoapi/models.go index 79c2a64960cf..e63c8702ce99 100644 --- a/profiles/latest/kusto/mgmt/kusto/kustoapi/models.go +++ b/profiles/latest/kusto/mgmt/kusto/kustoapi/models.go @@ -21,6 +21,7 @@ package kustoapi import original "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-01-21/kusto/kustoapi" +type AttachedDatabaseConfigurationsClientAPI = original.AttachedDatabaseConfigurationsClientAPI type ClustersClientAPI = original.ClustersClientAPI type DataConnectionsClientAPI = original.DataConnectionsClientAPI type DatabasesClientAPI = original.DatabasesClientAPI diff --git a/profiles/latest/kusto/mgmt/kusto/models.go b/profiles/latest/kusto/mgmt/kusto/models.go index 3ce15243a390..6d7232b72519 100644 --- a/profiles/latest/kusto/mgmt/kusto/models.go +++ b/profiles/latest/kusto/mgmt/kusto/models.go @@ -40,13 +40,25 @@ const ( type AzureSkuName = original.AzureSkuName const ( - D11V2 AzureSkuName = original.D11V2 - D12V2 AzureSkuName = original.D12V2 - D13V2 AzureSkuName = original.D13V2 - D14V2 AzureSkuName = original.D14V2 - L16 AzureSkuName = original.L16 - L4 AzureSkuName = original.L4 - L8 AzureSkuName = original.L8 + DevNoSLAStandardD11V2 AzureSkuName = original.DevNoSLAStandardD11V2 + StandardD11V2 AzureSkuName = original.StandardD11V2 + StandardD12V2 AzureSkuName = original.StandardD12V2 + StandardD13V2 AzureSkuName = original.StandardD13V2 + StandardD14V2 AzureSkuName = original.StandardD14V2 + StandardDS13V21TBPS AzureSkuName = original.StandardDS13V21TBPS + StandardDS13V22TBPS AzureSkuName = original.StandardDS13V22TBPS + StandardDS14V23TBPS AzureSkuName = original.StandardDS14V23TBPS + StandardDS14V24TBPS AzureSkuName = original.StandardDS14V24TBPS + StandardL16s AzureSkuName = original.StandardL16s + StandardL4s AzureSkuName = original.StandardL4s + StandardL8s AzureSkuName = original.StandardL8s +) + +type AzureSkuTier = original.AzureSkuTier + +const ( + Basic AzureSkuTier = original.Basic + Standard AzureSkuTier = original.Standard ) type DataFormat = original.DataFormat @@ -87,9 +99,17 @@ const ( type Kind = original.Kind const ( - KindDataConnection Kind = original.KindDataConnection - KindEventGrid Kind = original.KindEventGrid - KindEventHub Kind = original.KindEventHub + KindDatabase Kind = original.KindDatabase + KindReadOnlyAttached Kind = original.KindReadOnlyAttached + KindReadWrite Kind = original.KindReadWrite +) + +type KindBasicDataConnection = original.KindBasicDataConnection + +const ( + KindDataConnection KindBasicDataConnection = original.KindDataConnection + KindEventGrid KindBasicDataConnection = original.KindEventGrid + KindEventHub KindBasicDataConnection = original.KindEventHub ) type ProvisioningState = original.ProvisioningState @@ -98,6 +118,7 @@ const ( Creating ProvisioningState = original.Creating Deleting ProvisioningState = original.Deleting Failed ProvisioningState = original.Failed + Moving ProvisioningState = original.Moving Running ProvisioningState = original.Running Succeeded ProvisioningState = original.Succeeded ) @@ -123,12 +144,27 @@ const ( StateUpdating State = original.StateUpdating ) +type Type = original.Type + +const ( + MicrosoftKustoclustersattachedDatabaseConfigurations Type = original.MicrosoftKustoclustersattachedDatabaseConfigurations + MicrosoftKustoclustersdatabases Type = original.MicrosoftKustoclustersdatabases +) + +type AttachedDatabaseConfiguration = original.AttachedDatabaseConfiguration +type AttachedDatabaseConfigurationListResult = original.AttachedDatabaseConfigurationListResult +type AttachedDatabaseConfigurationProperties = original.AttachedDatabaseConfigurationProperties +type AttachedDatabaseConfigurationsClient = original.AttachedDatabaseConfigurationsClient +type AttachedDatabaseConfigurationsCreateOrUpdateFuture = original.AttachedDatabaseConfigurationsCreateOrUpdateFuture +type AttachedDatabaseConfigurationsDeleteFuture = original.AttachedDatabaseConfigurationsDeleteFuture type AzureCapacity = original.AzureCapacity type AzureEntityResource = original.AzureEntityResource type AzureResourceSku = original.AzureResourceSku type AzureSku = original.AzureSku type BaseClient = original.BaseClient type BasicDataConnection = original.BasicDataConnection +type BasicDatabase = original.BasicDatabase +type CheckNameRequest = original.CheckNameRequest type CheckNameResult = original.CheckNameResult type CloudError = original.CloudError type CloudErrorBody = original.CloudErrorBody @@ -155,14 +191,12 @@ type DataConnectionsCreateOrUpdateFuture = original.DataConnectionsCreateOrUpdat type DataConnectionsDeleteFuture = original.DataConnectionsDeleteFuture type DataConnectionsUpdateFuture = original.DataConnectionsUpdateFuture type Database = original.Database -type DatabaseCheckNameRequest = original.DatabaseCheckNameRequest type DatabaseListResult = original.DatabaseListResult +type DatabaseModel = original.DatabaseModel type DatabasePrincipal = original.DatabasePrincipal type DatabasePrincipalListRequest = original.DatabasePrincipalListRequest type DatabasePrincipalListResult = original.DatabasePrincipalListResult -type DatabaseProperties = original.DatabaseProperties type DatabaseStatistics = original.DatabaseStatistics -type DatabaseUpdate = original.DatabaseUpdate type DatabasesClient = original.DatabasesClient type DatabasesCreateOrUpdateFuture = original.DatabasesCreateOrUpdateFuture type DatabasesDeleteFuture = original.DatabasesDeleteFuture @@ -171,8 +205,11 @@ type EventGridConnectionProperties = original.EventGridConnectionProperties type EventGridDataConnection = original.EventGridDataConnection type EventHubConnectionProperties = original.EventHubConnectionProperties type EventHubDataConnection = original.EventHubDataConnection +type FollowerDatabaseListResult = original.FollowerDatabaseListResult +type FollowerDatabaseRequest = original.FollowerDatabaseRequest +type FollowerDatabaseResult = original.FollowerDatabaseResult +type IntelligentAutoscale = original.IntelligentAutoscale type ListResourceSkusResult = original.ListResourceSkusResult -type ListSkusResult = original.ListSkusResult type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -180,13 +217,26 @@ type OperationListResultIterator = original.OperationListResultIterator type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type ProxyResource = original.ProxyResource +type ReadOnlyAttachedDatabase = original.ReadOnlyAttachedDatabase +type ReadOnlyAttachedDatabaseProperties = original.ReadOnlyAttachedDatabaseProperties +type ReadWriteDatabase = original.ReadWriteDatabase +type ReadWriteDatabaseProperties = original.ReadWriteDatabaseProperties type Resource = original.Resource +type SkuDescription = original.SkuDescription +type SkuDescriptionList = original.SkuDescriptionList +type SkuLocationInfoItem = original.SkuLocationInfoItem type TrackedResource = original.TrackedResource type TrustedExternalTenant = original.TrustedExternalTenant func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } +func NewAttachedDatabaseConfigurationsClient(subscriptionID string) AttachedDatabaseConfigurationsClient { + return original.NewAttachedDatabaseConfigurationsClient(subscriptionID) +} +func NewAttachedDatabaseConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) AttachedDatabaseConfigurationsClient { + return original.NewAttachedDatabaseConfigurationsClientWithBaseURI(baseURI, subscriptionID) +} func NewClustersClient(subscriptionID string) ClustersClient { return original.NewClustersClient(subscriptionID) } @@ -226,6 +276,9 @@ func PossibleAzureScaleTypeValues() []AzureScaleType { func PossibleAzureSkuNameValues() []AzureSkuName { return original.PossibleAzureSkuNameValues() } +func PossibleAzureSkuTierValues() []AzureSkuTier { + return original.PossibleAzureSkuTierValues() +} func PossibleDataFormatValues() []DataFormat { return original.PossibleDataFormatValues() } @@ -235,6 +288,9 @@ func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { return original.PossibleDatabasePrincipalTypeValues() } +func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { + return original.PossibleKindBasicDataConnectionValues() +} func PossibleKindValues() []Kind { return original.PossibleKindValues() } @@ -247,6 +303,9 @@ func PossibleReasonValues() []Reason { func PossibleStateValues() []State { return original.PossibleStateValues() } +func PossibleTypeValues() []Type { + return original.PossibleTypeValues() +} func UserAgent() string { return original.UserAgent() + " profiles/latest" } diff --git a/profiles/preview/kusto/mgmt/kusto/kustoapi/models.go b/profiles/preview/kusto/mgmt/kusto/kustoapi/models.go index 79c2a64960cf..e63c8702ce99 100644 --- a/profiles/preview/kusto/mgmt/kusto/kustoapi/models.go +++ b/profiles/preview/kusto/mgmt/kusto/kustoapi/models.go @@ -21,6 +21,7 @@ package kustoapi import original "github.com/Azure/azure-sdk-for-go/services/kusto/mgmt/2019-01-21/kusto/kustoapi" +type AttachedDatabaseConfigurationsClientAPI = original.AttachedDatabaseConfigurationsClientAPI type ClustersClientAPI = original.ClustersClientAPI type DataConnectionsClientAPI = original.DataConnectionsClientAPI type DatabasesClientAPI = original.DatabasesClientAPI diff --git a/profiles/preview/kusto/mgmt/kusto/models.go b/profiles/preview/kusto/mgmt/kusto/models.go index 780ad95f75db..55b74fb99601 100644 --- a/profiles/preview/kusto/mgmt/kusto/models.go +++ b/profiles/preview/kusto/mgmt/kusto/models.go @@ -40,13 +40,25 @@ const ( type AzureSkuName = original.AzureSkuName const ( - D11V2 AzureSkuName = original.D11V2 - D12V2 AzureSkuName = original.D12V2 - D13V2 AzureSkuName = original.D13V2 - D14V2 AzureSkuName = original.D14V2 - L16 AzureSkuName = original.L16 - L4 AzureSkuName = original.L4 - L8 AzureSkuName = original.L8 + DevNoSLAStandardD11V2 AzureSkuName = original.DevNoSLAStandardD11V2 + StandardD11V2 AzureSkuName = original.StandardD11V2 + StandardD12V2 AzureSkuName = original.StandardD12V2 + StandardD13V2 AzureSkuName = original.StandardD13V2 + StandardD14V2 AzureSkuName = original.StandardD14V2 + StandardDS13V21TBPS AzureSkuName = original.StandardDS13V21TBPS + StandardDS13V22TBPS AzureSkuName = original.StandardDS13V22TBPS + StandardDS14V23TBPS AzureSkuName = original.StandardDS14V23TBPS + StandardDS14V24TBPS AzureSkuName = original.StandardDS14V24TBPS + StandardL16s AzureSkuName = original.StandardL16s + StandardL4s AzureSkuName = original.StandardL4s + StandardL8s AzureSkuName = original.StandardL8s +) + +type AzureSkuTier = original.AzureSkuTier + +const ( + Basic AzureSkuTier = original.Basic + Standard AzureSkuTier = original.Standard ) type DataFormat = original.DataFormat @@ -87,9 +99,17 @@ const ( type Kind = original.Kind const ( - KindDataConnection Kind = original.KindDataConnection - KindEventGrid Kind = original.KindEventGrid - KindEventHub Kind = original.KindEventHub + KindDatabase Kind = original.KindDatabase + KindReadOnlyAttached Kind = original.KindReadOnlyAttached + KindReadWrite Kind = original.KindReadWrite +) + +type KindBasicDataConnection = original.KindBasicDataConnection + +const ( + KindDataConnection KindBasicDataConnection = original.KindDataConnection + KindEventGrid KindBasicDataConnection = original.KindEventGrid + KindEventHub KindBasicDataConnection = original.KindEventHub ) type ProvisioningState = original.ProvisioningState @@ -98,6 +118,7 @@ const ( Creating ProvisioningState = original.Creating Deleting ProvisioningState = original.Deleting Failed ProvisioningState = original.Failed + Moving ProvisioningState = original.Moving Running ProvisioningState = original.Running Succeeded ProvisioningState = original.Succeeded ) @@ -123,12 +144,27 @@ const ( StateUpdating State = original.StateUpdating ) +type Type = original.Type + +const ( + MicrosoftKustoclustersattachedDatabaseConfigurations Type = original.MicrosoftKustoclustersattachedDatabaseConfigurations + MicrosoftKustoclustersdatabases Type = original.MicrosoftKustoclustersdatabases +) + +type AttachedDatabaseConfiguration = original.AttachedDatabaseConfiguration +type AttachedDatabaseConfigurationListResult = original.AttachedDatabaseConfigurationListResult +type AttachedDatabaseConfigurationProperties = original.AttachedDatabaseConfigurationProperties +type AttachedDatabaseConfigurationsClient = original.AttachedDatabaseConfigurationsClient +type AttachedDatabaseConfigurationsCreateOrUpdateFuture = original.AttachedDatabaseConfigurationsCreateOrUpdateFuture +type AttachedDatabaseConfigurationsDeleteFuture = original.AttachedDatabaseConfigurationsDeleteFuture type AzureCapacity = original.AzureCapacity type AzureEntityResource = original.AzureEntityResource type AzureResourceSku = original.AzureResourceSku type AzureSku = original.AzureSku type BaseClient = original.BaseClient type BasicDataConnection = original.BasicDataConnection +type BasicDatabase = original.BasicDatabase +type CheckNameRequest = original.CheckNameRequest type CheckNameResult = original.CheckNameResult type CloudError = original.CloudError type CloudErrorBody = original.CloudErrorBody @@ -155,14 +191,12 @@ type DataConnectionsCreateOrUpdateFuture = original.DataConnectionsCreateOrUpdat type DataConnectionsDeleteFuture = original.DataConnectionsDeleteFuture type DataConnectionsUpdateFuture = original.DataConnectionsUpdateFuture type Database = original.Database -type DatabaseCheckNameRequest = original.DatabaseCheckNameRequest type DatabaseListResult = original.DatabaseListResult +type DatabaseModel = original.DatabaseModel type DatabasePrincipal = original.DatabasePrincipal type DatabasePrincipalListRequest = original.DatabasePrincipalListRequest type DatabasePrincipalListResult = original.DatabasePrincipalListResult -type DatabaseProperties = original.DatabaseProperties type DatabaseStatistics = original.DatabaseStatistics -type DatabaseUpdate = original.DatabaseUpdate type DatabasesClient = original.DatabasesClient type DatabasesCreateOrUpdateFuture = original.DatabasesCreateOrUpdateFuture type DatabasesDeleteFuture = original.DatabasesDeleteFuture @@ -171,8 +205,11 @@ type EventGridConnectionProperties = original.EventGridConnectionProperties type EventGridDataConnection = original.EventGridDataConnection type EventHubConnectionProperties = original.EventHubConnectionProperties type EventHubDataConnection = original.EventHubDataConnection +type FollowerDatabaseListResult = original.FollowerDatabaseListResult +type FollowerDatabaseRequest = original.FollowerDatabaseRequest +type FollowerDatabaseResult = original.FollowerDatabaseResult +type IntelligentAutoscale = original.IntelligentAutoscale type ListResourceSkusResult = original.ListResourceSkusResult -type ListSkusResult = original.ListSkusResult type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -180,13 +217,26 @@ type OperationListResultIterator = original.OperationListResultIterator type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type ProxyResource = original.ProxyResource +type ReadOnlyAttachedDatabase = original.ReadOnlyAttachedDatabase +type ReadOnlyAttachedDatabaseProperties = original.ReadOnlyAttachedDatabaseProperties +type ReadWriteDatabase = original.ReadWriteDatabase +type ReadWriteDatabaseProperties = original.ReadWriteDatabaseProperties type Resource = original.Resource +type SkuDescription = original.SkuDescription +type SkuDescriptionList = original.SkuDescriptionList +type SkuLocationInfoItem = original.SkuLocationInfoItem type TrackedResource = original.TrackedResource type TrustedExternalTenant = original.TrustedExternalTenant func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } +func NewAttachedDatabaseConfigurationsClient(subscriptionID string) AttachedDatabaseConfigurationsClient { + return original.NewAttachedDatabaseConfigurationsClient(subscriptionID) +} +func NewAttachedDatabaseConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) AttachedDatabaseConfigurationsClient { + return original.NewAttachedDatabaseConfigurationsClientWithBaseURI(baseURI, subscriptionID) +} func NewClustersClient(subscriptionID string) ClustersClient { return original.NewClustersClient(subscriptionID) } @@ -226,6 +276,9 @@ func PossibleAzureScaleTypeValues() []AzureScaleType { func PossibleAzureSkuNameValues() []AzureSkuName { return original.PossibleAzureSkuNameValues() } +func PossibleAzureSkuTierValues() []AzureSkuTier { + return original.PossibleAzureSkuTierValues() +} func PossibleDataFormatValues() []DataFormat { return original.PossibleDataFormatValues() } @@ -235,6 +288,9 @@ func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { return original.PossibleDatabasePrincipalTypeValues() } +func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { + return original.PossibleKindBasicDataConnectionValues() +} func PossibleKindValues() []Kind { return original.PossibleKindValues() } @@ -247,6 +303,9 @@ func PossibleReasonValues() []Reason { func PossibleStateValues() []State { return original.PossibleStateValues() } +func PossibleTypeValues() []Type { + return original.PossibleTypeValues() +} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/services/kusto/mgmt/2019-01-21/kusto/attacheddatabaseconfigurations.go b/services/kusto/mgmt/2019-01-21/kusto/attacheddatabaseconfigurations.go new file mode 100644 index 000000000000..2cffd3ae5be4 --- /dev/null +++ b/services/kusto/mgmt/2019-01-21/kusto/attacheddatabaseconfigurations.go @@ -0,0 +1,370 @@ +package kusto + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" +) + +// AttachedDatabaseConfigurationsClient is the the Azure Kusto management API provides a RESTful set of web services +// that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, +// update, and delete clusters and databases. +type AttachedDatabaseConfigurationsClient struct { + BaseClient +} + +// NewAttachedDatabaseConfigurationsClient creates an instance of the AttachedDatabaseConfigurationsClient client. +func NewAttachedDatabaseConfigurationsClient(subscriptionID string) AttachedDatabaseConfigurationsClient { + return NewAttachedDatabaseConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAttachedDatabaseConfigurationsClientWithBaseURI creates an instance of the AttachedDatabaseConfigurationsClient +// client. +func NewAttachedDatabaseConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) AttachedDatabaseConfigurationsClient { + return AttachedDatabaseConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an attached database configuration. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// attachedDatabaseConfigurationName - the name of the attached database configuration. +// parameters - the database parameters supplied to the CreateOrUpdate operation. +func (client AttachedDatabaseConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration) (result AttachedDatabaseConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.AttachedDatabaseConfigurationProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.AttachedDatabaseConfigurationProperties.DatabaseName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.AttachedDatabaseConfigurationProperties.ClusterResourceID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("kusto.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AttachedDatabaseConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "attachedDatabaseConfigurationName": autorest.Encode("path", attachedDatabaseConfigurationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-21" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}", 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 AttachedDatabaseConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future AttachedDatabaseConfigurationsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AttachedDatabaseConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result AttachedDatabaseConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the attached database configuration with the given name. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// attachedDatabaseConfigurationName - the name of the attached database configuration. +func (client AttachedDatabaseConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (result AttachedDatabaseConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AttachedDatabaseConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "attachedDatabaseConfigurationName": autorest.Encode("path", attachedDatabaseConfigurationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-21" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}", 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 AttachedDatabaseConfigurationsClient) DeleteSender(req *http.Request) (future AttachedDatabaseConfigurationsDeleteFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AttachedDatabaseConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get returns an attached database configuration. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// attachedDatabaseConfigurationName - the name of the attached database configuration. +func (client AttachedDatabaseConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (result AttachedDatabaseConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AttachedDatabaseConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "attachedDatabaseConfigurationName": autorest.Encode("path", attachedDatabaseConfigurationName), + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-21" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}", 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 AttachedDatabaseConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AttachedDatabaseConfigurationsClient) GetResponder(resp *http.Response) (result AttachedDatabaseConfiguration, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByCluster returns the list of attached database configurations of the given Kusto cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client AttachedDatabaseConfigurationsClient) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result AttachedDatabaseConfigurationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AttachedDatabaseConfigurationsClient.ListByCluster") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByClusterPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "ListByCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "ListByCluster", resp, "Failure sending request") + return + } + + result, err = client.ListByClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsClient", "ListByCluster", resp, "Failure responding to request") + } + + return +} + +// ListByClusterPreparer prepares the ListByCluster request. +func (client AttachedDatabaseConfigurationsClient) ListByClusterPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-21" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterSender sends the ListByCluster request. The method will close the +// http.Response Body if it receives an error. +func (client AttachedDatabaseConfigurationsClient) ListByClusterSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterResponder handles the response to the ListByCluster request. The method always +// closes the http.Response Body. +func (client AttachedDatabaseConfigurationsClient) ListByClusterResponder(resp *http.Response) (result AttachedDatabaseConfigurationListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/kusto/mgmt/2019-01-21/kusto/clusters.go b/services/kusto/mgmt/2019-01-21/kusto/clusters.go index b2bd8bb2bb03..24915540d4e0 100644 --- a/services/kusto/mgmt/2019-01-21/kusto/clusters.go +++ b/services/kusto/mgmt/2019-01-21/kusto/clusters.go @@ -146,8 +146,14 @@ func (client ClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupNa } if err := validation.Validate([]validation.Validation{ {TargetValue: parameters, - Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "parameters.Sku.Tier", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + Constraints: []validation.Constraint{{Target: "parameters.Sku", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.IntelligentAutoscale", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ClusterProperties.IntelligentAutoscale.Version", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.IntelligentAutoscale.Minimum", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ClusterProperties.IntelligentAutoscale.Maximum", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { return result, validation.NewError("kusto.ClustersClient", "CreateOrUpdate", err.Error()) } @@ -291,6 +297,93 @@ func (client ClustersClient) DeleteResponder(resp *http.Response) (result autore return } +// DetachFollowerDatabases detaches all followers of a database owned by this cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +// followerDatabaseToRemove - list of follower databases to remove. +func (client ClustersClient) DetachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseRequest) (result FollowerDatabaseListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.DetachFollowerDatabases") + 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: followerDatabaseToRemove, + Constraints: []validation.Constraint{{Target: "followerDatabaseToRemove.ClusterResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "followerDatabaseToRemove.DatabaseName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("kusto.ClustersClient", "DetachFollowerDatabases", err.Error()) + } + + req, err := client.DetachFollowerDatabasesPreparer(ctx, resourceGroupName, clusterName, followerDatabaseToRemove) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", nil, "Failure preparing request") + return + } + + resp, err := client.DetachFollowerDatabasesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", resp, "Failure sending request") + return + } + + result, err = client.DetachFollowerDatabasesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", resp, "Failure responding to request") + } + + return +} + +// DetachFollowerDatabasesPreparer prepares the DetachFollowerDatabases request. +func (client ClustersClient) DetachFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-21" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases", pathParameters), + autorest.WithJSON(followerDatabaseToRemove), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DetachFollowerDatabasesSender sends the DetachFollowerDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) DetachFollowerDatabasesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DetachFollowerDatabasesResponder handles the response to the DetachFollowerDatabases request. The method always +// closes the http.Response Body. +func (client ClustersClient) DetachFollowerDatabasesResponder(resp *http.Response) (result FollowerDatabaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Get gets a Kusto cluster. // Parameters: // resourceGroupName - the name of the resource group containing the Kusto cluster. @@ -515,8 +608,86 @@ func (client ClustersClient) ListByResourceGroupResponder(resp *http.Response) ( return } +// ListFollowerDatabases returns a list of databases that are owned by this cluster and were followed by another +// cluster. +// Parameters: +// resourceGroupName - the name of the resource group containing the Kusto cluster. +// clusterName - the name of the Kusto cluster. +func (client ClustersClient) ListFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string) (result FollowerDatabaseListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListFollowerDatabases") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListFollowerDatabasesPreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", nil, "Failure preparing request") + return + } + + resp, err := client.ListFollowerDatabasesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", resp, "Failure sending request") + return + } + + result, err = client.ListFollowerDatabasesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "ListFollowerDatabases", resp, "Failure responding to request") + } + + return +} + +// ListFollowerDatabasesPreparer prepares the ListFollowerDatabases request. +func (client ClustersClient) ListFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-01-21" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListFollowerDatabasesSender sends the ListFollowerDatabases request. The method will close the +// http.Response Body if it receives an error. +func (client ClustersClient) ListFollowerDatabasesSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListFollowerDatabasesResponder handles the response to the ListFollowerDatabases request. The method always +// closes the http.Response Body. +func (client ClustersClient) ListFollowerDatabasesResponder(resp *http.Response) (result FollowerDatabaseListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListSkus lists eligible SKUs for Kusto resource provider. -func (client ClustersClient) ListSkus(ctx context.Context) (result ListSkusResult, err error) { +func (client ClustersClient) ListSkus(ctx context.Context) (result SkuDescriptionList, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.ListSkus") defer func() { @@ -576,7 +747,7 @@ func (client ClustersClient) ListSkusSender(req *http.Request) (*http.Response, // ListSkusResponder handles the response to the ListSkus request. The method always // closes the http.Response Body. -func (client ClustersClient) ListSkusResponder(resp *http.Response) (result ListSkusResult, err error) { +func (client ClustersClient) ListSkusResponder(resp *http.Response) (result SkuDescriptionList, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/kusto/mgmt/2019-01-21/kusto/databases.go b/services/kusto/mgmt/2019-01-21/kusto/databases.go index 020bf3673d52..894d0e827522 100644 --- a/services/kusto/mgmt/2019-01-21/kusto/databases.go +++ b/services/kusto/mgmt/2019-01-21/kusto/databases.go @@ -129,8 +129,8 @@ func (client DatabasesClient) AddPrincipalsResponder(resp *http.Response) (resul // Parameters: // resourceGroupName - the name of the resource group containing the Kusto cluster. // clusterName - the name of the Kusto cluster. -// databaseName - the name of the database. -func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName DatabaseCheckNameRequest) (result CheckNameResult, err error) { +// resourceName - the name of the resource. +func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest) (result CheckNameResult, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CheckNameAvailability") defer func() { @@ -142,13 +142,12 @@ func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourc }() } if err := validation.Validate([]validation.Validation{ - {TargetValue: databaseName, - Constraints: []validation.Constraint{{Target: "databaseName.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "databaseName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { return result, validation.NewError("kusto.DatabasesClient", "CheckNameAvailability", err.Error()) } - req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, databaseName) + req, err := client.CheckNameAvailabilityPreparer(ctx, resourceGroupName, clusterName, resourceName) if err != nil { err = autorest.NewErrorWithError(err, "kusto.DatabasesClient", "CheckNameAvailability", nil, "Failure preparing request") return @@ -170,7 +169,7 @@ func (client DatabasesClient) CheckNameAvailability(ctx context.Context, resourc } // CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -func (client DatabasesClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName DatabaseCheckNameRequest) (*http.Request, error) { +func (client DatabasesClient) CheckNameAvailabilityPreparer(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), "resourceGroupName": autorest.Encode("path", resourceGroupName), @@ -187,7 +186,7 @@ func (client DatabasesClient) CheckNameAvailabilityPreparer(ctx context.Context, autorest.AsPost(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability", pathParameters), - autorest.WithJSON(databaseName), + autorest.WithJSON(resourceName), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -218,7 +217,7 @@ func (client DatabasesClient) CheckNameAvailabilityResponder(resp *http.Response // clusterName - the name of the Kusto cluster. // databaseName - the name of the database in the Kusto cluster. // parameters - the database parameters supplied to the CreateOrUpdate operation. -func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database) (result DatabasesCreateOrUpdateFuture, err error) { +func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (result DatabasesCreateOrUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.CreateOrUpdate") defer func() { @@ -245,7 +244,7 @@ func (client DatabasesClient) CreateOrUpdate(ctx context.Context, resourceGroupN } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database) (*http.Request, error) { +func (client DatabasesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), "databaseName": autorest.Encode("path", databaseName), @@ -283,7 +282,7 @@ func (client DatabasesClient) CreateOrUpdateSender(req *http.Request) (future Da // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // closes the http.Response Body. -func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result Database, err error) { +func (client DatabasesClient) CreateOrUpdateResponder(resp *http.Response) (result DatabaseModel, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -377,7 +376,7 @@ func (client DatabasesClient) DeleteResponder(resp *http.Response) (result autor // resourceGroupName - the name of the resource group containing the Kusto cluster. // clusterName - the name of the Kusto cluster. // databaseName - the name of the database in the Kusto cluster. -func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result Database, err error) { +func (client DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result DatabaseModel, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Get") defer func() { @@ -440,7 +439,7 @@ func (client DatabasesClient) GetSender(req *http.Request) (*http.Response, erro // GetResponder handles the response to the Get request. The method always // closes the http.Response Body. -func (client DatabasesClient) GetResponder(resp *http.Response) (result Database, err error) { +func (client DatabasesClient) GetResponder(resp *http.Response) (result DatabaseModel, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -695,7 +694,7 @@ func (client DatabasesClient) RemovePrincipalsResponder(resp *http.Response) (re // clusterName - the name of the Kusto cluster. // databaseName - the name of the database in the Kusto cluster. // parameters - the database parameters supplied to the Update operation. -func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate) (result DatabasesUpdateFuture, err error) { +func (client DatabasesClient) Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (result DatabasesUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/DatabasesClient.Update") defer func() { @@ -722,7 +721,7 @@ func (client DatabasesClient) Update(ctx context.Context, resourceGroupName stri } // UpdatePreparer prepares the Update request. -func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate) (*http.Request, error) { +func (client DatabasesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters BasicDatabase) (*http.Request, error) { pathParameters := map[string]interface{}{ "clusterName": autorest.Encode("path", clusterName), "databaseName": autorest.Encode("path", databaseName), @@ -760,7 +759,7 @@ func (client DatabasesClient) UpdateSender(req *http.Request) (future DatabasesU // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client DatabasesClient) UpdateResponder(resp *http.Response) (result Database, err error) { +func (client DatabasesClient) UpdateResponder(resp *http.Response) (result DatabaseModel, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/kusto/mgmt/2019-01-21/kusto/kustoapi/interfaces.go b/services/kusto/mgmt/2019-01-21/kusto/kustoapi/interfaces.go index 80a11951ddb8..78bbd44cd34f 100644 --- a/services/kusto/mgmt/2019-01-21/kusto/kustoapi/interfaces.go +++ b/services/kusto/mgmt/2019-01-21/kusto/kustoapi/interfaces.go @@ -27,10 +27,12 @@ type ClustersClientAPI interface { CheckNameAvailability(ctx context.Context, location string, clusterName kusto.ClusterCheckNameRequest) (result kusto.CheckNameResult, err error) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters kusto.Cluster) (result kusto.ClustersCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, clusterName string) (result kusto.ClustersDeleteFuture, err error) + DetachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove kusto.FollowerDatabaseRequest) (result kusto.FollowerDatabaseListResult, err error) Get(ctx context.Context, resourceGroupName string, clusterName string) (result kusto.Cluster, err error) List(ctx context.Context) (result kusto.ClusterListResult, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result kusto.ClusterListResult, err error) - ListSkus(ctx context.Context) (result kusto.ListSkusResult, err error) + ListFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string) (result kusto.FollowerDatabaseListResult, err error) + ListSkus(ctx context.Context) (result kusto.SkuDescriptionList, err error) ListSkusByResource(ctx context.Context, resourceGroupName string, clusterName string) (result kusto.ListResourceSkusResult, err error) Start(ctx context.Context, resourceGroupName string, clusterName string) (result kusto.ClustersStartFuture, err error) Stop(ctx context.Context, resourceGroupName string, clusterName string) (result kusto.ClustersStopFuture, err error) @@ -42,18 +44,28 @@ var _ ClustersClientAPI = (*kusto.ClustersClient)(nil) // DatabasesClientAPI contains the set of methods on the DatabasesClient type. type DatabasesClientAPI interface { AddPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd kusto.DatabasePrincipalListRequest) (result kusto.DatabasePrincipalListResult, err error) - CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName kusto.DatabaseCheckNameRequest) (result kusto.CheckNameResult, err error) - CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters kusto.Database) (result kusto.DatabasesCreateOrUpdateFuture, err error) + CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName kusto.CheckNameRequest) (result kusto.CheckNameResult, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters kusto.BasicDatabase) (result kusto.DatabasesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result kusto.DatabasesDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result kusto.Database, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result kusto.DatabaseModel, err error) ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result kusto.DatabaseListResult, err error) ListPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string) (result kusto.DatabasePrincipalListResult, err error) RemovePrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove kusto.DatabasePrincipalListRequest) (result kusto.DatabasePrincipalListResult, err error) - Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters kusto.DatabaseUpdate) (result kusto.DatabasesUpdateFuture, err error) + Update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters kusto.BasicDatabase) (result kusto.DatabasesUpdateFuture, err error) } var _ DatabasesClientAPI = (*kusto.DatabasesClient)(nil) +// AttachedDatabaseConfigurationsClientAPI contains the set of methods on the AttachedDatabaseConfigurationsClient type. +type AttachedDatabaseConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters kusto.AttachedDatabaseConfiguration) (result kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (result kusto.AttachedDatabaseConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string) (result kusto.AttachedDatabaseConfiguration, err error) + ListByCluster(ctx context.Context, resourceGroupName string, clusterName string) (result kusto.AttachedDatabaseConfigurationListResult, err error) +} + +var _ AttachedDatabaseConfigurationsClientAPI = (*kusto.AttachedDatabaseConfigurationsClient)(nil) + // DataConnectionsClientAPI contains the set of methods on the DataConnectionsClient type. type DataConnectionsClientAPI interface { CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName kusto.DataConnectionCheckNameRequest) (result kusto.CheckNameResult, err error) diff --git a/services/kusto/mgmt/2019-01-21/kusto/models.go b/services/kusto/mgmt/2019-01-21/kusto/models.go index 6d4195894c48..8959f6c28545 100644 --- a/services/kusto/mgmt/2019-01-21/kusto/models.go +++ b/services/kusto/mgmt/2019-01-21/kusto/models.go @@ -51,25 +51,50 @@ func PossibleAzureScaleTypeValues() []AzureScaleType { type AzureSkuName string const ( - // D11V2 ... - D11V2 AzureSkuName = "D11_v2" - // D12V2 ... - D12V2 AzureSkuName = "D12_v2" - // D13V2 ... - D13V2 AzureSkuName = "D13_v2" - // D14V2 ... - D14V2 AzureSkuName = "D14_v2" - // L16 ... - L16 AzureSkuName = "L16" - // L4 ... - L4 AzureSkuName = "L4" - // L8 ... - L8 AzureSkuName = "L8" + // DevNoSLAStandardD11V2 ... + DevNoSLAStandardD11V2 AzureSkuName = "Dev(No SLA)_Standard_D11_v2" + // StandardD11V2 ... + StandardD11V2 AzureSkuName = "Standard_D11_v2" + // StandardD12V2 ... + StandardD12V2 AzureSkuName = "Standard_D12_v2" + // StandardD13V2 ... + StandardD13V2 AzureSkuName = "Standard_D13_v2" + // StandardD14V2 ... + StandardD14V2 AzureSkuName = "Standard_D14_v2" + // StandardDS13V21TBPS ... + StandardDS13V21TBPS AzureSkuName = "Standard_DS13_v2+1TB_PS" + // StandardDS13V22TBPS ... + StandardDS13V22TBPS AzureSkuName = "Standard_DS13_v2+2TB_PS" + // StandardDS14V23TBPS ... + StandardDS14V23TBPS AzureSkuName = "Standard_DS14_v2+3TB_PS" + // StandardDS14V24TBPS ... + StandardDS14V24TBPS AzureSkuName = "Standard_DS14_v2+4TB_PS" + // StandardL16s ... + StandardL16s AzureSkuName = "Standard_L16s" + // StandardL4s ... + StandardL4s AzureSkuName = "Standard_L4s" + // StandardL8s ... + StandardL8s AzureSkuName = "Standard_L8s" ) // PossibleAzureSkuNameValues returns an array of possible values for the AzureSkuName const type. func PossibleAzureSkuNameValues() []AzureSkuName { - return []AzureSkuName{D11V2, D12V2, D13V2, D14V2, L16, L4, L8} + return []AzureSkuName{DevNoSLAStandardD11V2, StandardD11V2, StandardD12V2, StandardD13V2, StandardD14V2, StandardDS13V21TBPS, StandardDS13V22TBPS, StandardDS14V23TBPS, StandardDS14V24TBPS, StandardL16s, StandardL4s, StandardL8s} +} + +// AzureSkuTier enumerates the values for azure sku tier. +type AzureSkuTier string + +const ( + // Basic ... + Basic AzureSkuTier = "Basic" + // Standard ... + Standard AzureSkuTier = "Standard" +) + +// PossibleAzureSkuTierValues returns an array of possible values for the AzureSkuTier const type. +func PossibleAzureSkuTierValues() []AzureSkuTier { + return []AzureSkuTier{Basic, Standard} } // DatabasePrincipalRole enumerates the values for database principal role. @@ -148,18 +173,35 @@ func PossibleDataFormatValues() []DataFormat { // Kind enumerates the values for kind. type Kind string +const ( + // KindDatabase ... + KindDatabase Kind = "Database" + // KindReadOnlyAttached ... + KindReadOnlyAttached Kind = "ReadOnlyAttached" + // KindReadWrite ... + KindReadWrite Kind = "ReadWrite" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindDatabase, KindReadOnlyAttached, KindReadWrite} +} + +// KindBasicDataConnection enumerates the values for kind basic data connection. +type KindBasicDataConnection string + const ( // KindDataConnection ... - KindDataConnection Kind = "DataConnection" + KindDataConnection KindBasicDataConnection = "DataConnection" // KindEventGrid ... - KindEventGrid Kind = "EventGrid" + KindEventGrid KindBasicDataConnection = "EventGrid" // KindEventHub ... - KindEventHub Kind = "EventHub" + KindEventHub KindBasicDataConnection = "EventHub" ) -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindDataConnection, KindEventGrid, KindEventHub} +// PossibleKindBasicDataConnectionValues returns an array of possible values for the KindBasicDataConnection const type. +func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { + return []KindBasicDataConnection{KindDataConnection, KindEventGrid, KindEventHub} } // ProvisioningState enumerates the values for provisioning state. @@ -172,6 +214,8 @@ const ( Deleting ProvisioningState = "Deleting" // Failed ... Failed ProvisioningState = "Failed" + // Moving ... + Moving ProvisioningState = "Moving" // Running ... Running ProvisioningState = "Running" // Succeeded ... @@ -180,7 +224,7 @@ const ( // PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{Creating, Deleting, Failed, Running, Succeeded} + return []ProvisioningState{Creating, Deleting, Failed, Moving, Running, Succeeded} } // Reason enumerates the values for reason. @@ -227,6 +271,178 @@ func PossibleStateValues() []State { return []State{StateCreating, StateDeleted, StateDeleting, StateRunning, StateStarting, StateStopped, StateStopping, StateUnavailable, StateUpdating} } +// Type enumerates the values for type. +type Type string + +const ( + // MicrosoftKustoclustersattachedDatabaseConfigurations ... + MicrosoftKustoclustersattachedDatabaseConfigurations Type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" + // MicrosoftKustoclustersdatabases ... + MicrosoftKustoclustersdatabases Type = "Microsoft.Kusto/clusters/databases" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{MicrosoftKustoclustersattachedDatabaseConfigurations, MicrosoftKustoclustersdatabases} +} + +// AttachedDatabaseConfiguration class representing an attached database configuration. +type AttachedDatabaseConfiguration struct { + autorest.Response `json:"-"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // AttachedDatabaseConfigurationProperties - The properties of the attached database configuration. + *AttachedDatabaseConfigurationProperties `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 AttachedDatabaseConfiguration. +func (adc AttachedDatabaseConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adc.Location != nil { + objectMap["location"] = adc.Location + } + if adc.AttachedDatabaseConfigurationProperties != nil { + objectMap["properties"] = adc.AttachedDatabaseConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AttachedDatabaseConfiguration struct. +func (adc *AttachedDatabaseConfiguration) 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 "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + adc.Location = &location + } + case "properties": + if v != nil { + var attachedDatabaseConfigurationProperties AttachedDatabaseConfigurationProperties + err = json.Unmarshal(*v, &attachedDatabaseConfigurationProperties) + if err != nil { + return err + } + adc.AttachedDatabaseConfigurationProperties = &attachedDatabaseConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + adc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + adc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + adc.Type = &typeVar + } + } + } + + return nil +} + +// AttachedDatabaseConfigurationListResult the list attached database configurations operation response. +type AttachedDatabaseConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - The list of attached database configurations. + Value *[]AttachedDatabaseConfiguration `json:"value,omitempty"` +} + +// AttachedDatabaseConfigurationProperties class representing the an attached database configuration +// properties of kind specific. +type AttachedDatabaseConfigurationProperties struct { + // DatabaseName - The name of the database which you would like to attach, use * if you want to follow all current and future databases. + DatabaseName *string `json:"databaseName,omitempty"` + // ClusterResourceID - The resource id of the cluster where the databases you would like to attach reside. + ClusterResourceID *string `json:"clusterResourceId,omitempty"` + // AttachedDatabaseNames - READ-ONLY; The list of databases from the clusterResourceId which are currently attached to the cluster. + AttachedDatabaseNames *[]string `json:"attachedDatabaseNames,omitempty"` +} + +// AttachedDatabaseConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type AttachedDatabaseConfigurationsCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *AttachedDatabaseConfigurationsCreateOrUpdateFuture) Result(client AttachedDatabaseConfigurationsClient) (adc AttachedDatabaseConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if adc.Response.Response, err = future.GetResult(sender); err == nil && adc.Response.Response.StatusCode != http.StatusNoContent { + adc, err = client.CreateOrUpdateResponder(adc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsCreateOrUpdateFuture", "Result", adc.Response.Response, "Failure responding to request") + } + } + return +} + +// AttachedDatabaseConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AttachedDatabaseConfigurationsDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *AttachedDatabaseConfigurationsDeleteFuture) Result(client AttachedDatabaseConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.AttachedDatabaseConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.AttachedDatabaseConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + // AzureCapacity azure capacity definition. type AzureCapacity struct { // ScaleType - Scale type. Possible values include: 'Automatic', 'Manual', 'None' @@ -263,12 +479,20 @@ type AzureResourceSku struct { // AzureSku azure SKU definition. type AzureSku struct { - // Name - SKU name. Possible values include: 'D13V2', 'D14V2', 'L8', 'L16', 'D11V2', 'D12V2', 'L4' + // Name - SKU name. Possible values include: 'StandardDS13V21TBPS', 'StandardDS13V22TBPS', 'StandardDS14V23TBPS', 'StandardDS14V24TBPS', 'StandardD13V2', 'StandardD14V2', 'StandardL8s', 'StandardL16s', 'StandardD11V2', 'StandardD12V2', 'StandardL4s', 'DevNoSLAStandardD11V2' Name AzureSkuName `json:"name,omitempty"` // Capacity - SKU capacity. Capacity *int32 `json:"capacity,omitempty"` - // Tier - SKU tier. - Tier *string `json:"tier,omitempty"` + // Tier - SKU tier. Possible values include: 'Basic', 'Standard' + Tier AzureSkuTier `json:"tier,omitempty"` +} + +// CheckNameRequest the result returned from a database check name availability request. +type CheckNameRequest struct { + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, for instance Microsoft.Kusto/clusters/databases. Possible values include: 'MicrosoftKustoclustersdatabases', 'MicrosoftKustoclustersattachedDatabaseConfigurations' + Type Type `json:"type,omitempty"` } // CheckNameResult the result returned from a check name availability request. @@ -436,7 +660,7 @@ type ClusterListResult struct { type ClusterProperties struct { // State - READ-ONLY; The state of the resource. Possible values include: 'StateCreating', 'StateUnavailable', 'StateRunning', 'StateDeleting', 'StateDeleted', 'StateStopping', 'StateStopped', 'StateStarting', 'StateUpdating' State State `json:"state,omitempty"` - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed' + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` // URI - READ-ONLY; The cluster URI. URI *string `json:"uri,omitempty"` @@ -444,6 +668,8 @@ type ClusterProperties struct { DataIngestionURI *string `json:"dataIngestionUri,omitempty"` // TrustedExternalTenants - The cluster's external tenants. TrustedExternalTenants *[]TrustedExternalTenant `json:"trustedExternalTenants,omitempty"` + // IntelligentAutoscale - Intelligent auto scale definition. + IntelligentAutoscale *IntelligentAutoscale `json:"intelligentAutoscale,omitempty"` } // ClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running @@ -686,13 +912,20 @@ func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { return nil } +// BasicDatabase class representing a Kusto database. +type BasicDatabase interface { + AsReadWriteDatabase() (*ReadWriteDatabase, bool) + AsReadOnlyAttachedDatabase() (*ReadOnlyAttachedDatabase, bool) + AsDatabase() (*Database, bool) +} + // Database class representing a Kusto database. type Database struct { autorest.Response `json:"-"` // Location - Resource location. Location *string `json:"location,omitempty"` - // DatabaseProperties - The database properties. - *DatabaseProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyAttached' + Kind Kind `json:"kind,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 @@ -701,20 +934,89 @@ type Database struct { Type *string `json:"type,omitempty"` } +func unmarshalBasicDatabase(body []byte) (BasicDatabase, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindReadWrite): + var rwd ReadWriteDatabase + err := json.Unmarshal(body, &rwd) + return rwd, err + case string(KindReadOnlyAttached): + var road ReadOnlyAttachedDatabase + err := json.Unmarshal(body, &road) + return road, err + default: + var d Database + err := json.Unmarshal(body, &d) + return d, err + } +} +func unmarshalBasicDatabaseArray(body []byte) ([]BasicDatabase, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + dArray := make([]BasicDatabase, len(rawMessages)) + + for index, rawMessage := range rawMessages { + d, err := unmarshalBasicDatabase(*rawMessage) + if err != nil { + return nil, err + } + dArray[index] = d + } + return dArray, nil +} + // MarshalJSON is the custom marshaler for Database. func (d Database) MarshalJSON() ([]byte, error) { + d.Kind = KindDatabase objectMap := make(map[string]interface{}) if d.Location != nil { objectMap["location"] = d.Location } - if d.DatabaseProperties != nil { - objectMap["properties"] = d.DatabaseProperties + if d.Kind != "" { + objectMap["kind"] = d.Kind } return json.Marshal(objectMap) } -// UnmarshalJSON is the custom unmarshaler for Database struct. -func (d *Database) UnmarshalJSON(body []byte) error { +// AsReadWriteDatabase is the BasicDatabase implementation for Database. +func (d Database) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return nil, false +} + +// AsReadOnlyAttachedDatabase is the BasicDatabase implementation for Database. +func (d Database) AsReadOnlyAttachedDatabase() (*ReadOnlyAttachedDatabase, bool) { + return nil, false +} + +// AsDatabase is the BasicDatabase implementation for Database. +func (d Database) AsDatabase() (*Database, bool) { + return &d, true +} + +// AsBasicDatabase is the BasicDatabase implementation for Database. +func (d Database) AsBasicDatabase() (BasicDatabase, bool) { + return &d, true +} + +// DatabaseListResult the list Kusto databases operation response. +type DatabaseListResult struct { + autorest.Response `json:"-"` + // Value - The list of Kusto databases. + Value *[]BasicDatabase `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for DatabaseListResult struct. +func (dlr *DatabaseListResult) UnmarshalJSON(body []byte) error { var m map[string]*json.RawMessage err := json.Unmarshal(body, &m) if err != nil { @@ -722,50 +1024,13 @@ func (d *Database) UnmarshalJSON(body []byte) error { } for k, v := range m { switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - d.Location = &location - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - d.DatabaseProperties = &databaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - d.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - d.Name = &name - } - case "type": + case "value": if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) + value, err := unmarshalBasicDatabaseArray(*v) if err != nil { return err } - d.Type = &typeVar + dlr.Value = &value } } } @@ -773,19 +1038,21 @@ func (d *Database) UnmarshalJSON(body []byte) error { return nil } -// DatabaseCheckNameRequest the result returned from a database check name availability request. -type DatabaseCheckNameRequest struct { - // Name - Database name. - Name *string `json:"name,omitempty"` - // Type - The type of resource, Microsoft.Kusto/clusters/databases. - Type *string `json:"type,omitempty"` +// DatabaseModel ... +type DatabaseModel struct { + autorest.Response `json:"-"` + Value BasicDatabase `json:"value,omitempty"` } -// DatabaseListResult the list Kusto databases operation response. -type DatabaseListResult struct { - autorest.Response `json:"-"` - // Value - The list of Kusto databases. - Value *[]Database `json:"value,omitempty"` +// UnmarshalJSON is the custom unmarshaler for DatabaseModel struct. +func (dm *DatabaseModel) UnmarshalJSON(body []byte) error { + d, err := unmarshalBasicDatabase(body) + if err != nil { + return err + } + dm.Value = d + + return nil } // DatabasePrincipal a class representing database principal entity. @@ -817,18 +1084,6 @@ type DatabasePrincipalListResult struct { Value *[]DatabasePrincipal `json:"value,omitempty"` } -// DatabaseProperties class representing the Kusto database properties. -type DatabaseProperties struct { - // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` - // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. - SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` - // HotCachePeriod - The time the data that should be kept in cache for fast queries in TimeSpan. - HotCachePeriod *string `json:"hotCachePeriod,omitempty"` - // Statistics - The statistics of the database. - Statistics *DatabaseStatistics `json:"statistics,omitempty"` -} - // DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type DatabasesCreateOrUpdateFuture struct { @@ -837,7 +1092,7 @@ type DatabasesCreateOrUpdateFuture struct { // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d Database, err error) { +func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (dm DatabaseModel, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { @@ -849,10 +1104,10 @@ func (future *DatabasesCreateOrUpdateFuture) Result(client DatabasesClient) (d D return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.CreateOrUpdateResponder(d.Response.Response) + if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { + dm, err = client.CreateOrUpdateResponder(dm.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "kusto.DatabasesCreateOrUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") } } return @@ -895,7 +1150,7 @@ type DatabasesUpdateFuture struct { // Result returns the result of the asynchronous operation. // If the operation has not completed it will return an error. -func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, err error) { +func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (dm DatabaseModel, err error) { var done bool done, err = future.DoneWithContext(context.Background(), client) if err != nil { @@ -907,21 +1162,29 @@ func (future *DatabasesUpdateFuture) Result(client DatabasesClient) (d Database, return } sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { - d, err = client.UpdateResponder(d.Response.Response) + if dm.Response.Response, err = future.GetResult(sender); err == nil && dm.Response.Response.StatusCode != http.StatusNoContent { + dm, err = client.UpdateResponder(dm.Response.Response) if err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", dm.Response.Response, "Failure responding to request") } } return } -// DatabaseUpdate class representing an update to a Kusto database. -type DatabaseUpdate struct { +// BasicDataConnection class representing an data connection. +type BasicDataConnection interface { + AsEventHubDataConnection() (*EventHubDataConnection, bool) + AsEventGridDataConnection() (*EventGridDataConnection, bool) + AsDataConnection() (*DataConnection, bool) +} + +// DataConnection class representing an data connection. +type DataConnection struct { + autorest.Response `json:"-"` // Location - Resource location. Location *string `json:"location,omitempty"` - // DatabaseProperties - The properties of the updated database. - *DatabaseProperties `json:"properties,omitempty"` + // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' + Kind KindBasicDataConnection `json:"kind,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 @@ -930,105 +1193,11 @@ type DatabaseUpdate struct { Type *string `json:"type,omitempty"` } -// MarshalJSON is the custom marshaler for DatabaseUpdate. -func (du DatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if du.Location != nil { - objectMap["location"] = du.Location - } - if du.DatabaseProperties != nil { - objectMap["properties"] = du.DatabaseProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for DatabaseUpdate struct. -func (du *DatabaseUpdate) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage +func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) { + var m map[string]interface{} err := json.Unmarshal(body, &m) if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - du.Location = &location - } - case "properties": - if v != nil { - var databaseProperties DatabaseProperties - err = json.Unmarshal(*v, &databaseProperties) - if err != nil { - return err - } - du.DatabaseProperties = &databaseProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - du.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - du.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - du.Type = &typeVar - } - } - } - - return nil -} - -// BasicDataConnection class representing an data connection. -type BasicDataConnection interface { - AsEventHubDataConnection() (*EventHubDataConnection, bool) - AsEventGridDataConnection() (*EventGridDataConnection, bool) - AsDataConnection() (*DataConnection, bool) -} - -// DataConnection class representing an data connection. -type DataConnection struct { - autorest.Response `json:"-"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' - Kind Kind `json:"kind,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"` -} - -func unmarshalBasicDataConnection(body []byte) (BasicDataConnection, error) { - var m map[string]interface{} - err := json.Unmarshal(body, &m) - if err != nil { - return nil, err + return nil, err } switch m["kind"] { @@ -1311,7 +1480,7 @@ type EventGridDataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' - Kind Kind `json:"kind,omitempty"` + Kind KindBasicDataConnection `json:"kind,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 @@ -1385,7 +1554,7 @@ func (egdc *EventGridDataConnection) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind Kind + var kind KindBasicDataConnection err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -1446,7 +1615,7 @@ type EventHubDataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindEventGrid' - Kind Kind `json:"kind,omitempty"` + Kind KindBasicDataConnection `json:"kind,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 @@ -1520,7 +1689,7 @@ func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { } case "kind": if v != nil { - var kind Kind + var kind KindBasicDataConnection err = json.Unmarshal(*v, &kind) if err != nil { return err @@ -1560,18 +1729,44 @@ func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { return nil } -// ListResourceSkusResult list of available SKUs for an existing Kusto Cluster. -type ListResourceSkusResult struct { +// FollowerDatabaseListResult the list Kusto database principals operation response. +type FollowerDatabaseListResult struct { autorest.Response `json:"-"` - // Value - The collection of available SKUs for an existing resource. - Value *[]AzureResourceSku `json:"value,omitempty"` + // Value - The list of follower database result. + Value *[]FollowerDatabaseResult `json:"value,omitempty"` } -// ListSkusResult list of available SKUs for a new Kusto Cluster. -type ListSkusResult struct { +// FollowerDatabaseRequest a class representing follower database request. +type FollowerDatabaseRequest struct { + // ClusterResourceID - Resource id of the cluster that follows a database owned by this cluster. + ClusterResourceID *string `json:"clusterResourceId,omitempty"` + // DatabaseName - The database name owned by this cluster that was followed. * in case following all databases. + DatabaseName *string `json:"databaseName,omitempty"` +} + +// FollowerDatabaseResult a class representing database principal entity. +type FollowerDatabaseResult struct { + // ClusterResourceID - List of resource ids of clusters that are following the database owned by this cluster. + ClusterResourceID *[]string `json:"clusterResourceId,omitempty"` + // DatabaseName - The database name owned by this cluster that was followed. * in case following all databases. + DatabaseName *string `json:"databaseName,omitempty"` +} + +// IntelligentAutoscale a class that contains the intelligent auto scale definition. +type IntelligentAutoscale struct { + // Version - The version of the template defined, for instance 1. + Version *int32 `json:"version,omitempty"` + // Minimum - Minimum allowed capacity. + Minimum *int32 `json:"minimum,omitempty"` + // Maximum - Maximum allowed capacity. + Maximum *int32 `json:"maximum,omitempty"` +} + +// ListResourceSkusResult list of available SKUs for a Kusto Cluster. +type ListResourceSkusResult struct { autorest.Response `json:"-"` - // Value - The collection of available SKUs for new resources. - Value *[]AzureSku `json:"value,omitempty"` + // Value - The collection of available SKUs for an existing resource. + Value *[]AzureResourceSku `json:"value,omitempty"` } // Operation ... @@ -1747,6 +1942,272 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } +// ReadOnlyAttachedDatabase class representing a read only attached database. +type ReadOnlyAttachedDatabase struct { + // ReadOnlyAttachedDatabaseProperties - The database properties. + *ReadOnlyAttachedDatabaseProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyAttached' + Kind Kind `json:"kind,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 ReadOnlyAttachedDatabase. +func (road ReadOnlyAttachedDatabase) MarshalJSON() ([]byte, error) { + road.Kind = KindReadOnlyAttached + objectMap := make(map[string]interface{}) + if road.ReadOnlyAttachedDatabaseProperties != nil { + objectMap["properties"] = road.ReadOnlyAttachedDatabaseProperties + } + if road.Location != nil { + objectMap["location"] = road.Location + } + if road.Kind != "" { + objectMap["kind"] = road.Kind + } + return json.Marshal(objectMap) +} + +// AsReadWriteDatabase is the BasicDatabase implementation for ReadOnlyAttachedDatabase. +func (road ReadOnlyAttachedDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return nil, false +} + +// AsReadOnlyAttachedDatabase is the BasicDatabase implementation for ReadOnlyAttachedDatabase. +func (road ReadOnlyAttachedDatabase) AsReadOnlyAttachedDatabase() (*ReadOnlyAttachedDatabase, bool) { + return &road, true +} + +// AsDatabase is the BasicDatabase implementation for ReadOnlyAttachedDatabase. +func (road ReadOnlyAttachedDatabase) AsDatabase() (*Database, bool) { + return nil, false +} + +// AsBasicDatabase is the BasicDatabase implementation for ReadOnlyAttachedDatabase. +func (road ReadOnlyAttachedDatabase) AsBasicDatabase() (BasicDatabase, bool) { + return &road, true +} + +// UnmarshalJSON is the custom unmarshaler for ReadOnlyAttachedDatabase struct. +func (road *ReadOnlyAttachedDatabase) 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 readOnlyAttachedDatabaseProperties ReadOnlyAttachedDatabaseProperties + err = json.Unmarshal(*v, &readOnlyAttachedDatabaseProperties) + if err != nil { + return err + } + road.ReadOnlyAttachedDatabaseProperties = &readOnlyAttachedDatabaseProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + road.Location = &location + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + road.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + road.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + road.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + road.Type = &typeVar + } + } + } + + return nil +} + +// ReadOnlyAttachedDatabaseProperties class representing the Kusto database properties. +type ReadOnlyAttachedDatabaseProperties struct { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SoftDeletePeriod - READ-ONLY; The time the data should be kept before it stops being accessible to queries in TimeSpan. + SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` + // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. + HotCachePeriod *string `json:"hotCachePeriod,omitempty"` + // Statistics - The statistics of the database. + Statistics *DatabaseStatistics `json:"statistics,omitempty"` +} + +// ReadWriteDatabase class representing a read write database. +type ReadWriteDatabase struct { + // ReadWriteDatabaseProperties - The database properties. + *ReadWriteDatabaseProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyAttached' + Kind Kind `json:"kind,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 ReadWriteDatabase. +func (rwd ReadWriteDatabase) MarshalJSON() ([]byte, error) { + rwd.Kind = KindReadWrite + objectMap := make(map[string]interface{}) + if rwd.ReadWriteDatabaseProperties != nil { + objectMap["properties"] = rwd.ReadWriteDatabaseProperties + } + if rwd.Location != nil { + objectMap["location"] = rwd.Location + } + if rwd.Kind != "" { + objectMap["kind"] = rwd.Kind + } + return json.Marshal(objectMap) +} + +// AsReadWriteDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return &rwd, true +} + +// AsReadOnlyAttachedDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsReadOnlyAttachedDatabase() (*ReadOnlyAttachedDatabase, bool) { + return nil, false +} + +// AsDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsDatabase() (*Database, bool) { + return nil, false +} + +// AsBasicDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsBasicDatabase() (BasicDatabase, bool) { + return &rwd, true +} + +// UnmarshalJSON is the custom unmarshaler for ReadWriteDatabase struct. +func (rwd *ReadWriteDatabase) 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 readWriteDatabaseProperties ReadWriteDatabaseProperties + err = json.Unmarshal(*v, &readWriteDatabaseProperties) + if err != nil { + return err + } + rwd.ReadWriteDatabaseProperties = &readWriteDatabaseProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rwd.Location = &location + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rwd.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rwd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rwd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rwd.Type = &typeVar + } + } + } + + return nil +} + +// ReadWriteDatabaseProperties class representing the Kusto database properties. +type ReadWriteDatabaseProperties struct { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SoftDeletePeriod - The time the data should be kept before it stops being accessible to queries in TimeSpan. + SoftDeletePeriod *string `json:"softDeletePeriod,omitempty"` + // HotCachePeriod - The time the data should be kept in cache for fast queries in TimeSpan. + HotCachePeriod *string `json:"hotCachePeriod,omitempty"` + // Statistics - The statistics of the database. + Statistics *DatabaseStatistics `json:"statistics,omitempty"` +} + // Resource ... type Resource struct { // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -1757,6 +2218,37 @@ type Resource struct { Type *string `json:"type,omitempty"` } +// SkuDescription the Kusto SKU description of given resource type +type SkuDescription struct { + // ResourceType - READ-ONLY; The resource type + ResourceType *string `json:"resourceType,omitempty"` + // Name - READ-ONLY; The name of the SKU + Name *string `json:"name,omitempty"` + // Tier - READ-ONLY; The tier of the SKU + Tier *string `json:"tier,omitempty"` + // Locations - READ-ONLY; The set of locations that the SKU is available + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - READ-ONLY; Locations and zones + LocationInfo *[]SkuLocationInfoItem `json:"locationInfo,omitempty"` + // Restrictions - READ-ONLY; The restrictions because of which SKU cannot be used + Restrictions *[]interface{} `json:"restrictions,omitempty"` +} + +// SkuDescriptionList the list of the Kusto SKU descriptions +type SkuDescriptionList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; SKU descriptions + Value *[]SkuDescription `json:"value,omitempty"` +} + +// SkuLocationInfoItem the locations and zones info for SKU. +type SkuLocationInfoItem struct { + // Location - The available location of the SKU. + Location *string `json:"location,omitempty"` + // Zones - The available zone of the SKU. + Zones *[]string `json:"zones,omitempty"` +} + // TrackedResource the resource model definition for a ARM tracked top level resource type TrackedResource struct { // Tags - Resource tags.