diff --git a/profiles/latest/kusto/mgmt/kusto/kustoapi/models.go b/profiles/latest/kusto/mgmt/kusto/kustoapi/models.go index 565d3ef1fd78..25b871538b2d 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-09-07/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 886436c97525..917855cd280e 100644 --- a/profiles/latest/kusto/mgmt/kusto/models.go +++ b/profiles/latest/kusto/mgmt/kusto/models.go @@ -97,6 +97,14 @@ const ( DatabasePrincipalTypeUser DatabasePrincipalType = original.DatabasePrincipalTypeUser ) +type DefaultPrincipalsModificationKind = original.DefaultPrincipalsModificationKind + +const ( + DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = original.DefaultPrincipalsModificationKindNone + DefaultPrincipalsModificationKindReplace DefaultPrincipalsModificationKind = original.DefaultPrincipalsModificationKindReplace + DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = original.DefaultPrincipalsModificationKindUnion +) + type IdentityType = original.IdentityType const ( @@ -107,10 +115,26 @@ const ( type Kind = original.Kind const ( - KindDataConnection Kind = original.KindDataConnection - KindEventGrid Kind = original.KindEventGrid - KindEventHub Kind = original.KindEventHub - KindIotHub Kind = original.KindIotHub + KindDatabase Kind = original.KindDatabase + KindReadOnlyFollowing Kind = original.KindReadOnlyFollowing + KindReadWrite Kind = original.KindReadWrite +) + +type KindBasicDataConnection = original.KindBasicDataConnection + +const ( + KindDataConnection KindBasicDataConnection = original.KindDataConnection + KindEventGrid KindBasicDataConnection = original.KindEventGrid + KindEventHub KindBasicDataConnection = original.KindEventHub + KindIotHub KindBasicDataConnection = original.KindIotHub +) + +type PrincipalsModificationKind = original.PrincipalsModificationKind + +const ( + PrincipalsModificationKindNone PrincipalsModificationKind = original.PrincipalsModificationKindNone + PrincipalsModificationKindReplace PrincipalsModificationKind = original.PrincipalsModificationKindReplace + PrincipalsModificationKindUnion PrincipalsModificationKind = original.PrincipalsModificationKindUnion ) type ProvisioningState = original.ProvisioningState @@ -145,12 +169,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 @@ -162,6 +201,7 @@ type ClusterUpdate = original.ClusterUpdate type ClustersClient = original.ClustersClient type ClustersCreateOrUpdateFuture = original.ClustersCreateOrUpdateFuture type ClustersDeleteFuture = original.ClustersDeleteFuture +type ClustersDetachFollowerDatabasesFuture = original.ClustersDetachFollowerDatabasesFuture type ClustersStartFuture = original.ClustersStartFuture type ClustersStopFuture = original.ClustersStopFuture type ClustersUpdateFuture = original.ClustersUpdateFuture @@ -177,14 +217,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 @@ -193,6 +231,8 @@ type EventGridConnectionProperties = original.EventGridConnectionProperties type EventGridDataConnection = original.EventGridDataConnection type EventHubConnectionProperties = original.EventHubConnectionProperties type EventHubDataConnection = original.EventHubDataConnection +type FollowerDatabaseDefinition = original.FollowerDatabaseDefinition +type FollowerDatabaseListResult = original.FollowerDatabaseListResult type Identity = original.Identity type IdentityUserAssignedIdentitiesValue = original.IdentityUserAssignedIdentitiesValue type IotHubConnectionProperties = original.IotHubConnectionProperties @@ -207,6 +247,10 @@ type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type OptimizedAutoscale = original.OptimizedAutoscale type ProxyResource = original.ProxyResource +type ReadOnlyFollowingDatabase = original.ReadOnlyFollowingDatabase +type ReadOnlyFollowingDatabaseProperties = original.ReadOnlyFollowingDatabaseProperties +type ReadWriteDatabase = original.ReadWriteDatabase +type ReadWriteDatabaseProperties = original.ReadWriteDatabaseProperties type Resource = original.Resource type SkuDescription = original.SkuDescription type SkuDescriptionList = original.SkuDescriptionList @@ -218,6 +262,12 @@ type VirtualNetworkConfiguration = original.VirtualNetworkConfiguration 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) } @@ -269,12 +319,21 @@ func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { return original.PossibleDatabasePrincipalTypeValues() } +func PossibleDefaultPrincipalsModificationKindValues() []DefaultPrincipalsModificationKind { + return original.PossibleDefaultPrincipalsModificationKindValues() +} func PossibleIdentityTypeValues() []IdentityType { return original.PossibleIdentityTypeValues() } +func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { + return original.PossibleKindBasicDataConnectionValues() +} func PossibleKindValues() []Kind { return original.PossibleKindValues() } +func PossiblePrincipalsModificationKindValues() []PrincipalsModificationKind { + return original.PossiblePrincipalsModificationKindValues() +} func PossibleProvisioningStateValues() []ProvisioningState { return original.PossibleProvisioningStateValues() } @@ -284,6 +343,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 565d3ef1fd78..25b871538b2d 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-09-07/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 ed005655cbd0..0683433aa011 100644 --- a/profiles/preview/kusto/mgmt/kusto/models.go +++ b/profiles/preview/kusto/mgmt/kusto/models.go @@ -97,6 +97,14 @@ const ( DatabasePrincipalTypeUser DatabasePrincipalType = original.DatabasePrincipalTypeUser ) +type DefaultPrincipalsModificationKind = original.DefaultPrincipalsModificationKind + +const ( + DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = original.DefaultPrincipalsModificationKindNone + DefaultPrincipalsModificationKindReplace DefaultPrincipalsModificationKind = original.DefaultPrincipalsModificationKindReplace + DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = original.DefaultPrincipalsModificationKindUnion +) + type IdentityType = original.IdentityType const ( @@ -107,10 +115,26 @@ const ( type Kind = original.Kind const ( - KindDataConnection Kind = original.KindDataConnection - KindEventGrid Kind = original.KindEventGrid - KindEventHub Kind = original.KindEventHub - KindIotHub Kind = original.KindIotHub + KindDatabase Kind = original.KindDatabase + KindReadOnlyFollowing Kind = original.KindReadOnlyFollowing + KindReadWrite Kind = original.KindReadWrite +) + +type KindBasicDataConnection = original.KindBasicDataConnection + +const ( + KindDataConnection KindBasicDataConnection = original.KindDataConnection + KindEventGrid KindBasicDataConnection = original.KindEventGrid + KindEventHub KindBasicDataConnection = original.KindEventHub + KindIotHub KindBasicDataConnection = original.KindIotHub +) + +type PrincipalsModificationKind = original.PrincipalsModificationKind + +const ( + PrincipalsModificationKindNone PrincipalsModificationKind = original.PrincipalsModificationKindNone + PrincipalsModificationKindReplace PrincipalsModificationKind = original.PrincipalsModificationKindReplace + PrincipalsModificationKindUnion PrincipalsModificationKind = original.PrincipalsModificationKindUnion ) type ProvisioningState = original.ProvisioningState @@ -145,12 +169,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 @@ -162,6 +201,7 @@ type ClusterUpdate = original.ClusterUpdate type ClustersClient = original.ClustersClient type ClustersCreateOrUpdateFuture = original.ClustersCreateOrUpdateFuture type ClustersDeleteFuture = original.ClustersDeleteFuture +type ClustersDetachFollowerDatabasesFuture = original.ClustersDetachFollowerDatabasesFuture type ClustersStartFuture = original.ClustersStartFuture type ClustersStopFuture = original.ClustersStopFuture type ClustersUpdateFuture = original.ClustersUpdateFuture @@ -177,14 +217,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 @@ -193,6 +231,8 @@ type EventGridConnectionProperties = original.EventGridConnectionProperties type EventGridDataConnection = original.EventGridDataConnection type EventHubConnectionProperties = original.EventHubConnectionProperties type EventHubDataConnection = original.EventHubDataConnection +type FollowerDatabaseDefinition = original.FollowerDatabaseDefinition +type FollowerDatabaseListResult = original.FollowerDatabaseListResult type Identity = original.Identity type IdentityUserAssignedIdentitiesValue = original.IdentityUserAssignedIdentitiesValue type IotHubConnectionProperties = original.IotHubConnectionProperties @@ -207,6 +247,10 @@ type OperationListResultPage = original.OperationListResultPage type OperationsClient = original.OperationsClient type OptimizedAutoscale = original.OptimizedAutoscale type ProxyResource = original.ProxyResource +type ReadOnlyFollowingDatabase = original.ReadOnlyFollowingDatabase +type ReadOnlyFollowingDatabaseProperties = original.ReadOnlyFollowingDatabaseProperties +type ReadWriteDatabase = original.ReadWriteDatabase +type ReadWriteDatabaseProperties = original.ReadWriteDatabaseProperties type Resource = original.Resource type SkuDescription = original.SkuDescription type SkuDescriptionList = original.SkuDescriptionList @@ -218,6 +262,12 @@ type VirtualNetworkConfiguration = original.VirtualNetworkConfiguration 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) } @@ -269,12 +319,21 @@ func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { return original.PossibleDatabasePrincipalTypeValues() } +func PossibleDefaultPrincipalsModificationKindValues() []DefaultPrincipalsModificationKind { + return original.PossibleDefaultPrincipalsModificationKindValues() +} func PossibleIdentityTypeValues() []IdentityType { return original.PossibleIdentityTypeValues() } +func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { + return original.PossibleKindBasicDataConnectionValues() +} func PossibleKindValues() []Kind { return original.PossibleKindValues() } +func PossiblePrincipalsModificationKindValues() []PrincipalsModificationKind { + return original.PossiblePrincipalsModificationKindValues() +} func PossibleProvisioningStateValues() []ProvisioningState { return original.PossibleProvisioningStateValues() } @@ -284,6 +343,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-09-07/kusto/attacheddatabaseconfigurations.go b/services/kusto/mgmt/2019-09-07/kusto/attacheddatabaseconfigurations.go new file mode 100644 index 000000000000..c2d6c459235b --- /dev/null +++ b/services/kusto/mgmt/2019-09-07/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-09-07" + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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-09-07" + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + 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-09-07" + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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-09-07" + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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-09-07/kusto/clusters.go b/services/kusto/mgmt/2019-09-07/kusto/clusters.go index 98cb6de1bab6..3d5a6c656874 100644 --- a/services/kusto/mgmt/2019-09-07/kusto/clusters.go +++ b/services/kusto/mgmt/2019-09-07/kusto/clusters.go @@ -308,6 +308,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 - the follower databases properties to remove. +func (client ClustersClient) DetachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition) (result ClustersDetachFollowerDatabasesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClustersClient.DetachFollowerDatabases") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.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.AttachedDatabaseConfigurationName", 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 + } + + result, err = client.DetachFollowerDatabasesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersClient", "DetachFollowerDatabases", result.Response(), "Failure sending request") + return + } + + return +} + +// DetachFollowerDatabasesPreparer prepares the DetachFollowerDatabases request. +func (client ClustersClient) DetachFollowerDatabasesPreparer(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition) (*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-09-07" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + followerDatabaseToRemove.DatabaseName = nil + 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) (future ClustersDetachFollowerDatabasesFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DetachFollowerDatabasesResponder handles the response to the DetachFollowerDatabases request. The method always +// closes the http.Response Body. +func (client ClustersClient) DetachFollowerDatabasesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // Get gets a Kusto cluster. // Parameters: // resourceGroupName - the name of the resource group containing the Kusto cluster. @@ -532,6 +619,84 @@ 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-09-07" + 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) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// 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 SkuDescriptionList, err error) { if tracing.IsEnabled() { diff --git a/services/kusto/mgmt/2019-09-07/kusto/databases.go b/services/kusto/mgmt/2019-09-07/kusto/databases.go index a1100f1badaa..f9f67be0601a 100644 --- a/services/kusto/mgmt/2019-09-07/kusto/databases.go +++ b/services/kusto/mgmt/2019-09-07/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-09-07/kusto/kustoapi/interfaces.go b/services/kusto/mgmt/2019-09-07/kusto/kustoapi/interfaces.go index 57504b4f6ca8..32763ab216ba 100644 --- a/services/kusto/mgmt/2019-09-07/kusto/kustoapi/interfaces.go +++ b/services/kusto/mgmt/2019-09-07/kusto/kustoapi/interfaces.go @@ -27,9 +27,11 @@ 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.FollowerDatabaseDefinition) (result kusto.ClustersDetachFollowerDatabasesFuture, 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) + 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) @@ -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-09-07/kusto/models.go b/services/kusto/mgmt/2019-09-07/kusto/models.go index 4195433ddc71..982aec753533 100644 --- a/services/kusto/mgmt/2019-09-07/kusto/models.go +++ b/services/kusto/mgmt/2019-09-07/kusto/models.go @@ -172,6 +172,23 @@ func PossibleDataFormatValues() []DataFormat { return []DataFormat{AVRO, CSV, JSON, MULTIJSON, PSV, RAW, SCSV, SINGLEJSON, SOHSV, TSV, TSVE, TXT} } +// DefaultPrincipalsModificationKind enumerates the values for default principals modification kind. +type DefaultPrincipalsModificationKind string + +const ( + // DefaultPrincipalsModificationKindNone ... + DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = "None" + // DefaultPrincipalsModificationKindReplace ... + DefaultPrincipalsModificationKindReplace DefaultPrincipalsModificationKind = "Replace" + // DefaultPrincipalsModificationKindUnion ... + DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = "Union" +) + +// PossibleDefaultPrincipalsModificationKindValues returns an array of possible values for the DefaultPrincipalsModificationKind const type. +func PossibleDefaultPrincipalsModificationKindValues() []DefaultPrincipalsModificationKind { + return []DefaultPrincipalsModificationKind{DefaultPrincipalsModificationKindNone, DefaultPrincipalsModificationKindReplace, DefaultPrincipalsModificationKindUnion} +} + // IdentityType enumerates the values for identity type. type IdentityType string @@ -190,20 +207,54 @@ func PossibleIdentityTypeValues() []IdentityType { // Kind enumerates the values for kind. type Kind string +const ( + // KindDatabase ... + KindDatabase Kind = "Database" + // KindReadOnlyFollowing ... + KindReadOnlyFollowing Kind = "ReadOnlyFollowing" + // KindReadWrite ... + KindReadWrite Kind = "ReadWrite" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindDatabase, KindReadOnlyFollowing, 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" // KindIotHub ... - KindIotHub Kind = "IotHub" + KindIotHub KindBasicDataConnection = "IotHub" ) -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindDataConnection, KindEventGrid, KindEventHub, KindIotHub} +// PossibleKindBasicDataConnectionValues returns an array of possible values for the KindBasicDataConnection const type. +func PossibleKindBasicDataConnectionValues() []KindBasicDataConnection { + return []KindBasicDataConnection{KindDataConnection, KindEventGrid, KindEventHub, KindIotHub} +} + +// PrincipalsModificationKind enumerates the values for principals modification kind. +type PrincipalsModificationKind string + +const ( + // PrincipalsModificationKindNone ... + PrincipalsModificationKindNone PrincipalsModificationKind = "None" + // PrincipalsModificationKindReplace ... + PrincipalsModificationKindReplace PrincipalsModificationKind = "Replace" + // PrincipalsModificationKindUnion ... + PrincipalsModificationKindUnion PrincipalsModificationKind = "Union" +) + +// PossiblePrincipalsModificationKindValues returns an array of possible values for the PrincipalsModificationKind const type. +func PossiblePrincipalsModificationKindValues() []PrincipalsModificationKind { + return []PrincipalsModificationKind{PrincipalsModificationKindNone, PrincipalsModificationKindReplace, PrincipalsModificationKindUnion} } // ProvisioningState enumerates the values for provisioning state. @@ -273,6 +324,182 @@ 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 { + // ProvisioningState - READ-ONLY; The provisioned state of the resource. Possible values include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed', 'Moving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // 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"` + // DefaultPrincipalsModificationKind - The default principals modification kind. Possible values include: 'DefaultPrincipalsModificationKindUnion', 'DefaultPrincipalsModificationKindReplace', 'DefaultPrincipalsModificationKindNone' + DefaultPrincipalsModificationKind DefaultPrincipalsModificationKind `json:"defaultPrincipalsModificationKind,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' @@ -317,6 +544,14 @@ type AzureSku struct { 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. type CheckNameResult struct { autorest.Response `json:"-"` @@ -582,6 +817,29 @@ func (future *ClustersDeleteFuture) Result(client ClustersClient) (ar autorest.R return } +// ClustersDetachFollowerDatabasesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ClustersDetachFollowerDatabasesFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *ClustersDetachFollowerDatabasesFuture) Result(client ClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kusto.ClustersDetachFollowerDatabasesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.ClustersDetachFollowerDatabasesFuture") + return + } + ar.Response = future.Response() + return +} + // ClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ClustersStartFuture struct { @@ -784,13 +1042,20 @@ func (cu *ClusterUpdate) UnmarshalJSON(body []byte) error { return nil } +// BasicDatabase class representing a Kusto database. +type BasicDatabase interface { + AsReadWriteDatabase() (*ReadWriteDatabase, bool) + AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, 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', 'KindReadOnlyFollowing' + 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 @@ -799,20 +1064,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(KindReadOnlyFollowing): + var rofd ReadOnlyFollowingDatabase + err := json.Unmarshal(body, &rofd) + return rofd, 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 +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for Database. +func (d Database) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, 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 { @@ -820,50 +1154,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 } } } @@ -871,19 +1168,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. @@ -917,18 +1216,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', '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"` -} - // DatabasesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type DatabasesCreateOrUpdateFuture struct { @@ -937,7 +1224,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 { @@ -949,10 +1236,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 @@ -995,111 +1282,25 @@ 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 { - err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture") - 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 err != nil { - err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", d.Response.Response, "Failure responding to request") - } - } - return -} - -// DatabaseUpdate class representing an update to a Kusto database. -type DatabaseUpdate struct { - // Location - Resource location. - Location *string `json:"location,omitempty"` - // DatabaseProperties - The properties of the updated database. - *DatabaseProperties `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 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 - err := json.Unmarshal(body, &m) + done, err = future.DoneWithContext(context.Background(), client) if err != nil { - return err + err = autorest.NewErrorWithError(err, "kusto.DatabasesUpdateFuture", "Result", future.Response(), "Polling failure") + return } - 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 - } + if !done { + err = azure.NewAsyncOpIncompleteError("kusto.DatabasesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + 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", dm.Response.Response, "Failure responding to request") } } - - return nil + return } // BasicDataConnection class representing an data connection. @@ -1116,7 +1317,7 @@ type DataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', '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 @@ -1421,7 +1622,7 @@ type EventGridDataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', '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 @@ -1500,7 +1701,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 @@ -1563,7 +1764,7 @@ type EventHubDataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', '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 @@ -1642,7 +1843,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 @@ -1682,6 +1883,23 @@ func (ehdc *EventHubDataConnection) UnmarshalJSON(body []byte) error { return nil } +// FollowerDatabaseDefinition a class representing follower database request. +type FollowerDatabaseDefinition struct { + // ClusterResourceID - Resource id of the cluster that follows a database owned by this cluster. + ClusterResourceID *string `json:"clusterResourceId,omitempty"` + // AttachedDatabaseConfigurationName - Resource name of the attached database configuration in the follower cluster. + AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` + // DatabaseName - READ-ONLY; The database name owned by this cluster that was followed. * in case following all databases. + DatabaseName *string `json:"databaseName,omitempty"` +} + +// FollowerDatabaseListResult the list Kusto database principals operation response. +type FollowerDatabaseListResult struct { + autorest.Response `json:"-"` + // Value - The list of follower database result. + Value *[]FollowerDatabaseDefinition `json:"value,omitempty"` +} + // Identity identity for the resource. type Identity struct { // PrincipalID - READ-ONLY; The principal ID of resource identity. @@ -1739,7 +1957,7 @@ type IotHubDataConnection struct { // Location - Resource location. Location *string `json:"location,omitempty"` // Kind - Possible values include: 'KindDataConnection', 'KindEventHub', 'KindIotHub', '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 @@ -1818,7 +2036,7 @@ func (ihdc *IotHubDataConnection) 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 @@ -2060,6 +2278,278 @@ type ProxyResource struct { Type *string `json:"type,omitempty"` } +// ReadOnlyFollowingDatabase class representing a read only following database. +type ReadOnlyFollowingDatabase struct { + // ReadOnlyFollowingDatabaseProperties - The database properties. + *ReadOnlyFollowingDatabaseProperties `json:"properties,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Kind - Possible values include: 'KindDatabase', 'KindReadWrite', 'KindReadOnlyFollowing' + 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 ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { + rofd.Kind = KindReadOnlyFollowing + objectMap := make(map[string]interface{}) + if rofd.ReadOnlyFollowingDatabaseProperties != nil { + objectMap["properties"] = rofd.ReadOnlyFollowingDatabaseProperties + } + if rofd.Location != nil { + objectMap["location"] = rofd.Location + } + if rofd.Kind != "" { + objectMap["kind"] = rofd.Kind + } + return json.Marshal(objectMap) +} + +// AsReadWriteDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsReadWriteDatabase() (*ReadWriteDatabase, bool) { + return nil, false +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) { + return &rofd, true +} + +// AsDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsDatabase() (*Database, bool) { + return nil, false +} + +// AsBasicDatabase is the BasicDatabase implementation for ReadOnlyFollowingDatabase. +func (rofd ReadOnlyFollowingDatabase) AsBasicDatabase() (BasicDatabase, bool) { + return &rofd, true +} + +// UnmarshalJSON is the custom unmarshaler for ReadOnlyFollowingDatabase struct. +func (rofd *ReadOnlyFollowingDatabase) 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 readOnlyFollowingDatabaseProperties ReadOnlyFollowingDatabaseProperties + err = json.Unmarshal(*v, &readOnlyFollowingDatabaseProperties) + if err != nil { + return err + } + rofd.ReadOnlyFollowingDatabaseProperties = &readOnlyFollowingDatabaseProperties + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rofd.Location = &location + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + rofd.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rofd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rofd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rofd.Type = &typeVar + } + } + } + + return nil +} + +// ReadOnlyFollowingDatabaseProperties class representing the Kusto database properties. +type ReadOnlyFollowingDatabaseProperties 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"` + // LeaderClusterResourceID - READ-ONLY; The name of the leader cluster + LeaderClusterResourceID *string `json:"leaderClusterResourceId,omitempty"` + // AttachedDatabaseConfigurationName - READ-ONLY; The name of the attached database configuration cluster + AttachedDatabaseConfigurationName *string `json:"attachedDatabaseConfigurationName,omitempty"` + // PrincipalsModificationKind - READ-ONLY; The principals modification kind of the database. Possible values include: 'PrincipalsModificationKindUnion', 'PrincipalsModificationKindReplace', 'PrincipalsModificationKindNone' + PrincipalsModificationKind PrincipalsModificationKind `json:"principalsModificationKind,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', 'KindReadOnlyFollowing' + 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 +} + +// AsReadOnlyFollowingDatabase is the BasicDatabase implementation for ReadWriteDatabase. +func (rwd ReadWriteDatabase) AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, 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}