From 0f262e0afe467abaf3616b00f7684f4841e41dca Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 9 Aug 2023 03:39:12 +0000 Subject: [PATCH] CodeGen from PR 25219 in Azure/azure-rest-api-specs Merge 0a6d8fa2d06e786f86d8e138f0f3413fe522ec99 into 2735b620aeb695c106fecd9bf28d719aa0b75b43 --- .../kusto/armkusto/CHANGELOG.md | 4 + .../attacheddatabaseconfigurations_client.go | 65 +- ...abaseconfigurations_client_example_test.go | 244 ---- .../kusto/armkusto/autorest.md | 7 +- .../kusto/armkusto/client_factory.go | 59 +- .../clusterprincipalassignments_client.go | 65 +- ...rincipalassignments_client_example_test.go | 207 --- .../kusto/armkusto/clusters_client.go | 210 +-- .../armkusto/clusters_client_example_test.go | 1149 ----------------- .../kusto/armkusto/constants.go | 9 +- .../kusto/armkusto/database_client.go | 19 +- .../armkusto/database_client_example_test.go | 61 - .../databaseprincipalassignments_client.go | 65 +- ...rincipalassignments_client_example_test.go | 207 --- .../kusto/armkusto/databases_client.go | 117 +- .../armkusto/databases_client_example_test.go | 546 -------- .../kusto/armkusto/dataconnections_client.go | 105 +- .../dataconnections_client_example_test.go | 703 ---------- sdk/resourcemanager/kusto/armkusto/go.mod | 14 +- sdk/resourcemanager/kusto/armkusto/go.sum | 26 +- .../kusto/armkusto/interfaces.go | 27 + .../managedprivateendpoints_client.go | 85 +- ...gedprivateendpoints_client_example_test.go | 226 ---- sdk/resourcemanager/kusto/armkusto/models.go | 504 +------- .../kusto/armkusto/models_serde.go | 3 +- .../kusto/armkusto/operations_client.go | 3 +- .../operations_client_example_test.go | 55 - .../armkusto/operationsresults_client.go | 14 +- .../operationsresults_client_example_test.go | 54 - .../operationsresultslocation_client.go | 14 +- ...ionsresultslocation_client_example_test.go | 35 - sdk/resourcemanager/kusto/armkusto/options.go | 474 +++++++ .../kusto/armkusto/polymorphic_helpers.go | 13 +- .../privateendpointconnections_client.go | 49 +- ...endpointconnections_client_example_test.go | 182 --- .../armkusto/privatelinkresources_client.go | 14 +- ...rivatelinkresources_client_example_test.go | 110 -- .../kusto/armkusto/response_types.go | 60 +- .../kusto/armkusto/scripts_client.go | 85 +- .../armkusto/scripts_client_example_test.go | 268 ---- .../kusto/armkusto/skus_client.go | 3 +- .../armkusto/skus_client_example_test.go | 124 -- .../kusto/armkusto/time_rfc3339.go | 3 +- 43 files changed, 1175 insertions(+), 5112 deletions(-) delete mode 100644 sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/database_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go create mode 100644 sdk/resourcemanager/kusto/armkusto/interfaces.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go create mode 100644 sdk/resourcemanager/kusto/armkusto/options.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go delete mode 100644 sdk/resourcemanager/kusto/armkusto/skus_client_example_test.go diff --git a/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md b/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md index c957b2aba08b..6797f37050af 100644 --- a/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md +++ b/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 2.0.1 (2023-08-09) +### Other Changes + + ## 2.0.0 (2023-07-28) ### Breaking Changes diff --git a/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go index 115a69f8ed45..d02f80f4d453 100644 --- a/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go +++ b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -54,18 +53,21 @@ func NewAttachedDatabaseConfigurationsClient(subscriptionID string, credential a // - options - AttachedDatabaseConfigurationsClientCheckNameAvailabilityOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.CheckNameAvailability // method. func (client *AttachedDatabaseConfigurationsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName AttachedDatabaseConfigurationsCheckNameRequest, options *AttachedDatabaseConfigurationsClientCheckNameAvailabilityOptions) (AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, clusterName, resourceName, options) if err != nil { return AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -91,7 +93,10 @@ func (client *AttachedDatabaseConfigurationsClient) checkNameAvailabilityCreateR reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resourceName) + if err := runtime.MarshalAsJSON(req, resourceName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -119,9 +124,8 @@ func (client *AttachedDatabaseConfigurationsClient) BeginCreateOrUpdate(ctx cont if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AttachedDatabaseConfigurationsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[AttachedDatabaseConfigurationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[AttachedDatabaseConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -132,18 +136,20 @@ func (client *AttachedDatabaseConfigurationsClient) BeginCreateOrUpdate(ctx cont // // Generated from API version 2023-05-02 func (client *AttachedDatabaseConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration, options *AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -173,7 +179,10 @@ func (client *AttachedDatabaseConfigurationsClient) createOrUpdateCreateRequest( reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the attached database configuration with the given name. @@ -191,9 +200,8 @@ func (client *AttachedDatabaseConfigurationsClient) BeginDelete(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AttachedDatabaseConfigurationsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[AttachedDatabaseConfigurationsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[AttachedDatabaseConfigurationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -204,18 +212,20 @@ func (client *AttachedDatabaseConfigurationsClient) BeginDelete(ctx context.Cont // // Generated from API version 2023-05-02 func (client *AttachedDatabaseConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, options *AttachedDatabaseConfigurationsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -258,18 +268,21 @@ func (client *AttachedDatabaseConfigurationsClient) deleteCreateRequest(ctx cont // - options - AttachedDatabaseConfigurationsClientGetOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.Get // method. func (client *AttachedDatabaseConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, options *AttachedDatabaseConfigurationsClientGetOptions) (AttachedDatabaseConfigurationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, attachedDatabaseConfigurationName, options) if err != nil { return AttachedDatabaseConfigurationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AttachedDatabaseConfigurationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AttachedDatabaseConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AttachedDatabaseConfigurationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go deleted file mode 100644 index 544b99bf737c..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go +++ /dev/null @@ -1,244 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoAttachedDatabaseConfigurationCheckNameAvailability.json -func ExampleAttachedDatabaseConfigurationsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAttachedDatabaseConfigurationsClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.AttachedDatabaseConfigurationsCheckNameRequest{ - Name: to.Ptr("adc1"), - Type: to.Ptr("Microsoft.Kusto/clusters/attachedDatabaseConfigurations"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("adc1"), - // Message: to.Ptr("Name 'adc1' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoAttachedDatabaseConfigurationsListByCluster.json -func ExampleAttachedDatabaseConfigurationsClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAttachedDatabaseConfigurationsClient().NewListByClusterPager("kustorptest", "kustoCluster2", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AttachedDatabaseConfigurationListResult = armkusto.AttachedDatabaseConfigurationListResult{ - // Value: []*armkusto.AttachedDatabaseConfiguration{ - // { - // Name: to.Ptr("kustoCluster2/KustoDatabase8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/AttachedDatabaseConfigurations"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2/AttachedDatabaseConfigurations/KustoDatabase8"), - // Location: to.Ptr("westus"), - // Properties: &armkusto.AttachedDatabaseConfigurationProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterLeader"), - // DatabaseName: to.Ptr("db1"), - // DefaultPrincipalsModificationKind: to.Ptr(armkusto.DefaultPrincipalsModificationKindUnion), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster2/KustoDatabase9"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/AttachedDatabaseConfigurations"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2/AttachedDatabaseConfigurations/KustoDatabase9"), - // Location: to.Ptr("westus"), - // Properties: &armkusto.AttachedDatabaseConfigurationProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterLeader"), - // DatabaseName: to.Ptr("db1"), - // DefaultPrincipalsModificationKind: to.Ptr(armkusto.DefaultPrincipalsModificationKindUnion), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ - // ExternalTablesToExclude: []*string{ - // to.Ptr("ExternalTable2")}, - // ExternalTablesToInclude: []*string{ - // to.Ptr("ExternalTable1")}, - // FunctionsToExclude: []*string{ - // to.Ptr("functionsToExclude2")}, - // FunctionsToInclude: []*string{ - // to.Ptr("functionsToInclude1")}, - // MaterializedViewsToExclude: []*string{ - // to.Ptr("MaterializedViewTable2")}, - // MaterializedViewsToInclude: []*string{ - // to.Ptr("MaterializedViewTable1")}, - // TablesToExclude: []*string{ - // to.Ptr("Table2")}, - // TablesToInclude: []*string{ - // to.Ptr("Table1")}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoAttachedDatabaseConfigurationsGet.json -func ExampleAttachedDatabaseConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAttachedDatabaseConfigurationsClient().Get(ctx, "kustorptest", "kustoCluster2", "attachedDatabaseConfigurationsTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AttachedDatabaseConfiguration = armkusto.AttachedDatabaseConfiguration{ - // Name: to.Ptr("kustoCluster2/attachedDatabaseConfigurationsTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/AttachedDatabaseConfigurations"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2/AttachedDatabaseConfigurations/attachedDatabaseConfigurationsTest"), - // Location: to.Ptr("westus"), - // Properties: &armkusto.AttachedDatabaseConfigurationProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - // DatabaseName: to.Ptr("*"), - // DatabaseNamePrefix: to.Ptr("prefix"), - // DefaultPrincipalsModificationKind: to.Ptr(armkusto.DefaultPrincipalsModificationKindUnion), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoAttachedDatabaseConfigurationsCreateOrUpdate.json -func ExampleAttachedDatabaseConfigurationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAttachedDatabaseConfigurationsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster2", "attachedDatabaseConfigurationsTest", armkusto.AttachedDatabaseConfiguration{ - Location: to.Ptr("westus"), - Properties: &armkusto.AttachedDatabaseConfigurationProperties{ - ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - DatabaseName: to.Ptr("kustodatabase"), - DatabaseNameOverride: to.Ptr("overridekustodatabase"), - DefaultPrincipalsModificationKind: to.Ptr(armkusto.DefaultPrincipalsModificationKindUnion), - TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ - ExternalTablesToExclude: []*string{ - to.Ptr("ExternalTable2")}, - ExternalTablesToInclude: []*string{ - to.Ptr("ExternalTable1")}, - MaterializedViewsToExclude: []*string{ - to.Ptr("MaterializedViewTable2")}, - MaterializedViewsToInclude: []*string{ - to.Ptr("MaterializedViewTable1")}, - TablesToExclude: []*string{ - to.Ptr("Table2")}, - TablesToInclude: []*string{ - to.Ptr("Table1")}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AttachedDatabaseConfiguration = armkusto.AttachedDatabaseConfiguration{ - // Name: to.Ptr("kustoCluster2/attachedDatabaseConfigurationsTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/AttachedDatabaseConfigurations"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2/attachedDatabaseConfigurations/attachedDatabaseConfigurationsTest"), - // Location: to.Ptr("westus"), - // Properties: &armkusto.AttachedDatabaseConfigurationProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - // DatabaseName: to.Ptr("db1"), - // DatabaseNameOverride: to.Ptr("overridekustodatabase"), - // DefaultPrincipalsModificationKind: to.Ptr(armkusto.DefaultPrincipalsModificationKindUnion), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ - // ExternalTablesToExclude: []*string{ - // to.Ptr("ExternalTable2")}, - // ExternalTablesToInclude: []*string{ - // to.Ptr("ExternalTable1")}, - // MaterializedViewsToExclude: []*string{ - // to.Ptr("MaterializedViewTable2")}, - // MaterializedViewsToInclude: []*string{ - // to.Ptr("MaterializedViewTable1")}, - // TablesToExclude: []*string{ - // to.Ptr("Table2")}, - // TablesToInclude: []*string{ - // to.Ptr("Table1")}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoAttachedDatabaseConfigurationsDelete.json -func ExampleAttachedDatabaseConfigurationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAttachedDatabaseConfigurationsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "attachedDatabaseConfigurationsTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/autorest.md b/sdk/resourcemanager/kusto/armkusto/autorest.md index 4c5415e64336..82a123cf5dd6 100644 --- a/sdk/resourcemanager/kusto/armkusto/autorest.md +++ b/sdk/resourcemanager/kusto/armkusto/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azure-kusto/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/azure-kusto/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 -tag: package-2023-05 +module-version: 2.0.1 ``` diff --git a/sdk/resourcemanager/kusto/armkusto/client_factory.go b/sdk/resourcemanager/kusto/armkusto/client_factory.go index 4e608b5419a9..ab010db68e8a 100644 --- a/sdk/resourcemanager/kusto/armkusto/client_factory.go +++ b/sdk/resourcemanager/kusto/armkusto/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -38,8 +37,8 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewClustersClient() *ClustersClient { - subClient, _ := NewClustersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAttachedDatabaseConfigurationsClient() *AttachedDatabaseConfigurationsClient { + subClient, _ := NewAttachedDatabaseConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -48,67 +47,67 @@ func (c *ClientFactory) NewClusterPrincipalAssignmentsClient() *ClusterPrincipal return subClient } -func (c *ClientFactory) NewSKUsClient() *SKUsClient { - subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewClustersClient() *ClustersClient { + subClient, _ := NewClustersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { - subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDataConnectionsClient() *DataConnectionsClient { + subClient, _ := NewDataConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewAttachedDatabaseConfigurationsClient() *AttachedDatabaseConfigurationsClient { - subClient, _ := NewAttachedDatabaseConfigurationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabaseClient() *DatabaseClient { + subClient, _ := NewDatabaseClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagedPrivateEndpointsClient() *ManagedPrivateEndpointsClient { - subClient, _ := NewManagedPrivateEndpointsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabasePrincipalAssignmentsClient() *DatabasePrincipalAssignmentsClient { + subClient, _ := NewDatabasePrincipalAssignmentsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabaseClient() *DatabaseClient { - subClient, _ := NewDatabaseClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { + subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabasePrincipalAssignmentsClient() *DatabasePrincipalAssignmentsClient { - subClient, _ := NewDatabasePrincipalAssignmentsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagedPrivateEndpointsClient() *ManagedPrivateEndpointsClient { + subClient, _ := NewManagedPrivateEndpointsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewScriptsClient() *ScriptsClient { - subClient, _ := NewScriptsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsResultsClient() *OperationsResultsClient { + subClient, _ := NewOperationsResultsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsResultsLocationClient() *OperationsResultsLocationClient { + subClient, _ := NewOperationsResultsLocationClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDataConnectionsClient() *DataConnectionsClient { - subClient, _ := NewDataConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsResultsClient() *OperationsResultsClient { - subClient, _ := NewOperationsResultsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewSKUsClient() *SKUsClient { + subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsResultsLocationClient() *OperationsResultsLocationClient { - subClient, _ := NewOperationsResultsLocationClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewScriptsClient() *ScriptsClient { + subClient, _ := NewScriptsClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go index 482317dcf98a..fd09d49456bd 100644 --- a/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go +++ b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -54,18 +53,21 @@ func NewClusterPrincipalAssignmentsClient(subscriptionID string, credential azco // - options - ClusterPrincipalAssignmentsClientCheckNameAvailabilityOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.CheckNameAvailability // method. func (client *ClusterPrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName ClusterPrincipalAssignmentCheckNameRequest, options *ClusterPrincipalAssignmentsClientCheckNameAvailabilityOptions) (ClusterPrincipalAssignmentsClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, clusterName, principalAssignmentName, options) if err != nil { return ClusterPrincipalAssignmentsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClusterPrincipalAssignmentsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClusterPrincipalAssignmentsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClusterPrincipalAssignmentsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -91,7 +93,10 @@ func (client *ClusterPrincipalAssignmentsClient) checkNameAvailabilityCreateRequ reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, principalAssignmentName) + if err := runtime.MarshalAsJSON(req, principalAssignmentName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -119,9 +124,8 @@ func (client *ClusterPrincipalAssignmentsClient) BeginCreateOrUpdate(ctx context if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClusterPrincipalAssignmentsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClusterPrincipalAssignmentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClusterPrincipalAssignmentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -132,18 +136,20 @@ func (client *ClusterPrincipalAssignmentsClient) BeginCreateOrUpdate(ctx context // // Generated from API version 2023-05-02 func (client *ClusterPrincipalAssignmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, parameters ClusterPrincipalAssignment, options *ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, principalAssignmentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -173,7 +179,10 @@ func (client *ClusterPrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a Kusto cluster principalAssignment. @@ -191,9 +200,8 @@ func (client *ClusterPrincipalAssignmentsClient) BeginDelete(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClusterPrincipalAssignmentsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClusterPrincipalAssignmentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClusterPrincipalAssignmentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -204,18 +212,20 @@ func (client *ClusterPrincipalAssignmentsClient) BeginDelete(ctx context.Context // // Generated from API version 2023-05-02 func (client *ClusterPrincipalAssignmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, options *ClusterPrincipalAssignmentsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, principalAssignmentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -258,18 +268,21 @@ func (client *ClusterPrincipalAssignmentsClient) deleteCreateRequest(ctx context // - options - ClusterPrincipalAssignmentsClientGetOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.Get // method. func (client *ClusterPrincipalAssignmentsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, options *ClusterPrincipalAssignmentsClientGetOptions) (ClusterPrincipalAssignmentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, principalAssignmentName, options) if err != nil { return ClusterPrincipalAssignmentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClusterPrincipalAssignmentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClusterPrincipalAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClusterPrincipalAssignmentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go deleted file mode 100644 index be29eeb2a767..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go +++ /dev/null @@ -1,207 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterPrincipalAssignmentsCheckNameAvailability.json -func ExampleClusterPrincipalAssignmentsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClusterPrincipalAssignmentsClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.ClusterPrincipalAssignmentCheckNameRequest{ - Name: to.Ptr("kustoprincipal1"), - Type: to.Ptr("Microsoft.Kusto/clusters/principalAssignments"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("kustoprincipal1"), - // Message: to.Ptr("Name 'kustoprincipal1' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterPrincipalAssignmentsGet.json -func ExampleClusterPrincipalAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClusterPrincipalAssignmentsClient().Get(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClusterPrincipalAssignment = armkusto.ClusterPrincipalAssignment{ - // Name: to.Ptr("kustoCluster/kustoprincipal1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/PrincipalAssignments"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/PrincipalAssignments/kustoprincipal1"), - // Properties: &armkusto.ClusterPrincipalProperties{ - // AADObjectID: to.Ptr("98765432-1234-1234-1234-123456789123"), - // PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // PrincipalName: to.Ptr("TestApp"), - // PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // Role: to.Ptr(armkusto.ClusterPrincipalRoleAllDatabasesAdmin), - // TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - // TenantName: to.Ptr("tenantName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterPrincipalAssignmentsCreateOrUpdate.json -func ExampleClusterPrincipalAssignmentsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClusterPrincipalAssignmentsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", armkusto.ClusterPrincipalAssignment{ - Properties: &armkusto.ClusterPrincipalProperties{ - PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - Role: to.Ptr(armkusto.ClusterPrincipalRoleAllDatabasesAdmin), - TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ClusterPrincipalAssignment = armkusto.ClusterPrincipalAssignment{ - // Name: to.Ptr("kustoCluster/kustoprincipal1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/PrincipalAssignments"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/PrincipalAssignments/kustoprincipal1"), - // Properties: &armkusto.ClusterPrincipalProperties{ - // AADObjectID: to.Ptr("98765432-1234-1234-1234-123456789123"), - // PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // PrincipalName: to.Ptr("TestApp"), - // PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // Role: to.Ptr(armkusto.ClusterPrincipalRoleAllDatabasesAdmin), - // TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - // TenantName: to.Ptr("tenantName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterPrincipalAssignmentsDelete.json -func ExampleClusterPrincipalAssignmentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClusterPrincipalAssignmentsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterPrincipalAssignmentsList.json -func ExampleClusterPrincipalAssignmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClusterPrincipalAssignmentsClient().NewListPager("kustorptest", "kustoCluster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClusterPrincipalAssignmentListResult = armkusto.ClusterPrincipalAssignmentListResult{ - // Value: []*armkusto.ClusterPrincipalAssignment{ - // { - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoprincipal1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/PrincipalAssignments"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/PrincipalAssignments/kustoprincipal1"), - // Properties: &armkusto.ClusterPrincipalProperties{ - // AADObjectID: to.Ptr("98765432-1234-1234-1234-123456789123"), - // PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // PrincipalName: to.Ptr("TestApp"), - // PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // Role: to.Ptr(armkusto.ClusterPrincipalRoleAllDatabasesAdmin), - // TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - // TenantName: to.Ptr("tenantName"), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoprincipal2"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/PrincipalAssignments"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/PrincipalAssignments/kustoprincipal1"), - // Properties: &armkusto.ClusterPrincipalProperties{ - // AADObjectID: to.Ptr("98765432-1234-1234-1234-123456789123"), - // PrincipalID: to.Ptr("11112222-1234-1234-1234-123456789123"), - // PrincipalName: to.Ptr("TestApp"), - // PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // Role: to.Ptr(armkusto.ClusterPrincipalRoleAllDatabasesViewer), - // TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - // TenantName: to.Ptr("tenantName"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/clusters_client.go b/sdk/resourcemanager/kusto/armkusto/clusters_client.go index 245dac098d48..aaa8f089d5a4 100644 --- a/sdk/resourcemanager/kusto/armkusto/clusters_client.go +++ b/sdk/resourcemanager/kusto/armkusto/clusters_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -59,9 +58,8 @@ func (client *ClustersClient) BeginAddLanguageExtensions(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientAddLanguageExtensionsResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientAddLanguageExtensionsResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientAddLanguageExtensionsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,18 +70,20 @@ func (client *ClustersClient) BeginAddLanguageExtensions(ctx context.Context, re // // Generated from API version 2023-05-02 func (client *ClustersClient) addLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList, options *ClustersClientBeginAddLanguageExtensionsOptions) (*http.Response, error) { + var err error req, err := client.addLanguageExtensionsCreateRequest(ctx, resourceGroupName, clusterName, languageExtensionsToAdd, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // addLanguageExtensionsCreateRequest creates the AddLanguageExtensions request. @@ -109,7 +109,10 @@ func (client *ClustersClient) addLanguageExtensionsCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, languageExtensionsToAdd) + if err := runtime.MarshalAsJSON(req, languageExtensionsToAdd); err != nil { + return nil, err + } + return req, nil } // CheckNameAvailability - Checks that the cluster name is valid and is not already in use. @@ -121,18 +124,21 @@ func (client *ClustersClient) addLanguageExtensionsCreateRequest(ctx context.Con // - options - ClustersClientCheckNameAvailabilityOptions contains the optional parameters for the ClustersClient.CheckNameAvailability // method. func (client *ClustersClient) CheckNameAvailability(ctx context.Context, location string, clusterName ClusterCheckNameRequest, options *ClustersClientCheckNameAvailabilityOptions) (ClustersClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, location, clusterName, options) if err != nil { return ClustersClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClustersClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -154,7 +160,10 @@ func (client *ClustersClient) checkNameAvailabilityCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, clusterName) + if err := runtime.MarshalAsJSON(req, clusterName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -181,9 +190,8 @@ func (client *ClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -194,18 +202,20 @@ func (client *ClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceG // // Generated from API version 2023-05-02 func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -237,7 +247,10 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a Kusto cluster. @@ -253,9 +266,8 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -266,18 +278,20 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // // Generated from API version 2023-05-02 func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -321,9 +335,8 @@ func (client *ClustersClient) BeginDetachFollowerDatabases(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientDetachFollowerDatabasesResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientDetachFollowerDatabasesResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientDetachFollowerDatabasesResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -334,18 +347,20 @@ func (client *ClustersClient) BeginDetachFollowerDatabases(ctx context.Context, // // Generated from API version 2023-05-02 func (client *ClustersClient) detachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition, options *ClustersClientBeginDetachFollowerDatabasesOptions) (*http.Response, error) { + var err error req, err := client.detachFollowerDatabasesCreateRequest(ctx, resourceGroupName, clusterName, followerDatabaseToRemove, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // detachFollowerDatabasesCreateRequest creates the DetachFollowerDatabases request. @@ -371,7 +386,10 @@ func (client *ClustersClient) detachFollowerDatabasesCreateRequest(ctx context.C reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, followerDatabaseToRemove) + if err := runtime.MarshalAsJSON(req, followerDatabaseToRemove); err != nil { + return nil, err + } + return req, nil } // BeginDiagnoseVirtualNetwork - Diagnoses network connectivity status for external resources on which the service is dependent @@ -389,9 +407,8 @@ func (client *ClustersClient) BeginDiagnoseVirtualNetwork(ctx context.Context, r if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientDiagnoseVirtualNetworkResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientDiagnoseVirtualNetworkResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientDiagnoseVirtualNetworkResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -403,18 +420,20 @@ func (client *ClustersClient) BeginDiagnoseVirtualNetwork(ctx context.Context, r // // Generated from API version 2023-05-02 func (client *ClustersClient) diagnoseVirtualNetwork(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDiagnoseVirtualNetworkOptions) (*http.Response, error) { + var err error req, err := client.diagnoseVirtualNetworkCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // diagnoseVirtualNetworkCreateRequest creates the DiagnoseVirtualNetwork request. @@ -451,18 +470,21 @@ func (client *ClustersClient) diagnoseVirtualNetworkCreateRequest(ctx context.Co // - clusterName - The name of the Kusto cluster. // - options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. func (client *ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetOptions) (ClustersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return ClustersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClustersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClustersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -942,9 +964,8 @@ func (client *ClustersClient) BeginMigrate(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientMigrateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientMigrateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientMigrateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -955,18 +976,20 @@ func (client *ClustersClient) BeginMigrate(ctx context.Context, resourceGroupNam // // Generated from API version 2023-05-02 func (client *ClustersClient) migrate(ctx context.Context, resourceGroupName string, clusterName string, clusterMigrateRequest ClusterMigrateRequest, options *ClustersClientBeginMigrateOptions) (*http.Response, error) { + var err error req, err := client.migrateCreateRequest(ctx, resourceGroupName, clusterName, clusterMigrateRequest, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // migrateCreateRequest creates the Migrate request. @@ -992,7 +1015,10 @@ func (client *ClustersClient) migrateCreateRequest(ctx context.Context, resource reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, clusterMigrateRequest) + if err := runtime.MarshalAsJSON(req, clusterMigrateRequest); err != nil { + return nil, err + } + return req, nil } // BeginRemoveLanguageExtensions - Remove a list of language extensions that can run within KQL queries. @@ -1010,9 +1036,8 @@ func (client *ClustersClient) BeginRemoveLanguageExtensions(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientRemoveLanguageExtensionsResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientRemoveLanguageExtensionsResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientRemoveLanguageExtensionsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1023,18 +1048,20 @@ func (client *ClustersClient) BeginRemoveLanguageExtensions(ctx context.Context, // // Generated from API version 2023-05-02 func (client *ClustersClient) removeLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList, options *ClustersClientBeginRemoveLanguageExtensionsOptions) (*http.Response, error) { + var err error req, err := client.removeLanguageExtensionsCreateRequest(ctx, resourceGroupName, clusterName, languageExtensionsToRemove, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // removeLanguageExtensionsCreateRequest creates the RemoveLanguageExtensions request. @@ -1060,7 +1087,10 @@ func (client *ClustersClient) removeLanguageExtensionsCreateRequest(ctx context. reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, languageExtensionsToRemove) + if err := runtime.MarshalAsJSON(req, languageExtensionsToRemove); err != nil { + return nil, err + } + return req, nil } // BeginStart - Starts a Kusto cluster. @@ -1076,9 +1106,8 @@ func (client *ClustersClient) BeginStart(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientStartResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientStartResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1089,18 +1118,20 @@ func (client *ClustersClient) BeginStart(ctx context.Context, resourceGroupName // // Generated from API version 2023-05-02 func (client *ClustersClient) start(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStartOptions) (*http.Response, error) { + var err error req, err := client.startCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // startCreateRequest creates the Start request. @@ -1142,9 +1173,8 @@ func (client *ClustersClient) BeginStop(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientStopResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientStopResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1155,18 +1185,20 @@ func (client *ClustersClient) BeginStop(ctx context.Context, resourceGroupName s // // Generated from API version 2023-05-02 func (client *ClustersClient) stop(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStopOptions) (*http.Response, error) { + var err error req, err := client.stopCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // stopCreateRequest creates the Stop request. @@ -1209,9 +1241,8 @@ func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClustersClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ClustersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClustersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -1222,18 +1253,20 @@ func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName // // Generated from API version 2023-05-02 func (client *ClustersClient) update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *ClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -1262,5 +1295,8 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG req.Raw().Header["If-Match"] = []string{*options.IfMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go deleted file mode 100644 index bc7341ddb1c9..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go +++ /dev/null @@ -1,1149 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersGet.json -func ExampleClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Get(ctx, "kustorptest", "kustoCluster", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armkusto.Cluster{ - // Name: to.Ptr("kustoCluster"), - // Type: to.Ptr("Microsoft.Kusto/Clusters"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("abcd123"), - // Identity: &armkusto.Identity{ - // Type: to.Ptr(armkusto.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("faabad1f-4876-463c-af9d-6ba2d2d2394c"), - // TenantID: to.Ptr("b932977f-6277-4ab7-a2cd-5bd21f07aaf4"), - // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // Properties: &armkusto.ClusterProperties{ - // AllowedFqdnList: []*string{ - // to.Ptr("my-stroage.blob.core.windows.net")}, - // AllowedIPRangeList: []*string{ - // }, - // EnableAutoStop: to.Ptr(true), - // EnableDiskEncryption: to.Ptr(false), - // EnablePurge: to.Ptr(false), - // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV3), - // KeyVaultProperties: &armkusto.KeyVaultProperties{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://dummy.keyvault.com"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // MigrationCluster: &armkusto.MigrationClusterProperties{ - // DataIngestionURI: to.Ptr("https://ingest-kustocluster2.westus.kusto.windows.net"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - // Role: to.Ptr(armkusto.MigrationClusterRoleDestination), - // URI: to.Ptr("https://kustocluster2.westus.kusto.windows.net"), - // }, - // PrivateEndpointConnections: []*armkusto.PrivateEndpointConnection{ - // { - // Name: to.Ptr("privateEndpointTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/privateEndpointConnections/privateEndpointTest"), - // Properties: &armkusto.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("cluster"), - // PrivateEndpoint: &armkusto.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), - // PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagEnabled), - // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // SystemData: &armkusto.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armkusto.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersCreateOrUpdate.json -func ExampleClustersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", armkusto.Cluster{ - Location: to.Ptr("westus"), - Identity: &armkusto.Identity{ - Type: to.Ptr(armkusto.IdentityTypeSystemAssigned), - }, - Properties: &armkusto.ClusterProperties{ - AllowedIPRangeList: []*string{ - to.Ptr("0.0.0.0/0")}, - EnableAutoStop: to.Ptr(true), - EnableDoubleEncryption: to.Ptr(false), - EnablePurge: to.Ptr(true), - EnableStreamingIngest: to.Ptr(true), - LanguageExtensions: &armkusto.LanguageExtensionsList{ - Value: []*armkusto.LanguageExtension{ - { - LanguageExtensionImageName: to.Ptr(armkusto.LanguageExtensionImageNamePython3108), - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), - }, - { - LanguageExtensionImageName: to.Ptr(armkusto.LanguageExtensionImageNameR), - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - }}, - }, - PublicIPType: to.Ptr(armkusto.PublicIPTypeDualStack), - PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - }, - SKU: &armkusto.AzureSKU{ - Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - Capacity: to.Ptr[int32](2), - Tier: to.Ptr(armkusto.AzureSKUTierStandard), - }, - }, &armkusto.ClustersClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armkusto.Cluster{ - // Name: to.Ptr("kustoCluster"), - // Type: to.Ptr("Microsoft.Kusto/Clusters"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("abcd"), - // Identity: &armkusto.Identity{ - // Type: to.Ptr(armkusto.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("faabad1f-4876-463c-af9d-6ba2d2d2394c"), - // TenantID: to.Ptr("b932977f-6277-4ab7-a2cd-5bd21f07aaf4"), - // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // Properties: &armkusto.ClusterProperties{ - // AllowedIPRangeList: []*string{ - // to.Ptr("0.0.0.0/0")}, - // EnableAutoStop: to.Ptr(true), - // EnableDiskEncryption: to.Ptr(false), - // EnableDoubleEncryption: to.Ptr(false), - // EnablePurge: to.Ptr(true), - // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV3), - // KeyVaultProperties: &armkusto.KeyVaultProperties{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://dummy.keyvault.com"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // LanguageExtensions: &armkusto.LanguageExtensionsList{ - // Value: []*armkusto.LanguageExtension{ - // { - // LanguageExtensionImageName: to.Ptr(armkusto.LanguageExtensionImageNamePython3108), - // LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), - // }, - // { - // LanguageExtensionImageName: to.Ptr(armkusto.LanguageExtensionImageNameR), - // LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - // }}, - // }, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // PublicIPType: to.Ptr(armkusto.PublicIPTypeDualStack), - // PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), - // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersUpdate.json -func ExampleClustersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUpdate(ctx, "kustorptest", "kustoCluster2", armkusto.ClusterUpdate{ - Location: to.Ptr("westus"), - }, &armkusto.ClustersClientBeginUpdateOptions{IfMatch: to.Ptr("*")}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armkusto.Cluster{ - // Name: to.Ptr("kustoCluster2"), - // Type: to.Ptr("Microsoft.Kusto/Clusters"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("abcd123"), - // Identity: &armkusto.Identity{ - // Type: to.Ptr(armkusto.IdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("faabad1f-4876-463c-af9d-6ba2d2d2394c"), - // TenantID: to.Ptr("b932977f-6277-4ab7-a2cd-5bd21f07aaf4"), - // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ - // }, - // }, - // Properties: &armkusto.ClusterProperties{ - // EnableAutoStop: to.Ptr(true), - // EnableDiskEncryption: to.Ptr(false), - // EnablePurge: to.Ptr(true), - // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV3), - // KeyVaultProperties: &armkusto.KeyVaultProperties{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://dummy.keyvault.com"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), - // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), - // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersDelete.json -func ExampleClustersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginDelete(ctx, "kustorptest", "kustoCluster2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersStop.json -func ExampleClustersClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginStop(ctx, "kustorptest", "kustoCluster2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersStart.json -func ExampleClustersClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginStart(ctx, "kustorptest", "kustoCluster2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterMigrate.json -func ExampleClustersClient_BeginMigrate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginMigrate(ctx, "kustorptest", "kustoCluster1", armkusto.ClusterMigrateRequest{ - ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/kustoCluster2"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterListFollowerDatabases.json -func ExampleClustersClient_NewListFollowerDatabasesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListFollowerDatabasesPager("kustorptest", "kustoCluster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FollowerDatabaseListResult = armkusto.FollowerDatabaseListResult{ - // Value: []*armkusto.FollowerDatabaseDefinition{ - // { - // AttachedDatabaseConfigurationName: to.Ptr("attachedDbConfiguration"), - // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/follower1"), - // DatabaseName: to.Ptr("*"), - // DatabaseShareOrigin: to.Ptr(armkusto.DatabaseShareOriginDataShare), - // }, - // { - // AttachedDatabaseConfigurationName: to.Ptr("attachedDbConfiguration2"), - // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/follower4"), - // DatabaseName: to.Ptr("db1"), - // DatabaseShareOrigin: to.Ptr(armkusto.DatabaseShareOriginDirect), - // TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ - // ExternalTablesToExclude: []*string{ - // to.Ptr("ExternalTable2")}, - // ExternalTablesToInclude: []*string{ - // to.Ptr("ExternalTable1")}, - // MaterializedViewsToExclude: []*string{ - // to.Ptr("MaterializedViewTable2")}, - // MaterializedViewsToInclude: []*string{ - // to.Ptr("MaterializedViewTable1")}, - // TablesToExclude: []*string{ - // to.Ptr("Table2")}, - // TablesToInclude: []*string{ - // to.Ptr("Table1")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterDetachFollowerDatabases.json -func ExampleClustersClient_BeginDetachFollowerDatabases() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginDetachFollowerDatabases(ctx, "kustorptest", "kustoCluster", armkusto.FollowerDatabaseDefinition{ - AttachedDatabaseConfigurationName: to.Ptr("attachedDatabaseConfigurationsTest"), - ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/kustoCluster2"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersDiagnoseVirtualNetwork.json -func ExampleClustersClient_BeginDiagnoseVirtualNetwork() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginDiagnoseVirtualNetwork(ctx, "kustorptest", "kustoCluster", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DiagnoseVirtualNetworkResult = armkusto.DiagnoseVirtualNetworkResult{ - // Findings: []*string{ - // to.Ptr("Outbound dependency 'Storage:443' might not be satisfied (Outbound)")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersListByResourceGroup.json -func ExampleClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListByResourceGroupPager("kustorptest", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClusterListResult = armkusto.ClusterListResult{ - // Value: []*armkusto.Cluster{ - // { - // Name: to.Ptr("KustoClusterRPTest4"), - // Type: to.Ptr("Microsoft.Kusto/Clusters"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterRPTest4"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("abcd123"), - // Properties: &armkusto.ClusterProperties{ - // AllowedFqdnList: []*string{ - // to.Ptr("my-stroage.blob.core.windows.net")}, - // AllowedIPRangeList: []*string{ - // }, - // EnableDiskEncryption: to.Ptr(false), - // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV2), - // KeyVaultProperties: &armkusto.KeyVaultProperties{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://dummy.keyvault.com"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // MigrationCluster: &armkusto.MigrationClusterProperties{ - // DataIngestionURI: to.Ptr("https://ingest-kustocluster2.westus.kusto.windows.net"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - // Role: to.Ptr(armkusto.MigrationClusterRoleDestination), - // URI: to.Ptr("https://kustocluster2.westus.kusto.windows.net"), - // }, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), - // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }, - // { - // Name: to.Ptr("KustoClusterRPTest3"), - // Type: to.Ptr("Microsoft.Kusto/Clusters"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterRPTest3"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("abcd123"), - // Properties: &armkusto.ClusterProperties{ - // AllowedIPRangeList: []*string{ - // to.Ptr("0.0.0.0/0")}, - // EnableDiskEncryption: to.Ptr(true), - // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV3), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), - // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersList.json -func ExampleClustersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClusterListResult = armkusto.ClusterListResult{ - // Value: []*armkusto.Cluster{ - // { - // Name: to.Ptr("kustoCluster"), - // Type: to.Ptr("Microsoft.Kusto/Clusters"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("abcd123"), - // Properties: &armkusto.ClusterProperties{ - // AllowedFqdnList: []*string{ - // to.Ptr("my-stroage.blob.core.windows.net")}, - // AllowedIPRangeList: []*string{ - // }, - // EnableAutoStop: to.Ptr(true), - // EnableDiskEncryption: to.Ptr(false), - // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV3), - // KeyVaultProperties: &armkusto.KeyVaultProperties{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://dummy.keyvault.com"), - // KeyVersion: to.Ptr("keyVersion"), - // }, - // MigrationCluster: &armkusto.MigrationClusterProperties{ - // DataIngestionURI: to.Ptr("https://ingest-kustocluster2.westus.kusto.windows.net"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - // Role: to.Ptr(armkusto.MigrationClusterRoleDestination), - // URI: to.Ptr("https://kustocluster2.westus.kusto.windows.net"), - // }, - // PrivateEndpointConnections: []*armkusto.PrivateEndpointConnection{ - // { - // Name: to.Ptr("privateEndpointTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/privateEndpointConnections/privateEndpointTest"), - // Properties: &armkusto.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("cluster"), - // PrivateEndpoint: &armkusto.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // PublicIPType: to.Ptr(armkusto.PublicIPTypeDualStack), - // PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagEnabled), - // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }, - // { - // Name: to.Ptr("KustoClusterRPTest3"), - // Type: to.Ptr("Microsoft.Kusto/Clusters"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterRPTest3"), - // Location: to.Ptr("westus"), - // Etag: to.Ptr("abcd123"), - // Properties: &armkusto.ClusterProperties{ - // AllowedIPRangeList: []*string{ - // to.Ptr("0.0.0.0/0")}, - // EnableDiskEncryption: to.Ptr(true), - // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV2), - // PrivateEndpointConnections: []*armkusto.PrivateEndpointConnection{ - // }, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), - // PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), - // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersListSkus.json -func ExampleClustersClient_NewListSKUsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListSKUsPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SKUDescriptionList = armkusto.SKUDescriptionList{ - // Value: []*armkusto.SKUDescription{ - // { - // Name: to.Ptr("Standard_L8s_v3"), - // LocationInfo: []*armkusto.SKULocationInfoItem{ - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Location: to.Ptr("West Europe"), - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("West US"), - // to.Ptr("West Europe")}, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_L16s_v3"), - // LocationInfo: []*armkusto.SKULocationInfoItem{ - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Location: to.Ptr("West Europe"), - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("West US"), - // to.Ptr("West Europe")}, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_L8as_v3"), - // LocationInfo: []*armkusto.SKULocationInfoItem{ - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Location: to.Ptr("West Europe"), - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("West US"), - // to.Ptr("West Europe")}, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_L16as_v3"), - // LocationInfo: []*armkusto.SKULocationInfoItem{ - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Location: to.Ptr("West Europe"), - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("West US"), - // to.Ptr("West Europe")}, - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersCheckNameAvailability.json -func ExampleClustersClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().CheckNameAvailability(ctx, "westus", armkusto.ClusterCheckNameRequest{ - Name: to.Ptr("kustoCluster"), - Type: to.Ptr("Microsoft.Kusto/clusters"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("kuskusprod"), - // Message: to.Ptr("Name 'kuskusprod' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClustersListResourceSkus.json -func ExampleClustersClient_NewListSKUsByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListSKUsByResourcePager("kustorptest", "kustoCluster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ListResourceSKUsResult = armkusto.ListResourceSKUsResult{ - // Value: []*armkusto.AzureResourceSKU{ - // { - // Capacity: &armkusto.AzureCapacity{ - // Default: to.Ptr[int32](2), - // Maximum: to.Ptr[int32](100), - // Minimum: to.Ptr[int32](2), - // ScaleType: to.Ptr(armkusto.AzureScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("clusters"), - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL8SV3), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }, - // { - // Capacity: &armkusto.AzureCapacity{ - // Default: to.Ptr[int32](2), - // Maximum: to.Ptr[int32](100), - // Minimum: to.Ptr[int32](2), - // ScaleType: to.Ptr(armkusto.AzureScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("clusters"), - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL8AsV3), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }, - // { - // Capacity: &armkusto.AzureCapacity{ - // Default: to.Ptr[int32](2), - // Maximum: to.Ptr[int32](100), - // Minimum: to.Ptr[int32](2), - // ScaleType: to.Ptr(armkusto.AzureScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("clusters"), - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }, - // { - // Capacity: &armkusto.AzureCapacity{ - // Default: to.Ptr[int32](2), - // Maximum: to.Ptr[int32](100), - // Minimum: to.Ptr[int32](2), - // ScaleType: to.Ptr(armkusto.AzureScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("clusters"), - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16SV3), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoOutboundNetworkDependenciesList.json -func ExampleClustersClient_NewListOutboundNetworkDependenciesEndpointsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListOutboundNetworkDependenciesEndpointsPager("kustorptest", "kustoCluster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OutboundNetworkDependenciesEndpointListResult = armkusto.OutboundNetworkDependenciesEndpointListResult{ - // Value: []*armkusto.OutboundNetworkDependenciesEndpoint{ - // { - // Name: to.Ptr("kustoCluster/AzureActiveDirectory"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/OutboundNetworkDependenciesEndpoints"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/OutboundNetworkDependenciesEndpoints/AzureActiveDirectory"), - // Properties: &armkusto.OutboundNetworkDependenciesEndpointProperties{ - // Category: to.Ptr("Azure Active Directory"), - // Endpoints: []*armkusto.EndpointDependency{ - // { - // DomainName: to.Ptr("login.microsoftonline.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("graph.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("graph.microsoft.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("graph.microsoft-ppe.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster/AzureMonitor"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/OutboundNetworkDependenciesEndpoints"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/OutboundNetworkDependenciesEndpoints/AzureMonitor"), - // Properties: &armkusto.OutboundNetworkDependenciesEndpointProperties{ - // Category: to.Ptr("Azure Monitor"), - // Endpoints: []*armkusto.EndpointDependency{ - // { - // DomainName: to.Ptr("prod.warmpath.msftcloudes.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("gcs.prod.monitoring.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("production.diagnostics.monitoring.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("shoebox2.metrics.nsatc.net:443"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster/CertificateAuthority"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/OutboundNetworkDependenciesEndpoints"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/OutboundNetworkDependenciesEndpoints/CertificateAuthority"), - // Properties: &armkusto.OutboundNetworkDependenciesEndpointProperties{ - // Category: to.Ptr("Certificate Authority"), - // Endpoints: []*armkusto.EndpointDependency{ - // { - // DomainName: to.Ptr("ocsp.msocsp.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // }}, - // }, - // { - // DomainName: to.Ptr("ocsp.digicert.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // }}, - // }, - // { - // DomainName: to.Ptr("crl3.digicert.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // }}, - // }, - // { - // DomainName: to.Ptr("crl.microsoft.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // }}, - // }, - // { - // DomainName: to.Ptr("www.microsoft.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](80), - // }}, - // }}, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster/AzureStorage"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/OutboundNetworkDependenciesEndpoints"), - // ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/OutboundNetworkDependenciesEndpoints/AzureStorage"), - // Properties: &armkusto.OutboundNetworkDependenciesEndpointProperties{ - // Category: to.Ptr("Azure Storage"), - // Endpoints: []*armkusto.EndpointDependency{ - // { - // DomainName: to.Ptr("clusterinternalsa.blob.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("clusterinternalsa.queue.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("clusterinternalsa.table.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterListLanguageExtensions.json -func ExampleClustersClient_NewListLanguageExtensionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListLanguageExtensionsPager("kustorptest", "kustoCluster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LanguageExtensionsList = armkusto.LanguageExtensionsList{ - // Value: []*armkusto.LanguageExtension{ - // { - // LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), - // }, - // { - // LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterAddLanguageExtensions.json -func ExampleClustersClient_BeginAddLanguageExtensions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginAddLanguageExtensions(ctx, "kustorptest", "kustoCluster", armkusto.LanguageExtensionsList{ - Value: []*armkusto.LanguageExtension{ - { - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), - }, - { - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoClusterRemoveLanguageExtensions.json -func ExampleClustersClient_BeginRemoveLanguageExtensions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginRemoveLanguageExtensions(ctx, "kustorptest", "kustoCluster", armkusto.LanguageExtensionsList{ - Value: []*armkusto.LanguageExtension{ - { - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNamePYTHON), - }, - { - LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/constants.go b/sdk/resourcemanager/kusto/armkusto/constants.go index 69f76ab086e0..308a3cd033ff 100644 --- a/sdk/resourcemanager/kusto/armkusto/constants.go +++ b/sdk/resourcemanager/kusto/armkusto/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto const ( moduleName = "armkusto" - moduleVersion = "v2.0.0" + moduleVersion = "v2.0.1" ) // AzureSKUName - SKU name. @@ -806,14 +805,14 @@ func PossibleStatusValues() []Status { type Type string const ( - TypeMicrosoftKustoClustersDatabases Type = "Microsoft.Kusto/clusters/databases" TypeMicrosoftKustoClustersAttachedDatabaseConfigurations Type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" + TypeMicrosoftKustoClustersDatabases Type = "Microsoft.Kusto/clusters/databases" ) // PossibleTypeValues returns the possible values for the Type const type. func PossibleTypeValues() []Type { return []Type{ - TypeMicrosoftKustoClustersDatabases, TypeMicrosoftKustoClustersAttachedDatabaseConfigurations, + TypeMicrosoftKustoClustersDatabases, } } diff --git a/sdk/resourcemanager/kusto/armkusto/database_client.go b/sdk/resourcemanager/kusto/armkusto/database_client.go index b8ce8f15f7c9..cb19c0a06c4c 100644 --- a/sdk/resourcemanager/kusto/armkusto/database_client.go +++ b/sdk/resourcemanager/kusto/armkusto/database_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -54,18 +53,21 @@ func NewDatabaseClient(subscriptionID string, credential azcore.TokenCredential, // - parameters - The follower invitation request parameters. // - options - DatabaseClientInviteFollowerOptions contains the optional parameters for the DatabaseClient.InviteFollower method. func (client *DatabaseClient) InviteFollower(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseInviteFollowerRequest, options *DatabaseClientInviteFollowerOptions) (DatabaseClientInviteFollowerResponse, error) { + var err error req, err := client.inviteFollowerCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return DatabaseClientInviteFollowerResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabaseClientInviteFollowerResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabaseClientInviteFollowerResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabaseClientInviteFollowerResponse{}, err } - return client.inviteFollowerHandleResponse(resp) + resp, err := client.inviteFollowerHandleResponse(httpResp) + return resp, err } // inviteFollowerCreateRequest creates the InviteFollower request. @@ -95,7 +97,10 @@ func (client *DatabaseClient) inviteFollowerCreateRequest(ctx context.Context, r reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // inviteFollowerHandleResponse handles the InviteFollower response. diff --git a/sdk/resourcemanager/kusto/armkusto/database_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/database_client_example_test.go deleted file mode 100644 index 4f7ce944e536..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/database_client_example_test.go +++ /dev/null @@ -1,61 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabaseInviteFollower.json -func ExampleDatabaseClient_InviteFollower() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabaseClient().InviteFollower(ctx, "kustorptest", "kustoCluster", "database", armkusto.DatabaseInviteFollowerRequest{ - InviteeEmail: to.Ptr("invitee@contoso.com"), - TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ - ExternalTablesToExclude: []*string{}, - ExternalTablesToInclude: []*string{ - to.Ptr("ExternalTable*")}, - FunctionsToExclude: []*string{ - to.Ptr("functionsToExclude2")}, - FunctionsToInclude: []*string{ - to.Ptr("functionsToInclude1")}, - MaterializedViewsToExclude: []*string{ - to.Ptr("MaterializedViewTable2")}, - MaterializedViewsToInclude: []*string{ - to.Ptr("MaterializedViewTable1")}, - TablesToExclude: []*string{ - to.Ptr("Table2")}, - TablesToInclude: []*string{ - to.Ptr("Table1")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabaseInviteFollowerResult = armkusto.DatabaseInviteFollowerResult{ - // GeneratedInvitation: to.Ptr("eyJ0eXAiOiJKVInvitationToken"), - // } -} diff --git a/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go index c07fa78a1401..f2c40d6a2f9d 100644 --- a/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go +++ b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -55,18 +54,21 @@ func NewDatabasePrincipalAssignmentsClient(subscriptionID string, credential azc // - options - DatabasePrincipalAssignmentsClientCheckNameAvailabilityOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.CheckNameAvailability // method. func (client *DatabasePrincipalAssignmentsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName DatabasePrincipalAssignmentCheckNameRequest, options *DatabasePrincipalAssignmentsClientCheckNameAvailabilityOptions) (DatabasePrincipalAssignmentsClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName, options) if err != nil { return DatabasePrincipalAssignmentsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasePrincipalAssignmentsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasePrincipalAssignmentsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasePrincipalAssignmentsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -96,7 +98,10 @@ func (client *DatabasePrincipalAssignmentsClient) checkNameAvailabilityCreateReq reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, principalAssignmentName) + if err := runtime.MarshalAsJSON(req, principalAssignmentName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -125,9 +130,8 @@ func (client *DatabasePrincipalAssignmentsClient) BeginCreateOrUpdate(ctx contex if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasePrincipalAssignmentsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DatabasePrincipalAssignmentsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasePrincipalAssignmentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,18 +142,20 @@ func (client *DatabasePrincipalAssignmentsClient) BeginCreateOrUpdate(ctx contex // // Generated from API version 2023-05-02 func (client *DatabasePrincipalAssignmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, parameters DatabasePrincipalAssignment, options *DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -183,7 +189,10 @@ func (client *DatabasePrincipalAssignmentsClient) createOrUpdateCreateRequest(ct reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a Kusto principalAssignment. @@ -202,9 +211,8 @@ func (client *DatabasePrincipalAssignmentsClient) BeginDelete(ctx context.Contex if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasePrincipalAssignmentsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DatabasePrincipalAssignmentsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasePrincipalAssignmentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -215,18 +223,20 @@ func (client *DatabasePrincipalAssignmentsClient) BeginDelete(ctx context.Contex // // Generated from API version 2023-05-02 func (client *DatabasePrincipalAssignmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, options *DatabasePrincipalAssignmentsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -274,18 +284,21 @@ func (client *DatabasePrincipalAssignmentsClient) deleteCreateRequest(ctx contex // - options - DatabasePrincipalAssignmentsClientGetOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.Get // method. func (client *DatabasePrincipalAssignmentsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, options *DatabasePrincipalAssignmentsClientGetOptions) (DatabasePrincipalAssignmentsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, databaseName, principalAssignmentName, options) if err != nil { return DatabasePrincipalAssignmentsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasePrincipalAssignmentsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasePrincipalAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasePrincipalAssignmentsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go deleted file mode 100644 index 9a6016e8f87f..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go +++ /dev/null @@ -1,207 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasePrincipalAssignmentsCheckNameAvailability.json -func ExampleDatabasePrincipalAssignmentsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasePrincipalAssignmentsClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", armkusto.DatabasePrincipalAssignmentCheckNameRequest{ - Name: to.Ptr("kustoprincipal1"), - Type: to.Ptr("Microsoft.Kusto/clusters/databases/principalAssignments"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("kustoprincipal1"), - // Message: to.Ptr("Name 'kustoprincipal1' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasePrincipalAssignmentsGet.json -func ExampleDatabasePrincipalAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasePrincipalAssignmentsClient().Get(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabasePrincipalAssignment = armkusto.DatabasePrincipalAssignment{ - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoprincipal1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/PrincipalAssignments"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/PrincipalAssignments/kustoprincipal1"), - // Properties: &armkusto.DatabasePrincipalProperties{ - // AADObjectID: to.Ptr("98765432-1234-1234-1234-123456789123"), - // PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // PrincipalName: to.Ptr("TestApp"), - // PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - // TenantName: to.Ptr("tenantName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasePrincipalAssignmentsCreateOrUpdate.json -func ExampleDatabasePrincipalAssignmentsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasePrincipalAssignmentsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", armkusto.DatabasePrincipalAssignment{ - Properties: &armkusto.DatabasePrincipalProperties{ - PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabasePrincipalAssignment = armkusto.DatabasePrincipalAssignment{ - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoprincipal1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/PrincipalAssignments"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/PrincipalAssignments/kustoprincipal1"), - // Properties: &armkusto.DatabasePrincipalProperties{ - // AADObjectID: to.Ptr("98765432-1234-1234-1234-123456789123"), - // PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // PrincipalName: to.Ptr("TestApp"), - // PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - // TenantName: to.Ptr("tenantName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasePrincipalAssignmentsDelete.json -func ExampleDatabasePrincipalAssignmentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasePrincipalAssignmentsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasePrincipalAssignmentsList.json -func ExampleDatabasePrincipalAssignmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasePrincipalAssignmentsClient().NewListPager("kustorptest", "kustoCluster", "Kustodatabase8", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabasePrincipalAssignmentListResult = armkusto.DatabasePrincipalAssignmentListResult{ - // Value: []*armkusto.DatabasePrincipalAssignment{ - // { - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoprincipal1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/PrincipalAssignments"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/PrincipalAssignments/kustoprincipal1"), - // Properties: &armkusto.DatabasePrincipalProperties{ - // AADObjectID: to.Ptr("98765432-1234-1234-1234-123456789123"), - // PrincipalID: to.Ptr("11223344-1234-1234-1234-123456789999"), - // PrincipalName: to.Ptr("TestApp"), - // PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), - // TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - // TenantName: to.Ptr("tenantName"), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoprincipal2"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/PrincipalAssignments"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/PrincipalAssignments/kustoprincipal1"), - // Properties: &armkusto.DatabasePrincipalProperties{ - // AADObjectID: to.Ptr("98765432-1234-1234-1234-123456789123"), - // PrincipalID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // PrincipalName: to.Ptr("TestApp"), - // PrincipalType: to.Ptr(armkusto.PrincipalTypeApp), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // TenantID: to.Ptr("12345678-1234-1234-1234-123456789123"), - // TenantName: to.Ptr("tenantName"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/databases_client.go b/sdk/resourcemanager/kusto/armkusto/databases_client.go index 292e6483e692..188cdad23687 100644 --- a/sdk/resourcemanager/kusto/armkusto/databases_client.go +++ b/sdk/resourcemanager/kusto/armkusto/databases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -55,18 +54,21 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // - databasePrincipalsToAdd - List of database principals to add. // - options - DatabasesClientAddPrincipalsOptions contains the optional parameters for the DatabasesClient.AddPrincipals method. func (client *DatabasesClient) AddPrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest, options *DatabasesClientAddPrincipalsOptions) (DatabasesClientAddPrincipalsResponse, error) { + var err error req, err := client.addPrincipalsCreateRequest(ctx, resourceGroupName, clusterName, databaseName, databasePrincipalsToAdd, options) if err != nil { return DatabasesClientAddPrincipalsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientAddPrincipalsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientAddPrincipalsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientAddPrincipalsResponse{}, err } - return client.addPrincipalsHandleResponse(resp) + resp, err := client.addPrincipalsHandleResponse(httpResp) + return resp, err } // addPrincipalsCreateRequest creates the AddPrincipals request. @@ -96,7 +98,10 @@ func (client *DatabasesClient) addPrincipalsCreateRequest(ctx context.Context, r reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, databasePrincipalsToAdd) + if err := runtime.MarshalAsJSON(req, databasePrincipalsToAdd); err != nil { + return nil, err + } + return req, nil } // addPrincipalsHandleResponse handles the AddPrincipals response. @@ -118,18 +123,21 @@ func (client *DatabasesClient) addPrincipalsHandleResponse(resp *http.Response) // - options - DatabasesClientCheckNameAvailabilityOptions contains the optional parameters for the DatabasesClient.CheckNameAvailability // method. func (client *DatabasesClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest, options *DatabasesClientCheckNameAvailabilityOptions) (DatabasesClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, clusterName, resourceName, options) if err != nil { return DatabasesClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -155,7 +163,10 @@ func (client *DatabasesClient) checkNameAvailabilityCreateRequest(ctx context.Co reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resourceName) + if err := runtime.MarshalAsJSON(req, resourceName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -183,9 +194,8 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DatabasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -196,18 +206,20 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource // // Generated from API version 2023-05-02 func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseClassification, options *DatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -240,7 +252,10 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the database with the given name. @@ -257,9 +272,8 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DatabasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -270,18 +284,20 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam // // Generated from API version 2023-05-02 func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -323,18 +339,21 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource // - databaseName - The name of the database in the Kusto cluster. // - options - DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. func (client *DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientGetOptions) (DatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) if err != nil { return DatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -532,18 +551,21 @@ func (client *DatabasesClient) listPrincipalsHandleResponse(resp *http.Response) // - options - DatabasesClientRemovePrincipalsOptions contains the optional parameters for the DatabasesClient.RemovePrincipals // method. func (client *DatabasesClient) RemovePrincipals(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest, options *DatabasesClientRemovePrincipalsOptions) (DatabasesClientRemovePrincipalsResponse, error) { + var err error req, err := client.removePrincipalsCreateRequest(ctx, resourceGroupName, clusterName, databaseName, databasePrincipalsToRemove, options) if err != nil { return DatabasesClientRemovePrincipalsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientRemovePrincipalsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientRemovePrincipalsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientRemovePrincipalsResponse{}, err } - return client.removePrincipalsHandleResponse(resp) + resp, err := client.removePrincipalsHandleResponse(httpResp) + return resp, err } // removePrincipalsCreateRequest creates the RemovePrincipals request. @@ -573,7 +595,10 @@ func (client *DatabasesClient) removePrincipalsCreateRequest(ctx context.Context reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, databasePrincipalsToRemove) + if err := runtime.MarshalAsJSON(req, databasePrincipalsToRemove); err != nil { + return nil, err + } + return req, nil } // removePrincipalsHandleResponse handles the RemovePrincipals response. @@ -600,9 +625,8 @@ func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DatabasesClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -613,18 +637,20 @@ func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupNam // // Generated from API version 2023-05-02 func (client *DatabasesClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseClassification, options *DatabasesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -657,5 +683,8 @@ func (client *DatabasesClient) updateCreateRequest(ctx context.Context, resource } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go deleted file mode 100644 index d468a9c57f3c..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go +++ /dev/null @@ -1,546 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasesCheckNameAvailability.json -func ExampleDatabasesClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.CheckNameRequest{ - Name: to.Ptr("database1"), - Type: to.Ptr(armkusto.TypeMicrosoftKustoClustersDatabases), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("database1"), - // Message: to.Ptr("Name 'database1' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasesListByCluster.json -func ExampleDatabasesClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListByClusterPager("kustorptest", "kustoCluster", &armkusto.DatabasesClientListByClusterOptions{Top: nil, - Skiptoken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseListResult = armkusto.DatabaseListResult{ - // Value: []armkusto.DatabaseClassification{ - // &armkusto.ReadWriteDatabase{ - // Name: to.Ptr("kustoCluster/KustoDatabase8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8"), - // Kind: to.Ptr(armkusto.KindReadWrite), - // Location: to.Ptr("westus"), - // Properties: &armkusto.ReadWriteDatabaseProperties{ - // HotCachePeriod: to.Ptr("P1D"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // SoftDeletePeriod: to.Ptr("P1D"), - // }, - // }, - // &armkusto.ReadOnlyFollowingDatabase{ - // Name: to.Ptr("kustoCluster/KustoDatabase9"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase9"), - // Kind: to.Ptr(armkusto.KindReadOnlyFollowing), - // Location: to.Ptr("westus"), - // Properties: &armkusto.ReadOnlyFollowingDatabaseProperties{ - // AttachedDatabaseConfigurationName: to.Ptr("attachedDatabaseConfigurationsTest"), - // DatabaseShareOrigin: to.Ptr(armkusto.DatabaseShareOriginDirect), - // HotCachePeriod: to.Ptr("P1D"), - // LeaderClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), - // OriginalDatabaseName: to.Ptr("KustoDatabase9"), - // PrincipalsModificationKind: to.Ptr(armkusto.PrincipalsModificationKindUnion), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // SoftDeletePeriod: to.Ptr("P1D"), - // Statistics: &armkusto.DatabaseStatistics{ - // Size: to.Ptr[float32](1024), - // }, - // TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ - // ExternalTablesToExclude: []*string{ - // to.Ptr("ExternalTable2")}, - // ExternalTablesToInclude: []*string{ - // to.Ptr("ExternalTable1")}, - // MaterializedViewsToExclude: []*string{ - // to.Ptr("MaterializedViewTable2")}, - // MaterializedViewsToInclude: []*string{ - // to.Ptr("MaterializedViewTable1")}, - // TablesToExclude: []*string{ - // to.Ptr("Table2")}, - // TablesToInclude: []*string{ - // to.Ptr("Table1")}, - // }, - // }, - // }, - // &armkusto.ReadWriteDatabase{ - // Name: to.Ptr("kustoCluster/KustoDatabase10"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase10"), - // Kind: to.Ptr(armkusto.KindReadWrite), - // Location: to.Ptr("westus"), - // Properties: &armkusto.ReadWriteDatabaseProperties{ - // HotCachePeriod: to.Ptr("P1D"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // SoftDeletePeriod: to.Ptr("P1D"), - // SuspensionDetails: &armkusto.SuspensionDetails{ - // SuspensionStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-16T15:06:54.2757906Z"); return t}()), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasesGet.json -func ExampleDatabasesClient_Get_kustoDatabasesGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DatabasesClientGetResponse{ - // DatabaseClassification: &armkusto.ReadWriteDatabase{ - // Name: to.Ptr("kustoCluster/KustoDatabase8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8"), - // Kind: to.Ptr(armkusto.KindReadWrite), - // Location: to.Ptr("westus"), - // Properties: &armkusto.ReadWriteDatabaseProperties{ - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // SoftDeletePeriod: to.Ptr("P1D"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoSuspendedDatabasesGet.json -func ExampleDatabasesClient_Get_kustoSuspendedDatabasesGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase9", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DatabasesClientGetResponse{ - // DatabaseClassification: &armkusto.ReadWriteDatabase{ - // Name: to.Ptr("kustoCluster/KustoDatabase9"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase9"), - // Kind: to.Ptr(armkusto.KindReadWrite), - // Location: to.Ptr("westus"), - // Properties: &armkusto.ReadWriteDatabaseProperties{ - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // SoftDeletePeriod: to.Ptr("P1D"), - // SuspensionDetails: &armkusto.SuspensionDetails{ - // SuspensionStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-04-16T15:06:54.2757906Z"); return t}()), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabaseReadonlyUpdate.json -func ExampleDatabasesClient_BeginCreateOrUpdate_kustoReadOnlyDatabaseUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "kustoReadOnlyDatabase", &armkusto.ReadOnlyFollowingDatabase{ - Kind: to.Ptr(armkusto.KindReadOnlyFollowing), - Location: to.Ptr("westus"), - Properties: &armkusto.ReadOnlyFollowingDatabaseProperties{ - HotCachePeriod: to.Ptr("P1D"), - }, - }, &armkusto.DatabasesClientBeginCreateOrUpdateOptions{CallerRole: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DatabasesClientCreateOrUpdateResponse{ - // DatabaseClassification: &armkusto.ReadOnlyFollowingDatabase{ - // Name: to.Ptr("kustoCluster/kustoReadOnlyDatabase"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/kustoReadOnlyDatabase"), - // Kind: to.Ptr(armkusto.KindReadOnlyFollowing), - // Location: to.Ptr("westus"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasesCreateOrUpdate.json -func ExampleDatabasesClient_BeginCreateOrUpdate_kustoReadWriteDatabaseCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", &armkusto.ReadWriteDatabase{ - Kind: to.Ptr(armkusto.KindReadWrite), - Location: to.Ptr("westus"), - Properties: &armkusto.ReadWriteDatabaseProperties{ - SoftDeletePeriod: to.Ptr("P1D"), - }, - }, &armkusto.DatabasesClientBeginCreateOrUpdateOptions{CallerRole: to.Ptr(armkusto.CallerRoleAdmin)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DatabasesClientCreateOrUpdateResponse{ - // DatabaseClassification: &armkusto.ReadWriteDatabase{ - // Name: to.Ptr("kustoCluster/KustoDatabase8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8"), - // Kind: to.Ptr(armkusto.KindReadWrite), - // Location: to.Ptr("westus"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasesUpdate.json -func ExampleDatabasesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", &armkusto.ReadWriteDatabase{ - Kind: to.Ptr(armkusto.KindReadWrite), - Properties: &armkusto.ReadWriteDatabaseProperties{ - HotCachePeriod: to.Ptr("P1D"), - }, - }, &armkusto.DatabasesClientBeginUpdateOptions{CallerRole: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DatabasesClientUpdateResponse{ - // DatabaseClassification: &armkusto.ReadWriteDatabase{ - // Name: to.Ptr("kustoCluster/KustoDatabase8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8"), - // Kind: to.Ptr(armkusto.KindReadWrite), - // Location: to.Ptr("westus"), - // Properties: &armkusto.ReadWriteDatabaseProperties{ - // HotCachePeriod: to.Ptr("P1D"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabasesDelete.json -func ExampleDatabasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabaseListPrincipals.json -func ExampleDatabasesClient_NewListPrincipalsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListPrincipalsPager("kustorptest", "kustoCluster", "KustoDatabase8", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabasePrincipalListResult = armkusto.DatabasePrincipalListResult{ - // Value: []*armkusto.DatabasePrincipal{ - // { - // Name: to.Ptr("Some User"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), - // AppID: to.Ptr(""), - // Email: to.Ptr("user@microsoft.com"), - // Fqn: to.Ptr("aaduser=some_guid"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // }, - // { - // Name: to.Ptr("Kusto"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), - // AppID: to.Ptr(""), - // Email: to.Ptr("kusto@microsoft.com"), - // Fqn: to.Ptr("aadgroup=some_guid"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), - // }, - // { - // Name: to.Ptr("SomeApp"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), - // AppID: to.Ptr("some_guid_app_id"), - // Email: to.Ptr(""), - // Fqn: to.Ptr("aadapp=some_guid_app_id"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabaseAddPrincipals.json -func ExampleDatabasesClient_AddPrincipals() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().AddPrincipals(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DatabasePrincipalListRequest{ - Value: []*armkusto.DatabasePrincipal{ - { - Name: to.Ptr("Some User"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), - AppID: to.Ptr(""), - Email: to.Ptr("user@microsoft.com"), - Fqn: to.Ptr("aaduser=some_guid"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - }, - { - Name: to.Ptr("Kusto"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), - AppID: to.Ptr(""), - Email: to.Ptr("kusto@microsoft.com"), - Fqn: to.Ptr("aadgroup=some_guid"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), - }, - { - Name: to.Ptr("SomeApp"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), - AppID: to.Ptr("some_guid_app_id"), - Email: to.Ptr(""), - Fqn: to.Ptr("aadapp=some_guid_app_id"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabasePrincipalListResult = armkusto.DatabasePrincipalListResult{ - // Value: []*armkusto.DatabasePrincipal{ - // { - // Name: to.Ptr("Some User"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), - // AppID: to.Ptr(""), - // Email: to.Ptr("user@microsoft.com"), - // Fqn: to.Ptr("aaduser=some_guid"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // }, - // { - // Name: to.Ptr("Kusto"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), - // AppID: to.Ptr(""), - // Email: to.Ptr("kusto@microsoft.com"), - // Fqn: to.Ptr("aadgroup=some_guid"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), - // }, - // { - // Name: to.Ptr("SomeApp"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), - // AppID: to.Ptr("some_guid_app_id"), - // Email: to.Ptr(""), - // Fqn: to.Ptr("aadapp=some_guid_app_id"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDatabaseRemovePrincipals.json -func ExampleDatabasesClient_RemovePrincipals() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().RemovePrincipals(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DatabasePrincipalListRequest{ - Value: []*armkusto.DatabasePrincipal{ - { - Name: to.Ptr("Some User"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), - AppID: to.Ptr(""), - Email: to.Ptr("user@microsoft.com"), - Fqn: to.Ptr("aaduser=some_guid"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - }, - { - Name: to.Ptr("Kusto"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), - AppID: to.Ptr(""), - Email: to.Ptr("kusto@microsoft.com"), - Fqn: to.Ptr("aadgroup=some_guid"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), - }, - { - Name: to.Ptr("SomeApp"), - Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), - AppID: to.Ptr("some_guid_app_id"), - Email: to.Ptr(""), - Fqn: to.Ptr("aadapp=some_guid_app_id"), - Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DatabasePrincipalListResult = armkusto.DatabasePrincipalListResult{ - // Value: []*armkusto.DatabasePrincipal{ - // { - // Name: to.Ptr("Some User"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeUser), - // AppID: to.Ptr(""), - // Email: to.Ptr("user@microsoft.com"), - // Fqn: to.Ptr("aaduser=some_guid"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // }, - // { - // Name: to.Ptr("Kusto"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeGroup), - // AppID: to.Ptr(""), - // Email: to.Ptr("kusto@microsoft.com"), - // Fqn: to.Ptr("aadgroup=some_guid"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleViewer), - // }, - // { - // Name: to.Ptr("SomeApp"), - // Type: to.Ptr(armkusto.DatabasePrincipalTypeApp), - // AppID: to.Ptr("some_guid_app_id"), - // Email: to.Ptr(""), - // Fqn: to.Ptr("aadapp=some_guid_app_id"), - // Role: to.Ptr(armkusto.DatabasePrincipalRoleAdmin), - // }}, - // } -} diff --git a/sdk/resourcemanager/kusto/armkusto/dataconnections_client.go b/sdk/resourcemanager/kusto/armkusto/dataconnections_client.go index 7a3f985c9108..1feaf5a6abef 100644 --- a/sdk/resourcemanager/kusto/armkusto/dataconnections_client.go +++ b/sdk/resourcemanager/kusto/armkusto/dataconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -55,18 +54,21 @@ func NewDataConnectionsClient(subscriptionID string, credential azcore.TokenCred // - options - DataConnectionsClientCheckNameAvailabilityOptions contains the optional parameters for the DataConnectionsClient.CheckNameAvailability // method. func (client *DataConnectionsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName DataConnectionCheckNameRequest, options *DataConnectionsClientCheckNameAvailabilityOptions) (DataConnectionsClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, options) if err != nil { return DataConnectionsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataConnectionsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataConnectionsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataConnectionsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -96,7 +98,10 @@ func (client *DataConnectionsClient) checkNameAvailabilityCreateRequest(ctx cont reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, dataConnectionName) + if err := runtime.MarshalAsJSON(req, dataConnectionName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -125,9 +130,8 @@ func (client *DataConnectionsClient) BeginCreateOrUpdate(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataConnectionsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DataConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DataConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,18 +142,20 @@ func (client *DataConnectionsClient) BeginCreateOrUpdate(ctx context.Context, re // // Generated from API version 2023-05-02 func (client *DataConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters DataConnectionClassification, options *DataConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -183,7 +189,10 @@ func (client *DataConnectionsClient) createOrUpdateCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDataConnectionValidation - Checks that the data connection parameters are valid. @@ -202,9 +211,8 @@ func (client *DataConnectionsClient) BeginDataConnectionValidation(ctx context.C if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataConnectionsClientDataConnectionValidationResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DataConnectionsClientDataConnectionValidationResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DataConnectionsClientDataConnectionValidationResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -215,18 +223,20 @@ func (client *DataConnectionsClient) BeginDataConnectionValidation(ctx context.C // // Generated from API version 2023-05-02 func (client *DataConnectionsClient) dataConnectionValidation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DataConnectionValidation, options *DataConnectionsClientBeginDataConnectionValidationOptions) (*http.Response, error) { + var err error req, err := client.dataConnectionValidationCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // dataConnectionValidationCreateRequest creates the DataConnectionValidation request. @@ -256,7 +266,10 @@ func (client *DataConnectionsClient) dataConnectionValidationCreateRequest(ctx c reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the data connection with the given name. @@ -275,9 +288,8 @@ func (client *DataConnectionsClient) BeginDelete(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataConnectionsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DataConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DataConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -288,18 +300,20 @@ func (client *DataConnectionsClient) BeginDelete(ctx context.Context, resourceGr // // Generated from API version 2023-05-02 func (client *DataConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, options *DataConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -346,18 +360,21 @@ func (client *DataConnectionsClient) deleteCreateRequest(ctx context.Context, re // - dataConnectionName - The name of the data connection. // - options - DataConnectionsClientGetOptions contains the optional parameters for the DataConnectionsClient.Get method. func (client *DataConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, options *DataConnectionsClientGetOptions) (DataConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, options) if err != nil { return DataConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DataConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DataConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -489,9 +506,8 @@ func (client *DataConnectionsClient) BeginUpdate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DataConnectionsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[DataConnectionsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DataConnectionsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -502,18 +518,20 @@ func (client *DataConnectionsClient) BeginUpdate(ctx context.Context, resourceGr // // Generated from API version 2023-05-02 func (client *DataConnectionsClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters DataConnectionClassification, options *DataConnectionsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, dataConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -547,5 +565,8 @@ func (client *DataConnectionsClient) updateCreateRequest(ctx context.Context, re reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go deleted file mode 100644 index 8896a6f6f58b..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go +++ /dev/null @@ -1,703 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsListByDatabase.json -func ExampleDataConnectionsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataConnectionsClient().NewListByDatabasePager("kustorptest", "kustoCluster", "KustoDatabase8", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataConnectionListResult = armkusto.DataConnectionListResult{ - // Value: []armkusto.DataConnectionClassification{ - // &armkusto.EventHubDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/KustoDataConnection1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection1"), - // Kind: to.Ptr(armkusto.DataConnectionKindEventHub), - // Location: to.Ptr("westus"), - // Properties: &armkusto.EventHubConnectionProperties{ - // Compression: to.Ptr(armkusto.CompressionNone), - // ConsumerGroup: to.Ptr("$Default"), - // DataFormat: to.Ptr(armkusto.EventHubDataFormatJSON), - // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - // EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - // EventSystemProperties: []*string{ - // }, - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t}()), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // &armkusto.EventGridDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/KustoDataConnection2"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection2"), - // Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - // Location: to.Ptr("westus"), - // Properties: &armkusto.EventGridConnectionProperties{ - // BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - // ConsumerGroup: to.Ptr("$Default"), - // DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - // EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - // EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), - // IgnoreFirstRecord: to.Ptr(false), - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // &armkusto.CosmosDbDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/KustoDataConnection3"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection3"), - // Kind: to.Ptr(armkusto.DataConnectionKindCosmosDb), - // Location: to.Ptr("westus"), - // Properties: &armkusto.CosmosDbDataConnectionProperties{ - // CosmosDbAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.DocumentDb/databaseAccounts/cosmosDbAccountTest1"), - // CosmosDbContainer: to.Ptr("cosmosDbContainerTest"), - // CosmosDbDatabase: to.Ptr("cosmosDbDatabaseTest"), - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t}()), - // TableName: to.Ptr("TestTable"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionEventGridValidationAsync.json -func ExampleDataConnectionsClient_BeginDataConnectionValidation_kustoDataConnectionEventGridValidation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginDataConnectionValidation(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DataConnectionValidation{ - DataConnectionName: to.Ptr("dataConnectionTest"), - Properties: &armkusto.EventGridDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - Properties: &armkusto.EventGridConnectionProperties{ - BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - ConsumerGroup: to.Ptr("$Default"), - DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - IgnoreFirstRecord: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - MappingRuleName: to.Ptr("TestMapping"), - StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - TableName: to.Ptr("TestTable"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataConnectionValidationListResult = armkusto.DataConnectionValidationListResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionValidationAsync.json -func ExampleDataConnectionsClient_BeginDataConnectionValidation_kustoDataConnectionValidation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginDataConnectionValidation(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DataConnectionValidation{ - DataConnectionName: to.Ptr("dataConnectionTest"), - Properties: &armkusto.EventHubDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventHub), - Properties: &armkusto.EventHubConnectionProperties{ - Compression: to.Ptr(armkusto.CompressionNone), - ConsumerGroup: to.Ptr("testConsumerGroup1"), - DataFormat: to.Ptr(armkusto.EventHubDataFormatJSON), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - MappingRuleName: to.Ptr("TestMapping"), - TableName: to.Ptr("TestTable"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DataConnectionValidationListResult = armkusto.DataConnectionValidationListResult{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsCheckNameAvailability.json -func ExampleDataConnectionsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectionsClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DataConnectionCheckNameRequest{ - Name: to.Ptr("DataConnections8"), - Type: to.Ptr("Microsoft.Kusto/clusters/databases/dataConnections"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("DataConnections8"), - // Message: to.Ptr("Name 'DataConnections8' is already taken. Please specify a different name."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armkusto.ReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsCosmosDbGet.json -func ExampleDataConnectionsClient_Get_kustoDataConnectionsCosmosDbGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectionsClient().Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase1", "dataConnectionTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientGetResponse{ - // DataConnectionClassification: &armkusto.CosmosDbDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase1/KustoDataConnection1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase1/DataConnections/KustoDataConnection1"), - // Kind: to.Ptr(armkusto.DataConnectionKindCosmosDb), - // Location: to.Ptr("westus"), - // Properties: &armkusto.CosmosDbDataConnectionProperties{ - // CosmosDbAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.DocumentDb/databaseAccounts/cosmosDbAccountTest1"), - // CosmosDbContainer: to.Ptr("cosmosDbContainerTest"), - // CosmosDbDatabase: to.Ptr("cosmosDbDatabaseTest"), - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t}()), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsEventGridGet.json -func ExampleDataConnectionsClient_Get_kustoDataConnectionsEventGridGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectionsClient().Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientGetResponse{ - // DataConnectionClassification: &armkusto.EventGridDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection9"), - // Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - // Location: to.Ptr("westus"), - // Properties: &armkusto.EventGridConnectionProperties{ - // BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - // ConsumerGroup: to.Ptr("$Default"), - // DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - // EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - // EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), - // IgnoreFirstRecord: to.Ptr(false), - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsGet.json -func ExampleDataConnectionsClient_Get_kustoDataConnectionsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectionsClient().Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientGetResponse{ - // DataConnectionClassification: &armkusto.EventHubDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/dataConnectionTest"), - // Kind: to.Ptr(armkusto.DataConnectionKindEventHub), - // Location: to.Ptr("westus"), - // Properties: &armkusto.EventHubConnectionProperties{ - // Compression: to.Ptr(armkusto.CompressionNone), - // ConsumerGroup: to.Ptr("$Default"), - // DataFormat: to.Ptr(armkusto.EventHubDataFormatJSON), - // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - // EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - // EventSystemProperties: []*string{ - // }, - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t}()), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsCosmosDbCreateOrUpdate.json -func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsCosmosDbCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase1", "dataConnectionTest", &armkusto.CosmosDbDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindCosmosDb), - Location: to.Ptr("westus"), - Properties: &armkusto.CosmosDbDataConnectionProperties{ - CosmosDbAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.DocumentDb/databaseAccounts/cosmosDbAccountTest1"), - CosmosDbContainer: to.Ptr("cosmosDbContainerTest"), - CosmosDbDatabase: to.Ptr("cosmosDbDatabaseTest"), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - MappingRuleName: to.Ptr("TestMapping"), - RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t }()), - TableName: to.Ptr("TestTable"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientCreateOrUpdateResponse{ - // DataConnectionClassification: &armkusto.CosmosDbDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase1/dataConnectionTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase1/DataConnections/dataConnectionTest"), - // Kind: to.Ptr(armkusto.DataConnectionKindCosmosDb), - // Location: to.Ptr("westus"), - // Properties: &armkusto.CosmosDbDataConnectionProperties{ - // CosmosDbAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.DocumentDb/databaseAccounts/cosmosDbAccountTest1"), - // CosmosDbContainer: to.Ptr("cosmosDbContainerTest"), - // CosmosDbDatabase: to.Ptr("cosmosDbDatabaseTest"), - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t}()), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsCreateOrUpdate.json -func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventHubDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventHub), - Location: to.Ptr("westus"), - Properties: &armkusto.EventHubConnectionProperties{ - ConsumerGroup: to.Ptr("testConsumerGroup1"), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientCreateOrUpdateResponse{ - // DataConnectionClassification: &armkusto.EventHubDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/dataConnectionTest"), - // Kind: to.Ptr(armkusto.DataConnectionKindEventHub), - // Location: to.Ptr("westus"), - // Properties: &armkusto.EventHubConnectionProperties{ - // Compression: to.Ptr(armkusto.CompressionNone), - // ConsumerGroup: to.Ptr("testConsumerGroup1"), - // EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsEventGridCreateOrUpdate.json -func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsEventGridCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventGridDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - Location: to.Ptr("westus"), - Properties: &armkusto.EventGridConnectionProperties{ - BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - ConsumerGroup: to.Ptr("$Default"), - DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), - IgnoreFirstRecord: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - MappingRuleName: to.Ptr("TestMapping"), - StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - TableName: to.Ptr("TestTable"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientCreateOrUpdateResponse{ - // DataConnectionClassification: &armkusto.EventGridDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection9"), - // Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - // Location: to.Ptr("westus"), - // Properties: &armkusto.EventGridConnectionProperties{ - // BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - // ConsumerGroup: to.Ptr("$Default"), - // DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - // EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - // EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), - // IgnoreFirstRecord: to.Ptr(false), - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsCosmosDbUpdate.json -func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsCosmosDbUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase1", "dataConnectionTest", &armkusto.CosmosDbDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindCosmosDb), - Location: to.Ptr("westus"), - Properties: &armkusto.CosmosDbDataConnectionProperties{ - CosmosDbAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.DocumentDb/databaseAccounts/cosmosDbAccountTest1"), - CosmosDbContainer: to.Ptr("cosmosDbContainerTest"), - CosmosDbDatabase: to.Ptr("cosmosDbDatabaseTest"), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - MappingRuleName: to.Ptr("TestMapping"), - RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t }()), - TableName: to.Ptr("TestTable"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientUpdateResponse{ - // DataConnectionClassification: &armkusto.CosmosDbDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase1/dataConnectionTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase1/DataConnections/dataConnectionTest"), - // Kind: to.Ptr(armkusto.DataConnectionKindCosmosDb), - // Location: to.Ptr("westus"), - // Properties: &armkusto.CosmosDbDataConnectionProperties{ - // CosmosDbAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.DocumentDb/databaseAccounts/cosmosDbAccountTest1"), - // CosmosDbContainer: to.Ptr("cosmosDbContainerTest"), - // CosmosDbDatabase: to.Ptr("cosmosDbDatabaseTest"), - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t}()), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsEventGridUpdate.json -func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsEventGridUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventGridDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - Location: to.Ptr("westus"), - Properties: &armkusto.EventGridConnectionProperties{ - BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - ConsumerGroup: to.Ptr("$Default"), - DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), - IgnoreFirstRecord: to.Ptr(false), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - MappingRuleName: to.Ptr("TestMapping"), - StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - TableName: to.Ptr("TestTable"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientUpdateResponse{ - // DataConnectionClassification: &armkusto.EventGridDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection9"), - // Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), - // Location: to.Ptr("westus"), - // Properties: &armkusto.EventGridConnectionProperties{ - // BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - // ConsumerGroup: to.Ptr("$Default"), - // DataFormat: to.Ptr(armkusto.EventGridDataFormatJSON), - // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), - // EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), - // EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), - // IgnoreFirstRecord: to.Ptr(false), - // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // MappingRuleName: to.Ptr("TestMapping"), - // StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // TableName: to.Ptr("TestTable"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsUpdate.json -func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventHubDataConnection{ - Kind: to.Ptr(armkusto.DataConnectionKindEventHub), - Location: to.Ptr("westus"), - Properties: &armkusto.EventHubConnectionProperties{ - ConsumerGroup: to.Ptr("testConsumerGroup1"), - EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armkusto.DataConnectionsClientUpdateResponse{ - // DataConnectionClassification: &armkusto.EventHubDataConnection{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/dataConnectionTest"), - // Kind: to.Ptr(armkusto.DataConnectionKindEventHub), - // Location: to.Ptr("westus"), - // Properties: &armkusto.EventHubConnectionProperties{ - // Compression: to.Ptr(armkusto.CompressionNone), - // ConsumerGroup: to.Ptr("testConsumerGroup1"), - // EventHubResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), - // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoDataConnectionsDelete.json -func ExampleDataConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDataConnectionsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/go.mod b/sdk/resourcemanager/kusto/armkusto/go.mod index e3f7548f8f2f..1e0332314e58 100644 --- a/sdk/resourcemanager/kusto/armkusto/go.mod +++ b/sdk/resourcemanager/kusto/armkusto/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.7.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/kusto/armkusto/go.sum b/sdk/resourcemanager/kusto/armkusto/go.sum index 21718b486698..727ce838bdc8 100644 --- a/sdk/resourcemanager/kusto/armkusto/go.sum +++ b/sdk/resourcemanager/kusto/armkusto/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/kusto/armkusto/interfaces.go b/sdk/resourcemanager/kusto/armkusto/interfaces.go new file mode 100644 index 000000000000..afc499ed8d22 --- /dev/null +++ b/sdk/resourcemanager/kusto/armkusto/interfaces.go @@ -0,0 +1,27 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armkusto + +// DataConnectionClassification provides polymorphic access to related types. +// Call the interface's GetDataConnection() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *CosmosDbDataConnection, *DataConnection, *EventGridDataConnection, *EventHubDataConnection, *IotHubDataConnection +type DataConnectionClassification interface { + // GetDataConnection returns the DataConnection content of the underlying type. + GetDataConnection() *DataConnection +} + +// DatabaseClassification provides polymorphic access to related types. +// Call the interface's GetDatabase() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *Database, *ReadOnlyFollowingDatabase, *ReadWriteDatabase +type DatabaseClassification interface { + // GetDatabase returns the Database content of the underlying type. + GetDatabase() *Database +} diff --git a/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go index c0a85ff22c77..701f8cb64a2e 100644 --- a/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go +++ b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -54,18 +53,21 @@ func NewManagedPrivateEndpointsClient(subscriptionID string, credential azcore.T // - options - ManagedPrivateEndpointsClientCheckNameAvailabilityOptions contains the optional parameters for the ManagedPrivateEndpointsClient.CheckNameAvailability // method. func (client *ManagedPrivateEndpointsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, resourceName ManagedPrivateEndpointsCheckNameRequest, options *ManagedPrivateEndpointsClientCheckNameAvailabilityOptions) (ManagedPrivateEndpointsClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, clusterName, resourceName, options) if err != nil { return ManagedPrivateEndpointsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedPrivateEndpointsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedPrivateEndpointsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedPrivateEndpointsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -91,7 +93,10 @@ func (client *ManagedPrivateEndpointsClient) checkNameAvailabilityCreateRequest( reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resourceName) + if err := runtime.MarshalAsJSON(req, resourceName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -119,9 +124,8 @@ func (client *ManagedPrivateEndpointsClient) BeginCreateOrUpdate(ctx context.Con if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ManagedPrivateEndpointsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedPrivateEndpointsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -132,18 +136,20 @@ func (client *ManagedPrivateEndpointsClient) BeginCreateOrUpdate(ctx context.Con // // Generated from API version 2023-05-02 func (client *ManagedPrivateEndpointsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, options *ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -173,7 +179,10 @@ func (client *ManagedPrivateEndpointsClient) createOrUpdateCreateRequest(ctx con reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a managed private endpoint. @@ -191,9 +200,8 @@ func (client *ManagedPrivateEndpointsClient) BeginDelete(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ManagedPrivateEndpointsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedPrivateEndpointsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -204,18 +212,20 @@ func (client *ManagedPrivateEndpointsClient) BeginDelete(ctx context.Context, re // // Generated from API version 2023-05-02 func (client *ManagedPrivateEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -258,18 +268,21 @@ func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Con // - options - ManagedPrivateEndpointsClientGetOptions contains the optional parameters for the ManagedPrivateEndpointsClient.Get // method. func (client *ManagedPrivateEndpointsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientGetOptions) (ManagedPrivateEndpointsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, options) if err != nil { return ManagedPrivateEndpointsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagedPrivateEndpointsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedPrivateEndpointsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagedPrivateEndpointsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -391,9 +404,8 @@ func (client *ManagedPrivateEndpointsClient) BeginUpdate(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ManagedPrivateEndpointsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ManagedPrivateEndpointsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagedPrivateEndpointsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -404,18 +416,20 @@ func (client *ManagedPrivateEndpointsClient) BeginUpdate(ctx context.Context, re // // Generated from API version 2023-05-02 func (client *ManagedPrivateEndpointsClient) update(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, options *ManagedPrivateEndpointsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, managedPrivateEndpointName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -445,5 +459,8 @@ func (client *ManagedPrivateEndpointsClient) updateCreateRequest(ctx context.Con reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go deleted file mode 100644 index 014e95a4e592..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go +++ /dev/null @@ -1,226 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoManagedPrivateEndpointsCheckNameAvailability.json -func ExampleManagedPrivateEndpointsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedPrivateEndpointsClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.ManagedPrivateEndpointsCheckNameRequest{ - Name: to.Ptr("pme1"), - Type: to.Ptr("Microsoft.Kusto/clusters/managedPrivateEndpoints"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("pme1"), - // Message: to.Ptr("Name 'pme1' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoManagedPrivateEndpointsList.json -func ExampleManagedPrivateEndpointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewManagedPrivateEndpointsClient().NewListPager("kustorptest", "kustoCluster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ManagedPrivateEndpointListResult = armkusto.ManagedPrivateEndpointListResult{ - // Value: []*armkusto.ManagedPrivateEndpoint{ - // { - // Name: to.Ptr("kustoCluster/KustoDatabase8/kustomanagedPrivateEndpoint1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/ManagedPrivateEndpoints"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/ManagedPrivateEndpoints/kustoManagedPrivateEndpoint1"), - // Properties: &armkusto.ManagedPrivateEndpointProperties{ - // GroupID: to.Ptr("blob"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), - // RequestMessage: to.Ptr("Please Approve."), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster/KustoDatabase8/kustomanagedPrivateEndpoint2"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/ManagedPrivateEndpoints"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/ManagedPrivateEndpoints/kustoManagedPrivateEndpoint2"), - // Properties: &armkusto.ManagedPrivateEndpointProperties{ - // GroupID: to.Ptr("namespace"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHubs/storageAccounts/eventHubTest"), - // RequestMessage: to.Ptr("Please Approve."), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoManagedPrivateEndpointsGet.json -func ExampleManagedPrivateEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagedPrivateEndpointsClient().Get(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedPrivateEndpoint = armkusto.ManagedPrivateEndpoint{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/managedPrivateEndpointTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/ManagedPrivateEndpoints"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/ManagedPrivateEndpoints/managedPrivateEndpointTest"), - // Properties: &armkusto.ManagedPrivateEndpointProperties{ - // GroupID: to.Ptr("blob"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), - // RequestMessage: to.Ptr("Please Approve."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoManagedPrivateEndpointsCreateOrUpdate.json -func ExampleManagedPrivateEndpointsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedPrivateEndpointsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", armkusto.ManagedPrivateEndpoint{ - Properties: &armkusto.ManagedPrivateEndpointProperties{ - GroupID: to.Ptr("blob"), - PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), - RequestMessage: to.Ptr("Please Approve."), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedPrivateEndpoint = armkusto.ManagedPrivateEndpoint{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/managedPrivateEndpointTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/ManagedPrivateEndpoints"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/ManagedPrivateEndpoints/managedPrivateEndpointTest"), - // Properties: &armkusto.ManagedPrivateEndpointProperties{ - // GroupID: to.Ptr("blob"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), - // RequestMessage: to.Ptr("Please Approve."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoManagedPrivateEndpointsUpdate.json -func ExampleManagedPrivateEndpointsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedPrivateEndpointsClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", armkusto.ManagedPrivateEndpoint{ - Properties: &armkusto.ManagedPrivateEndpointProperties{ - GroupID: to.Ptr("blob"), - PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), - RequestMessage: to.Ptr("Please Approve Managed Private Endpoint Request."), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ManagedPrivateEndpoint = armkusto.ManagedPrivateEndpoint{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/managedPrivateEndpointTest"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/ManagedPrivateEndpoints"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/ManagedPrivateEndpoints/managedPrivateEndpointTest"), - // Properties: &armkusto.ManagedPrivateEndpointProperties{ - // GroupID: to.Ptr("blob"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/storageAccountTest"), - // RequestMessage: to.Ptr("Please Approve Managed Private Endpoint Request."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoManagedPrivateEndpointsDelete.json -func ExampleManagedPrivateEndpointsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagedPrivateEndpointsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/models.go b/sdk/resourcemanager/kusto/armkusto/models.go index f0d1122b0811..2365e1a048ec 100644 --- a/sdk/resourcemanager/kusto/armkusto/models.go +++ b/sdk/resourcemanager/kusto/armkusto/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -81,38 +80,6 @@ type AttachedDatabaseConfigurationsCheckNameRequest struct { Type *string } -// AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.BeginCreateOrUpdate -// method. -type AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AttachedDatabaseConfigurationsClientBeginDeleteOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.BeginDelete -// method. -type AttachedDatabaseConfigurationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AttachedDatabaseConfigurationsClientCheckNameAvailabilityOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.CheckNameAvailability -// method. -type AttachedDatabaseConfigurationsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// AttachedDatabaseConfigurationsClientGetOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.Get -// method. -type AttachedDatabaseConfigurationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AttachedDatabaseConfigurationsClientListByClusterOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.NewListByClusterPager -// method. -type AttachedDatabaseConfigurationsClientListByClusterOptions struct { - // placeholder for future optional parameters -} - // AzureCapacity - Azure capacity definition. type AzureCapacity struct { // REQUIRED; The default capacity that would be used. @@ -265,38 +232,6 @@ type ClusterPrincipalAssignmentListResult struct { Value []*ClusterPrincipalAssignment } -// ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.BeginCreateOrUpdate -// method. -type ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClusterPrincipalAssignmentsClientBeginDeleteOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.BeginDelete -// method. -type ClusterPrincipalAssignmentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClusterPrincipalAssignmentsClientCheckNameAvailabilityOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.CheckNameAvailability -// method. -type ClusterPrincipalAssignmentsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ClusterPrincipalAssignmentsClientGetOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.Get -// method. -type ClusterPrincipalAssignmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ClusterPrincipalAssignmentsClientListOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.NewListPager -// method. -type ClusterPrincipalAssignmentsClientListOptions struct { - // placeholder for future optional parameters -} - // ClusterPrincipalProperties - A class representing cluster principal property. type ClusterPrincipalProperties struct { // REQUIRED; The principal ID assigned to the cluster principal. It can be a user email, application ID, or security group @@ -432,130 +367,6 @@ type ClusterUpdate struct { Type *string } -// ClustersClientBeginAddLanguageExtensionsOptions contains the optional parameters for the ClustersClient.BeginAddLanguageExtensions -// method. -type ClustersClientBeginAddLanguageExtensionsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ClustersClient.BeginCreateOrUpdate method. -type ClustersClientBeginCreateOrUpdateOptions struct { - // The ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the last-seen ETag value to prevent - // accidentally overwriting concurrent changes. - IfMatch *string - // Set to '*' to allow a new cluster to be created, but to prevent updating an existing cluster. Other values will result - // in a 412 Pre-condition Failed response. - IfNoneMatch *string - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. -type ClustersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginDetachFollowerDatabasesOptions contains the optional parameters for the ClustersClient.BeginDetachFollowerDatabases -// method. -type ClustersClientBeginDetachFollowerDatabasesOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginDiagnoseVirtualNetworkOptions contains the optional parameters for the ClustersClient.BeginDiagnoseVirtualNetwork -// method. -type ClustersClientBeginDiagnoseVirtualNetworkOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginMigrateOptions contains the optional parameters for the ClustersClient.BeginMigrate method. -type ClustersClientBeginMigrateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginRemoveLanguageExtensionsOptions contains the optional parameters for the ClustersClient.BeginRemoveLanguageExtensions -// method. -type ClustersClientBeginRemoveLanguageExtensionsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginStartOptions contains the optional parameters for the ClustersClient.BeginStart method. -type ClustersClientBeginStartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginStopOptions contains the optional parameters for the ClustersClient.BeginStop method. -type ClustersClientBeginStopOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientBeginUpdateOptions contains the optional parameters for the ClustersClient.BeginUpdate method. -type ClustersClientBeginUpdateOptions struct { - // The ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the last-seen ETag value to prevent - // accidentally overwriting concurrent changes. - IfMatch *string - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClustersClientCheckNameAvailabilityOptions contains the optional parameters for the ClustersClient.CheckNameAvailability -// method. -type ClustersClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. -type ClustersClientGetOptions struct { - // placeholder for future optional parameters -} - -// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager -// method. -type ClustersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ClustersClientListFollowerDatabasesOptions contains the optional parameters for the ClustersClient.NewListFollowerDatabasesPager -// method. -type ClustersClientListFollowerDatabasesOptions struct { - // placeholder for future optional parameters -} - -// ClustersClientListLanguageExtensionsOptions contains the optional parameters for the ClustersClient.NewListLanguageExtensionsPager -// method. -type ClustersClientListLanguageExtensionsOptions struct { - // placeholder for future optional parameters -} - -// ClustersClientListOptions contains the optional parameters for the ClustersClient.NewListPager method. -type ClustersClientListOptions struct { - // placeholder for future optional parameters -} - -// ClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the ClustersClient.NewListOutboundNetworkDependenciesEndpointsPager -// method. -type ClustersClientListOutboundNetworkDependenciesEndpointsOptions struct { - // placeholder for future optional parameters -} - -// ClustersClientListSKUsByResourceOptions contains the optional parameters for the ClustersClient.NewListSKUsByResourcePager -// method. -type ClustersClientListSKUsByResourceOptions struct { - // placeholder for future optional parameters -} - -// ClustersClientListSKUsOptions contains the optional parameters for the ClustersClient.NewListSKUsPager method. -type ClustersClientListSKUsOptions struct { - // placeholder for future optional parameters -} - type ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties struct { // READ-ONLY; The client id of user assigned identity. ClientID *string @@ -588,9 +399,9 @@ type CosmosDbDataConnection struct { // GetDataConnection implements the DataConnectionClassification interface for type CosmosDbDataConnection. func (c *CosmosDbDataConnection) GetDataConnection() *DataConnection { return &DataConnection{ - Location: c.Location, - Kind: c.Kind, ID: c.ID, + Kind: c.Kind, + Location: c.Location, Name: c.Name, Type: c.Type, } @@ -628,15 +439,6 @@ type CosmosDbDataConnectionProperties struct { ProvisioningState *ProvisioningState } -// DataConnectionClassification provides polymorphic access to related types. -// Call the interface's GetDataConnection() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *CosmosDbDataConnection, *DataConnection, *EventGridDataConnection, *EventHubDataConnection, *IotHubDataConnection -type DataConnectionClassification interface { - // GetDataConnection returns the DataConnection content of the underlying type. - GetDataConnection() *DataConnection -} - // DataConnection - Class representing an data connection. type DataConnection struct { // REQUIRED; Kind of the endpoint for the data connection @@ -695,58 +497,6 @@ type DataConnectionValidationResult struct { ErrorMessage *string } -// DataConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DataConnectionsClient.BeginCreateOrUpdate -// method. -type DataConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DataConnectionsClientBeginDataConnectionValidationOptions contains the optional parameters for the DataConnectionsClient.BeginDataConnectionValidation -// method. -type DataConnectionsClientBeginDataConnectionValidationOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DataConnectionsClientBeginDeleteOptions contains the optional parameters for the DataConnectionsClient.BeginDelete method. -type DataConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DataConnectionsClientBeginUpdateOptions contains the optional parameters for the DataConnectionsClient.BeginUpdate method. -type DataConnectionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DataConnectionsClientCheckNameAvailabilityOptions contains the optional parameters for the DataConnectionsClient.CheckNameAvailability -// method. -type DataConnectionsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// DataConnectionsClientGetOptions contains the optional parameters for the DataConnectionsClient.Get method. -type DataConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataConnectionsClientListByDatabaseOptions contains the optional parameters for the DataConnectionsClient.NewListByDatabasePager -// method. -type DataConnectionsClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - -// DatabaseClassification provides polymorphic access to related types. -// Call the interface's GetDatabase() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *Database, *ReadOnlyFollowingDatabase, *ReadWriteDatabase -type DatabaseClassification interface { - // GetDatabase returns the Database content of the underlying type. - GetDatabase() *Database -} - // Database - Class representing a Kusto database. type Database struct { // REQUIRED; Kind of the database @@ -768,11 +518,6 @@ type Database struct { // GetDatabase implements the DatabaseClassification interface for type Database. func (d *Database) GetDatabase() *Database { return d } -// DatabaseClientInviteFollowerOptions contains the optional parameters for the DatabaseClient.InviteFollower method. -type DatabaseClientInviteFollowerOptions struct { - // placeholder for future optional parameters -} - // DatabaseInviteFollowerRequest - The request to invite a follower to a database. type DatabaseInviteFollowerRequest struct { // REQUIRED; The email of the invited user for which the follower invitation is generated. @@ -852,38 +597,6 @@ type DatabasePrincipalAssignmentListResult struct { Value []*DatabasePrincipalAssignment } -// DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.BeginCreateOrUpdate -// method. -type DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasePrincipalAssignmentsClientBeginDeleteOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.BeginDelete -// method. -type DatabasePrincipalAssignmentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasePrincipalAssignmentsClientCheckNameAvailabilityOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.CheckNameAvailability -// method. -type DatabasePrincipalAssignmentsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// DatabasePrincipalAssignmentsClientGetOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.Get -// method. -type DatabasePrincipalAssignmentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabasePrincipalAssignmentsClientListOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.NewListPager -// method. -type DatabasePrincipalAssignmentsClientListOptions struct { - // placeholder for future optional parameters -} - // DatabasePrincipalListRequest - The list Kusto database principals operation request. type DatabasePrincipalListRequest struct { // The list of Kusto database principals. @@ -930,67 +643,6 @@ type DatabaseStatistics struct { Size *float32 } -// DatabasesClientAddPrincipalsOptions contains the optional parameters for the DatabasesClient.AddPrincipals method. -type DatabasesClientAddPrincipalsOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate -// method. -type DatabasesClientBeginCreateOrUpdateOptions struct { - // By default, any user who run operation on a database become an Admin on it. This property allows the caller to exclude - // the caller from Admins list. - CallerRole *CallerRole - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. -type DatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginUpdateOptions contains the optional parameters for the DatabasesClient.BeginUpdate method. -type DatabasesClientBeginUpdateOptions struct { - // By default, any user who run operation on a database become an Admin on it. This property allows the caller to exclude - // the caller from Admins list. - CallerRole *CallerRole - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientCheckNameAvailabilityOptions contains the optional parameters for the DatabasesClient.CheckNameAvailability -// method. -type DatabasesClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. -type DatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListByClusterOptions contains the optional parameters for the DatabasesClient.NewListByClusterPager method. -type DatabasesClientListByClusterOptions struct { - // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, - // the value of the nextLink element will include a skiptoken parameter that - // specifies a starting point to use for subsequent calls. - Skiptoken *string - // limit the number of results - Top *int32 -} - -// DatabasesClientListPrincipalsOptions contains the optional parameters for the DatabasesClient.NewListPrincipalsPager method. -type DatabasesClientListPrincipalsOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientRemovePrincipalsOptions contains the optional parameters for the DatabasesClient.RemovePrincipals method. -type DatabasesClientRemovePrincipalsOptions struct { - // placeholder for future optional parameters -} - type DiagnoseVirtualNetworkResult struct { // The list of network connectivity diagnostic finding Findings []*string @@ -1077,9 +729,9 @@ type EventGridDataConnection struct { // GetDataConnection implements the DataConnectionClassification interface for type EventGridDataConnection. func (e *EventGridDataConnection) GetDataConnection() *DataConnection { return &DataConnection{ - Location: e.Location, - Kind: e.Kind, ID: e.ID, + Kind: e.Kind, + Location: e.Location, Name: e.Name, Type: e.Type, } @@ -1149,9 +801,9 @@ type EventHubDataConnection struct { // GetDataConnection implements the DataConnectionClassification interface for type EventHubDataConnection. func (e *EventHubDataConnection) GetDataConnection() *DataConnection { return &DataConnection{ - Location: e.Location, - Kind: e.Kind, ID: e.ID, + Kind: e.Kind, + Location: e.Location, Name: e.Name, Type: e.Type, } @@ -1258,9 +910,9 @@ type IotHubDataConnection struct { // GetDataConnection implements the DataConnectionClassification interface for type IotHubDataConnection. func (i *IotHubDataConnection) GetDataConnection() *DataConnection { return &DataConnection{ - Location: i.Location, - Kind: i.Kind, ID: i.ID, + Kind: i.Kind, + Location: i.Location, Name: i.Name, Type: i.Type, } @@ -1354,44 +1006,6 @@ type ManagedPrivateEndpointsCheckNameRequest struct { Type *string } -// ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginCreateOrUpdate -// method. -type ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedPrivateEndpointsClientBeginDeleteOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginDelete -// method. -type ManagedPrivateEndpointsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedPrivateEndpointsClientBeginUpdateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginUpdate -// method. -type ManagedPrivateEndpointsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagedPrivateEndpointsClientCheckNameAvailabilityOptions contains the optional parameters for the ManagedPrivateEndpointsClient.CheckNameAvailability -// method. -type ManagedPrivateEndpointsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ManagedPrivateEndpointsClientGetOptions contains the optional parameters for the ManagedPrivateEndpointsClient.Get method. -type ManagedPrivateEndpointsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ManagedPrivateEndpointsClientListOptions contains the optional parameters for the ManagedPrivateEndpointsClient.NewListPager -// method. -type ManagedPrivateEndpointsClientListOptions struct { - // placeholder for future optional parameters -} - // MigrationClusterProperties - Represents a properties of a cluster that is part of a migration. type MigrationClusterProperties struct { // READ-ONLY; The public data ingestion URL of the cluster. @@ -1495,22 +1109,6 @@ type OperationResultProperties struct { ProvisioningState *ProvisioningState } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// OperationsResultsClientGetOptions contains the optional parameters for the OperationsResultsClient.Get method. -type OperationsResultsClientGetOptions struct { - // placeholder for future optional parameters -} - -// OperationsResultsLocationClientGetOptions contains the optional parameters for the OperationsResultsLocationClient.Get -// method. -type OperationsResultsLocationClientGetOptions struct { - // placeholder for future optional parameters -} - // OptimizedAutoscale - A class that contains the optimized auto scale definition. type OptimizedAutoscale struct { // REQUIRED; A boolean value that indicate if the optimized autoscale feature is enabled or not. @@ -1607,32 +1205,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *string } -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager -// method. -type PrivateEndpointConnectionsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateEndpointProperty - Private endpoint which the connection belongs to. type PrivateEndpointProperty struct { // READ-ONLY; Resource id of the private endpoint. @@ -1675,17 +1247,6 @@ type PrivateLinkResourceProperties struct { RequiredZoneNames []*string } -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager -// method. -type PrivateLinkResourcesClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkServiceConnectionStateProperty - Connection State of the Private Endpoint Connection. type PrivateLinkServiceConnectionStateProperty struct { // The private link service connection description. @@ -1722,9 +1283,9 @@ type ReadOnlyFollowingDatabase struct { // GetDatabase implements the DatabaseClassification interface for type ReadOnlyFollowingDatabase. func (r *ReadOnlyFollowingDatabase) GetDatabase() *Database { return &Database{ - Location: r.Location, - Kind: r.Kind, ID: r.ID, + Kind: r.Kind, + Location: r.Location, Name: r.Name, Type: r.Type, } @@ -1791,9 +1352,9 @@ type ReadWriteDatabase struct { // GetDatabase implements the DatabaseClassification interface for type ReadWriteDatabase. func (r *ReadWriteDatabase) GetDatabase() *Database { return &Database{ - Location: r.Location, - Kind: r.Kind, ID: r.ID, + Kind: r.Kind, + Location: r.Location, Name: r.Name, Type: r.Type, } @@ -1881,11 +1442,6 @@ type SKULocationInfoItem struct { Zones []*string } -// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. -type SKUsClientListOptions struct { - // placeholder for future optional parameters -} - // Script - Class representing a database script. type Script struct { // The database script. @@ -1942,40 +1498,6 @@ type ScriptProperties struct { ProvisioningState *ProvisioningState } -// ScriptsClientBeginCreateOrUpdateOptions contains the optional parameters for the ScriptsClient.BeginCreateOrUpdate method. -type ScriptsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ScriptsClientBeginDeleteOptions contains the optional parameters for the ScriptsClient.BeginDelete method. -type ScriptsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ScriptsClientBeginUpdateOptions contains the optional parameters for the ScriptsClient.BeginUpdate method. -type ScriptsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ScriptsClientCheckNameAvailabilityOptions contains the optional parameters for the ScriptsClient.CheckNameAvailability -// method. -type ScriptsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ScriptsClientGetOptions contains the optional parameters for the ScriptsClient.Get method. -type ScriptsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ScriptsClientListByDatabaseOptions contains the optional parameters for the ScriptsClient.NewListByDatabasePager method. -type ScriptsClientListByDatabaseOptions struct { - // placeholder for future optional parameters -} - // SuspensionDetails - The database suspension details. If the database is suspended, this object contains information related // to the database's suspension state. type SuspensionDetails struct { diff --git a/sdk/resourcemanager/kusto/armkusto/models_serde.go b/sdk/resourcemanager/kusto/armkusto/models_serde.go index 66fc0cb37a4a..f1f01bf887db 100644 --- a/sdk/resourcemanager/kusto/armkusto/models_serde.go +++ b/sdk/resourcemanager/kusto/armkusto/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto diff --git a/sdk/resourcemanager/kusto/armkusto/operations_client.go b/sdk/resourcemanager/kusto/armkusto/operations_client.go index 85d6dd371d35..91cd8f15ea55 100644 --- a/sdk/resourcemanager/kusto/armkusto/operations_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto diff --git a/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go deleted file mode 100644 index a7e8b5832d03..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go +++ /dev/null @@ -1,55 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoOperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armkusto.OperationListResult{ - // Value: []*armkusto.Operation{ - // { - // Name: to.Ptr("operationName"), - // Display: &armkusto.OperationDisplay{ - // Description: to.Ptr("operation description"), - // Operation: to.Ptr("operationName"), - // Provider: to.Ptr("providerName"), - // Resource: to.Ptr("resourceName"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/operationsresults_client.go b/sdk/resourcemanager/kusto/armkusto/operationsresults_client.go index e742f771a585..d7274fcd33c2 100644 --- a/sdk/resourcemanager/kusto/armkusto/operationsresults_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresults_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -52,18 +51,21 @@ func NewOperationsResultsClient(subscriptionID string, credential azcore.TokenCr // - operationID - The ID of an ongoing async operation. // - options - OperationsResultsClientGetOptions contains the optional parameters for the OperationsResultsClient.Get method. func (client *OperationsResultsClient) Get(ctx context.Context, location string, operationID string, options *OperationsResultsClientGetOptions) (OperationsResultsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { return OperationsResultsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsResultsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsResultsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationsResultsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go deleted file mode 100644 index cf6cd0c11256..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoOperationResultsGet.json -func ExampleOperationsResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsResultsClient().Get(ctx, "westus", "30972f1b-b61d-4fd8-bd34-3dcfa24670f3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationResult = armkusto.OperationResult{ - // Name: to.Ptr("30972f1b-b61d-4fd8-bd34-3dcfa24670f3"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T13:45:42.7025301Z"); return t}()), - // Error: &armkusto.OperationResultErrorProperties{ - // Code: to.Ptr("CannotAlterFollowerDatabase"), - // Message: to.Ptr("[BadRequest] Cannot alter leader cluster 'test' for resource name 'adc'."), - // }, - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/providers/Microsoft.Kusto/locations/westus/operationresults/30972f1b-b61d-4fd8-bd34-3dcfa24670f3"), - // PercentComplete: to.Ptr[float64](1), - // Properties: &armkusto.OperationResultProperties{ - // OperationKind: to.Ptr("FollowerDatabaseCreate"), - // OperationState: to.Ptr("BadInput"), - // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T13:45:39.6554616Z"); return t}()), - // Status: to.Ptr(armkusto.StatusFailed), - // } -} diff --git a/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go index 0047d2b7c367..1c60f3029a24 100644 --- a/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -53,18 +52,21 @@ func NewOperationsResultsLocationClient(subscriptionID string, credential azcore // - options - OperationsResultsLocationClientGetOptions contains the optional parameters for the OperationsResultsLocationClient.Get // method. func (client *OperationsResultsLocationClient) Get(ctx context.Context, location string, operationID string, options *OperationsResultsLocationClientGetOptions) (OperationsResultsLocationClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { return OperationsResultsLocationClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsResultsLocationClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return OperationsResultsLocationClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return OperationsResultsLocationClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go deleted file mode 100644 index fa25074d7833..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoOperationResultsOperationResultResponseTypeGet.json -func ExampleOperationsResultsLocationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewOperationsResultsLocationClient().Get(ctx, "westus", "30972f1b-b61d-4fd8-bd34-3dcfa24670f3", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/options.go b/sdk/resourcemanager/kusto/armkusto/options.go new file mode 100644 index 000000000000..bd41ecc66bab --- /dev/null +++ b/sdk/resourcemanager/kusto/armkusto/options.go @@ -0,0 +1,474 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armkusto + +// AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.BeginCreateOrUpdate +// method. +type AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AttachedDatabaseConfigurationsClientBeginDeleteOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.BeginDelete +// method. +type AttachedDatabaseConfigurationsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// AttachedDatabaseConfigurationsClientCheckNameAvailabilityOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.CheckNameAvailability +// method. +type AttachedDatabaseConfigurationsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// AttachedDatabaseConfigurationsClientGetOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.Get +// method. +type AttachedDatabaseConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AttachedDatabaseConfigurationsClientListByClusterOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.NewListByClusterPager +// method. +type AttachedDatabaseConfigurationsClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.BeginCreateOrUpdate +// method. +type ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClusterPrincipalAssignmentsClientBeginDeleteOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.BeginDelete +// method. +type ClusterPrincipalAssignmentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClusterPrincipalAssignmentsClientCheckNameAvailabilityOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.CheckNameAvailability +// method. +type ClusterPrincipalAssignmentsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ClusterPrincipalAssignmentsClientGetOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.Get +// method. +type ClusterPrincipalAssignmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClusterPrincipalAssignmentsClientListOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.NewListPager +// method. +type ClusterPrincipalAssignmentsClientListOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientBeginAddLanguageExtensionsOptions contains the optional parameters for the ClustersClient.BeginAddLanguageExtensions +// method. +type ClustersClientBeginAddLanguageExtensionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ClustersClient.BeginCreateOrUpdate method. +type ClustersClientBeginCreateOrUpdateOptions struct { + // The ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the last-seen ETag value to prevent + // accidentally overwriting concurrent changes. + IfMatch *string + + // Set to '*' to allow a new cluster to be created, but to prevent updating an existing cluster. Other values will result + // in a 412 Pre-condition Failed response. + IfNoneMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. +type ClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginDetachFollowerDatabasesOptions contains the optional parameters for the ClustersClient.BeginDetachFollowerDatabases +// method. +type ClustersClientBeginDetachFollowerDatabasesOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginDiagnoseVirtualNetworkOptions contains the optional parameters for the ClustersClient.BeginDiagnoseVirtualNetwork +// method. +type ClustersClientBeginDiagnoseVirtualNetworkOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginMigrateOptions contains the optional parameters for the ClustersClient.BeginMigrate method. +type ClustersClientBeginMigrateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginRemoveLanguageExtensionsOptions contains the optional parameters for the ClustersClient.BeginRemoveLanguageExtensions +// method. +type ClustersClientBeginRemoveLanguageExtensionsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginStartOptions contains the optional parameters for the ClustersClient.BeginStart method. +type ClustersClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginStopOptions contains the optional parameters for the ClustersClient.BeginStop method. +type ClustersClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginUpdateOptions contains the optional parameters for the ClustersClient.BeginUpdate method. +type ClustersClientBeginUpdateOptions struct { + // The ETag of the cluster. Omit this value to always overwrite the current cluster. Specify the last-seen ETag value to prevent + // accidentally overwriting concurrent changes. + IfMatch *string + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientCheckNameAvailabilityOptions contains the optional parameters for the ClustersClient.CheckNameAvailability +// method. +type ClustersClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +type ClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager +// method. +type ClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListFollowerDatabasesOptions contains the optional parameters for the ClustersClient.NewListFollowerDatabasesPager +// method. +type ClustersClientListFollowerDatabasesOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListLanguageExtensionsOptions contains the optional parameters for the ClustersClient.NewListLanguageExtensionsPager +// method. +type ClustersClientListLanguageExtensionsOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListOptions contains the optional parameters for the ClustersClient.NewListPager method. +type ClustersClientListOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the ClustersClient.NewListOutboundNetworkDependenciesEndpointsPager +// method. +type ClustersClientListOutboundNetworkDependenciesEndpointsOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListSKUsByResourceOptions contains the optional parameters for the ClustersClient.NewListSKUsByResourcePager +// method. +type ClustersClientListSKUsByResourceOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListSKUsOptions contains the optional parameters for the ClustersClient.NewListSKUsPager method. +type ClustersClientListSKUsOptions struct { + // placeholder for future optional parameters +} + +// DataConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DataConnectionsClient.BeginCreateOrUpdate +// method. +type DataConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DataConnectionsClientBeginDataConnectionValidationOptions contains the optional parameters for the DataConnectionsClient.BeginDataConnectionValidation +// method. +type DataConnectionsClientBeginDataConnectionValidationOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DataConnectionsClientBeginDeleteOptions contains the optional parameters for the DataConnectionsClient.BeginDelete method. +type DataConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DataConnectionsClientBeginUpdateOptions contains the optional parameters for the DataConnectionsClient.BeginUpdate method. +type DataConnectionsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DataConnectionsClientCheckNameAvailabilityOptions contains the optional parameters for the DataConnectionsClient.CheckNameAvailability +// method. +type DataConnectionsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// DataConnectionsClientGetOptions contains the optional parameters for the DataConnectionsClient.Get method. +type DataConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DataConnectionsClientListByDatabaseOptions contains the optional parameters for the DataConnectionsClient.NewListByDatabasePager +// method. +type DataConnectionsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} + +// DatabaseClientInviteFollowerOptions contains the optional parameters for the DatabaseClient.InviteFollower method. +type DatabaseClientInviteFollowerOptions struct { + // placeholder for future optional parameters +} + +// DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.BeginCreateOrUpdate +// method. +type DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasePrincipalAssignmentsClientBeginDeleteOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.BeginDelete +// method. +type DatabasePrincipalAssignmentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasePrincipalAssignmentsClientCheckNameAvailabilityOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.CheckNameAvailability +// method. +type DatabasePrincipalAssignmentsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// DatabasePrincipalAssignmentsClientGetOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.Get +// method. +type DatabasePrincipalAssignmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabasePrincipalAssignmentsClientListOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.NewListPager +// method. +type DatabasePrincipalAssignmentsClientListOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientAddPrincipalsOptions contains the optional parameters for the DatabasesClient.AddPrincipals method. +type DatabasesClientAddPrincipalsOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate +// method. +type DatabasesClientBeginCreateOrUpdateOptions struct { + // By default, any user who run operation on a database become an Admin on it. This property allows the caller to exclude + // the caller from Admins list. + CallerRole *CallerRole + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. +type DatabasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginUpdateOptions contains the optional parameters for the DatabasesClient.BeginUpdate method. +type DatabasesClientBeginUpdateOptions struct { + // By default, any user who run operation on a database become an Admin on it. This property allows the caller to exclude + // the caller from Admins list. + CallerRole *CallerRole + + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientCheckNameAvailabilityOptions contains the optional parameters for the DatabasesClient.CheckNameAvailability +// method. +type DatabasesClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. +type DatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientListByClusterOptions contains the optional parameters for the DatabasesClient.NewListByClusterPager method. +type DatabasesClientListByClusterOptions struct { + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. + Skiptoken *string + + // limit the number of results + Top *int32 +} + +// DatabasesClientListPrincipalsOptions contains the optional parameters for the DatabasesClient.NewListPrincipalsPager method. +type DatabasesClientListPrincipalsOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientRemovePrincipalsOptions contains the optional parameters for the DatabasesClient.RemovePrincipals method. +type DatabasesClientRemovePrincipalsOptions struct { + // placeholder for future optional parameters +} + +// ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginCreateOrUpdate +// method. +type ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedPrivateEndpointsClientBeginDeleteOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginDelete +// method. +type ManagedPrivateEndpointsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedPrivateEndpointsClientBeginUpdateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginUpdate +// method. +type ManagedPrivateEndpointsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagedPrivateEndpointsClientCheckNameAvailabilityOptions contains the optional parameters for the ManagedPrivateEndpointsClient.CheckNameAvailability +// method. +type ManagedPrivateEndpointsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ManagedPrivateEndpointsClientGetOptions contains the optional parameters for the ManagedPrivateEndpointsClient.Get method. +type ManagedPrivateEndpointsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ManagedPrivateEndpointsClientListOptions contains the optional parameters for the ManagedPrivateEndpointsClient.NewListPager +// method. +type ManagedPrivateEndpointsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsResultsClientGetOptions contains the optional parameters for the OperationsResultsClient.Get method. +type OperationsResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationsResultsLocationClientGetOptions contains the optional parameters for the OperationsResultsLocationClient.Get +// method. +type OperationsResultsLocationClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +type PrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +type SKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// ScriptsClientBeginCreateOrUpdateOptions contains the optional parameters for the ScriptsClient.BeginCreateOrUpdate method. +type ScriptsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ScriptsClientBeginDeleteOptions contains the optional parameters for the ScriptsClient.BeginDelete method. +type ScriptsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ScriptsClientBeginUpdateOptions contains the optional parameters for the ScriptsClient.BeginUpdate method. +type ScriptsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ScriptsClientCheckNameAvailabilityOptions contains the optional parameters for the ScriptsClient.CheckNameAvailability +// method. +type ScriptsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ScriptsClientGetOptions contains the optional parameters for the ScriptsClient.Get method. +type ScriptsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ScriptsClientListByDatabaseOptions contains the optional parameters for the ScriptsClient.NewListByDatabasePager method. +type ScriptsClientListByDatabaseOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go b/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go index feafa2f7f502..d2157ab066f2 100644 --- a/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go +++ b/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -32,7 +31,10 @@ func unmarshalDataConnectionClassification(rawMsg json.RawMessage) (DataConnecti default: b = &DataConnection{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalDataConnectionClassificationArray(rawMsg json.RawMessage) ([]DataConnectionClassification, error) { @@ -71,7 +73,10 @@ func unmarshalDatabaseClassification(rawMsg json.RawMessage) (DatabaseClassifica default: b = &Database{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalDatabaseClassificationArray(rawMsg json.RawMessage) ([]DatabaseClassification, error) { diff --git a/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go index 6ccdbb79dfec..81e5036fe39c 100644 --- a/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go +++ b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -59,9 +58,8 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,18 +70,20 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // // Generated from API version 2023-05-02 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -113,7 +113,10 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a private endpoint connection with a given name. @@ -131,9 +134,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -144,18 +146,20 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // // Generated from API version 2023-05-02 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -198,18 +202,21 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go deleted file mode 100644 index 9fdc8e826ee6..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,182 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoPrivateEndpointConnectionsList.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("kustorptest", "kustoCluster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armkusto.PrivateEndpointConnectionListResult{ - // Value: []*armkusto.PrivateEndpointConnection{ - // { - // Name: to.Ptr("privateEndpointTest"), - // Type: to.Ptr("Microsoft.Kusto/clusters/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/privateEndpointConnections/privateEndpointTest"), - // Properties: &armkusto.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("cluster"), - // PrivateEndpoint: &armkusto.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("privateEndpointTest2"), - // Type: to.Ptr("Microsoft.Kusto/clusters/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/privateEndpointConnections/privateEndpointTest2"), - // Properties: &armkusto.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("cluster"), - // PrivateEndpoint: &armkusto.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName2"), - // }, - // PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoPrivateEndpointConnectionsGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "kustorptest", "kustoCluster", "privateEndpointTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armkusto.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointTest"), - // Type: to.Ptr("Microsoft.Kusto/clusters/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/privateEndpointConnections/privateEndpointTest"), - // Properties: &armkusto.PrivateEndpointConnectionProperties{ - // GroupID: to.Ptr("cluster"), - // PrivateEndpoint: &armkusto.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/rg1Network/providers/Microsoft.Network/privateEndpoints/privateEndpointName"), - // }, - // PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoPrivateEndpointConnectionsCreateOrUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoclusterrptest4", "privateEndpointTest", armkusto.PrivateEndpointConnection{ - Properties: &armkusto.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr("Approved"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armkusto.PrivateEndpointConnection{ - // Name: to.Ptr("privateEndpointTest"), - // Type: to.Ptr("Microsoft.Kusto/clusters/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterRPTest4/privateEndpointConnections/privateEndpointTest"), - // Properties: &armkusto.PrivateEndpointConnectionProperties{ - // PrivateLinkServiceConnectionState: &armkusto.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoPrivateEndpointConnectionsDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "privateEndpointTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go index 1030bed568a5..cc37b826bd1e 100644 --- a/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go +++ b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -54,18 +53,21 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get // method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, privateLinkResourceName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go deleted file mode 100644 index 45d8c0f1b4ee..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoPrivateLinkResourcesList.json -func ExamplePrivateLinkResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListPager("kustorptest", "kustoCluster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceListResult = armkusto.PrivateLinkResourceListResult{ - // Value: []*armkusto.PrivateLinkResource{ - // { - // Name: to.Ptr("cluster"), - // Type: to.Ptr("Microsoft.Kusto/clusters/PrivateLinkResources"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/privateLinkResources/cluster"), - // Properties: &armkusto.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("cluster"), - // RequiredMembers: []*string{ - // to.Ptr("Engine"), - // to.Ptr("DataManagement"), - // to.Ptr("blob-ne3kstrldkustoCluster00"), - // to.Ptr("queue-ne3kstrldkustoCluster00"), - // to.Ptr("table-ne3kstrldkustoCluster00"), - // to.Ptr("blob-qmukstrldkustoCluster01"), - // to.Ptr("queue-qmukstrldkustoCluster01"), - // to.Ptr("table-qmukstrldkustoCluster01")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.westus2.kusto.windows.net"), - // to.Ptr("privatelink.blob.core.windows.net"), - // to.Ptr("privatelink.queue.core.windows.net"), - // to.Ptr("privatelink.table.core.windows.net")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoPrivateLinkResourcesGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "kustorptest", "kustoCluster", "cluster", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armkusto.PrivateLinkResource{ - // Name: to.Ptr("cluster"), - // Type: to.Ptr("Microsoft.Kusto/clusters/PrivateLinkResources"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/privateLinkResources/cluster"), - // Properties: &armkusto.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("cluster"), - // RequiredMembers: []*string{ - // to.Ptr("Engine"), - // to.Ptr("DataManagement"), - // to.Ptr("blob-ne3kstrldkustoCluster00"), - // to.Ptr("queue-ne3kstrldkustoCluster00"), - // to.Ptr("table-ne3kstrldkustoCluster00"), - // to.Ptr("blob-qmukstrldkustoCluster01"), - // to.Ptr("queue-qmukstrldkustoCluster01"), - // to.Ptr("table-qmukstrldkustoCluster01")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.westus2.kusto.windows.net"), - // to.Ptr("privatelink.blob.core.windows.net"), - // to.Ptr("privatelink.queue.core.windows.net"), - // to.Ptr("privatelink.table.core.windows.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/kusto/armkusto/response_types.go b/sdk/resourcemanager/kusto/armkusto/response_types.go index 9c59744d3c60..de52d90a241f 100644 --- a/sdk/resourcemanager/kusto/armkusto/response_types.go +++ b/sdk/resourcemanager/kusto/armkusto/response_types.go @@ -3,19 +3,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto // AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse contains the response from method AttachedDatabaseConfigurationsClient.CheckNameAvailability. type AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse struct { + // The result returned from a check name availability request. CheckNameResult } // AttachedDatabaseConfigurationsClientCreateOrUpdateResponse contains the response from method AttachedDatabaseConfigurationsClient.BeginCreateOrUpdate. type AttachedDatabaseConfigurationsClientCreateOrUpdateResponse struct { + // Class representing an attached database configuration. AttachedDatabaseConfiguration } @@ -26,21 +27,25 @@ type AttachedDatabaseConfigurationsClientDeleteResponse struct { // AttachedDatabaseConfigurationsClientGetResponse contains the response from method AttachedDatabaseConfigurationsClient.Get. type AttachedDatabaseConfigurationsClientGetResponse struct { + // Class representing an attached database configuration. AttachedDatabaseConfiguration } // AttachedDatabaseConfigurationsClientListByClusterResponse contains the response from method AttachedDatabaseConfigurationsClient.NewListByClusterPager. type AttachedDatabaseConfigurationsClientListByClusterResponse struct { + // The list attached database configurations operation response. AttachedDatabaseConfigurationListResult } // ClusterPrincipalAssignmentsClientCheckNameAvailabilityResponse contains the response from method ClusterPrincipalAssignmentsClient.CheckNameAvailability. type ClusterPrincipalAssignmentsClientCheckNameAvailabilityResponse struct { + // The result returned from a check name availability request. CheckNameResult } // ClusterPrincipalAssignmentsClientCreateOrUpdateResponse contains the response from method ClusterPrincipalAssignmentsClient.BeginCreateOrUpdate. type ClusterPrincipalAssignmentsClientCreateOrUpdateResponse struct { + // Class representing a cluster principal assignment. ClusterPrincipalAssignment } @@ -51,11 +56,13 @@ type ClusterPrincipalAssignmentsClientDeleteResponse struct { // ClusterPrincipalAssignmentsClientGetResponse contains the response from method ClusterPrincipalAssignmentsClient.Get. type ClusterPrincipalAssignmentsClientGetResponse struct { + // Class representing a cluster principal assignment. ClusterPrincipalAssignment } // ClusterPrincipalAssignmentsClientListResponse contains the response from method ClusterPrincipalAssignmentsClient.NewListPager. type ClusterPrincipalAssignmentsClientListResponse struct { + // The list Kusto cluster principal assignments operation response. ClusterPrincipalAssignmentListResult } @@ -66,11 +73,13 @@ type ClustersClientAddLanguageExtensionsResponse struct { // ClustersClientCheckNameAvailabilityResponse contains the response from method ClustersClient.CheckNameAvailability. type ClustersClientCheckNameAvailabilityResponse struct { + // The result returned from a check name availability request. CheckNameResult } // ClustersClientCreateOrUpdateResponse contains the response from method ClustersClient.BeginCreateOrUpdate. type ClustersClientCreateOrUpdateResponse struct { + // Class representing a Kusto cluster. Cluster } @@ -91,41 +100,49 @@ type ClustersClientDiagnoseVirtualNetworkResponse struct { // ClustersClientGetResponse contains the response from method ClustersClient.Get. type ClustersClientGetResponse struct { + // Class representing a Kusto cluster. Cluster } // ClustersClientListByResourceGroupResponse contains the response from method ClustersClient.NewListByResourceGroupPager. type ClustersClientListByResourceGroupResponse struct { + // The list Kusto clusters operation response. ClusterListResult } // ClustersClientListFollowerDatabasesResponse contains the response from method ClustersClient.NewListFollowerDatabasesPager. type ClustersClientListFollowerDatabasesResponse struct { + // The list Kusto database principals operation response. FollowerDatabaseListResult } // ClustersClientListLanguageExtensionsResponse contains the response from method ClustersClient.NewListLanguageExtensionsPager. type ClustersClientListLanguageExtensionsResponse struct { + // The list of language extension objects. LanguageExtensionsList } // ClustersClientListOutboundNetworkDependenciesEndpointsResponse contains the response from method ClustersClient.NewListOutboundNetworkDependenciesEndpointsPager. type ClustersClientListOutboundNetworkDependenciesEndpointsResponse struct { + // Collection of Outbound Environment Endpoints OutboundNetworkDependenciesEndpointListResult } // ClustersClientListResponse contains the response from method ClustersClient.NewListPager. type ClustersClientListResponse struct { + // The list Kusto clusters operation response. ClusterListResult } // ClustersClientListSKUsByResourceResponse contains the response from method ClustersClient.NewListSKUsByResourcePager. type ClustersClientListSKUsByResourceResponse struct { + // List of available SKUs for a Kusto Cluster. ListResourceSKUsResult } // ClustersClientListSKUsResponse contains the response from method ClustersClient.NewListSKUsPager. type ClustersClientListSKUsResponse struct { + // The list of the EngagementFabric SKU descriptions SKUDescriptionList } @@ -151,16 +168,19 @@ type ClustersClientStopResponse struct { // ClustersClientUpdateResponse contains the response from method ClustersClient.BeginUpdate. type ClustersClientUpdateResponse struct { + // Class representing a Kusto cluster. Cluster } // DataConnectionsClientCheckNameAvailabilityResponse contains the response from method DataConnectionsClient.CheckNameAvailability. type DataConnectionsClientCheckNameAvailabilityResponse struct { + // The result returned from a check name availability request. CheckNameResult } // DataConnectionsClientCreateOrUpdateResponse contains the response from method DataConnectionsClient.BeginCreateOrUpdate. type DataConnectionsClientCreateOrUpdateResponse struct { + // Class representing an data connection. DataConnectionClassification } @@ -176,6 +196,7 @@ func (d *DataConnectionsClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) // DataConnectionsClientDataConnectionValidationResponse contains the response from method DataConnectionsClient.BeginDataConnectionValidation. type DataConnectionsClientDataConnectionValidationResponse struct { + // The list Kusto data connection validation result. DataConnectionValidationListResult } @@ -186,6 +207,7 @@ type DataConnectionsClientDeleteResponse struct { // DataConnectionsClientGetResponse contains the response from method DataConnectionsClient.Get. type DataConnectionsClientGetResponse struct { + // Class representing an data connection. DataConnectionClassification } @@ -201,11 +223,13 @@ func (d *DataConnectionsClientGetResponse) UnmarshalJSON(data []byte) error { // DataConnectionsClientListByDatabaseResponse contains the response from method DataConnectionsClient.NewListByDatabasePager. type DataConnectionsClientListByDatabaseResponse struct { + // The list Kusto data connections operation response. DataConnectionListResult } // DataConnectionsClientUpdateResponse contains the response from method DataConnectionsClient.BeginUpdate. type DataConnectionsClientUpdateResponse struct { + // Class representing an data connection. DataConnectionClassification } @@ -221,16 +245,19 @@ func (d *DataConnectionsClientUpdateResponse) UnmarshalJSON(data []byte) error { // DatabaseClientInviteFollowerResponse contains the response from method DatabaseClient.InviteFollower. type DatabaseClientInviteFollowerResponse struct { + // The result returned from a follower invitation generation request. DatabaseInviteFollowerResult } // DatabasePrincipalAssignmentsClientCheckNameAvailabilityResponse contains the response from method DatabasePrincipalAssignmentsClient.CheckNameAvailability. type DatabasePrincipalAssignmentsClientCheckNameAvailabilityResponse struct { + // The result returned from a check name availability request. CheckNameResult } // DatabasePrincipalAssignmentsClientCreateOrUpdateResponse contains the response from method DatabasePrincipalAssignmentsClient.BeginCreateOrUpdate. type DatabasePrincipalAssignmentsClientCreateOrUpdateResponse struct { + // Class representing a database principal assignment. DatabasePrincipalAssignment } @@ -241,26 +268,31 @@ type DatabasePrincipalAssignmentsClientDeleteResponse struct { // DatabasePrincipalAssignmentsClientGetResponse contains the response from method DatabasePrincipalAssignmentsClient.Get. type DatabasePrincipalAssignmentsClientGetResponse struct { + // Class representing a database principal assignment. DatabasePrincipalAssignment } // DatabasePrincipalAssignmentsClientListResponse contains the response from method DatabasePrincipalAssignmentsClient.NewListPager. type DatabasePrincipalAssignmentsClientListResponse struct { + // The list Kusto database principal assignments operation response. DatabasePrincipalAssignmentListResult } // DatabasesClientAddPrincipalsResponse contains the response from method DatabasesClient.AddPrincipals. type DatabasesClientAddPrincipalsResponse struct { + // The list Kusto database principals operation response. DatabasePrincipalListResult } // DatabasesClientCheckNameAvailabilityResponse contains the response from method DatabasesClient.CheckNameAvailability. type DatabasesClientCheckNameAvailabilityResponse struct { + // The result returned from a check name availability request. CheckNameResult } // DatabasesClientCreateOrUpdateResponse contains the response from method DatabasesClient.BeginCreateOrUpdate. type DatabasesClientCreateOrUpdateResponse struct { + // Class representing a Kusto database. DatabaseClassification } @@ -281,6 +313,7 @@ type DatabasesClientDeleteResponse struct { // DatabasesClientGetResponse contains the response from method DatabasesClient.Get. type DatabasesClientGetResponse struct { + // Class representing a Kusto database. DatabaseClassification } @@ -296,21 +329,25 @@ func (d *DatabasesClientGetResponse) UnmarshalJSON(data []byte) error { // DatabasesClientListByClusterResponse contains the response from method DatabasesClient.NewListByClusterPager. type DatabasesClientListByClusterResponse struct { + // The list Kusto databases operation response. DatabaseListResult } // DatabasesClientListPrincipalsResponse contains the response from method DatabasesClient.NewListPrincipalsPager. type DatabasesClientListPrincipalsResponse struct { + // The list Kusto database principals operation response. DatabasePrincipalListResult } // DatabasesClientRemovePrincipalsResponse contains the response from method DatabasesClient.RemovePrincipals. type DatabasesClientRemovePrincipalsResponse struct { + // The list Kusto database principals operation response. DatabasePrincipalListResult } // DatabasesClientUpdateResponse contains the response from method DatabasesClient.BeginUpdate. type DatabasesClientUpdateResponse struct { + // Class representing a Kusto database. DatabaseClassification } @@ -326,11 +363,13 @@ func (d *DatabasesClientUpdateResponse) UnmarshalJSON(data []byte) error { // ManagedPrivateEndpointsClientCheckNameAvailabilityResponse contains the response from method ManagedPrivateEndpointsClient.CheckNameAvailability. type ManagedPrivateEndpointsClientCheckNameAvailabilityResponse struct { + // The result returned from a check name availability request. CheckNameResult } // ManagedPrivateEndpointsClientCreateOrUpdateResponse contains the response from method ManagedPrivateEndpointsClient.BeginCreateOrUpdate. type ManagedPrivateEndpointsClientCreateOrUpdateResponse struct { + // Class representing a managed private endpoint. ManagedPrivateEndpoint } @@ -341,26 +380,32 @@ type ManagedPrivateEndpointsClientDeleteResponse struct { // ManagedPrivateEndpointsClientGetResponse contains the response from method ManagedPrivateEndpointsClient.Get. type ManagedPrivateEndpointsClientGetResponse struct { + // Class representing a managed private endpoint. ManagedPrivateEndpoint } // ManagedPrivateEndpointsClientListResponse contains the response from method ManagedPrivateEndpointsClient.NewListPager. type ManagedPrivateEndpointsClientListResponse struct { + // The list managed private endpoints operation response. ManagedPrivateEndpointListResult } // ManagedPrivateEndpointsClientUpdateResponse contains the response from method ManagedPrivateEndpointsClient.BeginUpdate. type ManagedPrivateEndpointsClientUpdateResponse struct { + // Class representing a managed private endpoint. ManagedPrivateEndpoint } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next + // set of results. OperationListResult } // OperationsResultsClientGetResponse contains the response from method OperationsResultsClient.Get. type OperationsResultsClientGetResponse struct { + // Operation Result Entity. OperationResult } @@ -372,6 +417,7 @@ type OperationsResultsLocationClientGetResponse struct { // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // A private endpoint connection PrivateEndpointConnection } @@ -382,36 +428,43 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // A private endpoint connection PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. type PrivateEndpointConnectionsClientListResponse struct { + // A list of private endpoint connections PrivateEndpointConnectionListResult } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { + // A private link resource PrivateLinkResource } // PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. type PrivateLinkResourcesClientListResponse struct { + // A list of private link resources PrivateLinkResourceListResult } // SKUsClientListResponse contains the response from method SKUsClient.NewListPager. type SKUsClientListResponse struct { + // The list of the EngagementFabric SKU descriptions SKUDescriptionList } // ScriptsClientCheckNameAvailabilityResponse contains the response from method ScriptsClient.CheckNameAvailability. type ScriptsClientCheckNameAvailabilityResponse struct { + // The result returned from a check name availability request. CheckNameResult } // ScriptsClientCreateOrUpdateResponse contains the response from method ScriptsClient.BeginCreateOrUpdate. type ScriptsClientCreateOrUpdateResponse struct { + // Class representing a database script. Script } @@ -422,15 +475,18 @@ type ScriptsClientDeleteResponse struct { // ScriptsClientGetResponse contains the response from method ScriptsClient.Get. type ScriptsClientGetResponse struct { + // Class representing a database script. Script } // ScriptsClientListByDatabaseResponse contains the response from method ScriptsClient.NewListByDatabasePager. type ScriptsClientListByDatabaseResponse struct { + // The list Kusto database script operation response. ScriptListResult } // ScriptsClientUpdateResponse contains the response from method ScriptsClient.BeginUpdate. type ScriptsClientUpdateResponse struct { + // Class representing a database script. Script } diff --git a/sdk/resourcemanager/kusto/armkusto/scripts_client.go b/sdk/resourcemanager/kusto/armkusto/scripts_client.go index 5260dbf85b92..a40124c94239 100644 --- a/sdk/resourcemanager/kusto/armkusto/scripts_client.go +++ b/sdk/resourcemanager/kusto/armkusto/scripts_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto @@ -55,18 +54,21 @@ func NewScriptsClient(subscriptionID string, credential azcore.TokenCredential, // - options - ScriptsClientCheckNameAvailabilityOptions contains the optional parameters for the ScriptsClient.CheckNameAvailability // method. func (client *ScriptsClient) CheckNameAvailability(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName ScriptCheckNameRequest, options *ScriptsClientCheckNameAvailabilityOptions) (ScriptsClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, resourceGroupName, clusterName, databaseName, scriptName, options) if err != nil { return ScriptsClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScriptsClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ScriptsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScriptsClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -96,7 +98,10 @@ func (client *ScriptsClient) checkNameAvailabilityCreateRequest(ctx context.Cont reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, scriptName) + if err := runtime.MarshalAsJSON(req, scriptName); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -125,9 +130,8 @@ func (client *ScriptsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ScriptsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ScriptsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ScriptsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,18 +142,20 @@ func (client *ScriptsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // // Generated from API version 2023-05-02 func (client *ScriptsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script, options *ScriptsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, scriptName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -183,7 +189,10 @@ func (client *ScriptsClient) createOrUpdateCreateRequest(ctx context.Context, re reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a Kusto database script. @@ -201,9 +210,8 @@ func (client *ScriptsClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ScriptsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ScriptsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ScriptsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -214,18 +222,20 @@ func (client *ScriptsClient) BeginDelete(ctx context.Context, resourceGroupName // // Generated from API version 2023-05-02 func (client *ScriptsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, options *ScriptsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, scriptName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -272,18 +282,21 @@ func (client *ScriptsClient) deleteCreateRequest(ctx context.Context, resourceGr // - scriptName - The name of the Kusto database script. // - options - ScriptsClientGetOptions contains the optional parameters for the ScriptsClient.Get method. func (client *ScriptsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, options *ScriptsClientGetOptions) (ScriptsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, databaseName, scriptName, options) if err != nil { return ScriptsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ScriptsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ScriptsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScriptsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -414,9 +427,8 @@ func (client *ScriptsClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ScriptsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - }) + poller, err := runtime.NewPoller[ScriptsClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ScriptsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -427,18 +439,20 @@ func (client *ScriptsClient) BeginUpdate(ctx context.Context, resourceGroupName // // Generated from API version 2023-05-02 func (client *ScriptsClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script, options *ScriptsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, scriptName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -472,5 +486,8 @@ func (client *ScriptsClient) updateCreateRequest(ctx context.Context, resourceGr reqQP.Set("api-version", "2023-05-02") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go deleted file mode 100644 index 83d44dab06c5..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go +++ /dev/null @@ -1,268 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoScriptsListByDatabase.json -func ExampleScriptsClient_NewListByDatabasePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScriptsClient().NewListByDatabasePager("kustorptest", "kustoCluster", "Kustodatabase8", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ScriptListResult = armkusto.ScriptListResult{ - // Value: []*armkusto.Script{ - // { - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoScript1"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/Scripts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/Scripts/kustoScript1"), - // Properties: &armkusto.ScriptProperties{ - // ContinueOnErrors: to.Ptr(true), - // ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - // ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), - // }, - // SystemData: &armkusto.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armkusto.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoScript2"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/Scripts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/Scripts/kustoScript2"), - // Properties: &armkusto.ScriptProperties{ - // ContinueOnErrors: to.Ptr(true), - // ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - // ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script2.txt"), - // }, - // SystemData: &armkusto.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armkusto.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-30T16:07:55.2831451Z"); return t}()), - // LastModifiedBy: to.Ptr("user2@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoScriptsGet.json -func ExampleScriptsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScriptsClient().Get(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Script = armkusto.Script{ - // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoScript"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/Scripts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/Scripts/kustoScript"), - // Properties: &armkusto.ScriptProperties{ - // ContinueOnErrors: to.Ptr(true), - // ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - // ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), - // }, - // SystemData: &armkusto.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armkusto.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoScriptsCreateOrUpdate.json -func ExampleScriptsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewScriptsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "kustoScript", armkusto.Script{ - Properties: &armkusto.ScriptProperties{ - ContinueOnErrors: to.Ptr(true), - ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), - ScriptURLSasToken: to.Ptr("?sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=********************************"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Script = armkusto.Script{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/kustoScript"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/Scripts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/Scripts/kustoScript"), - // Properties: &armkusto.ScriptProperties{ - // ContinueOnErrors: to.Ptr(true), - // ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - // ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), - // }, - // SystemData: &armkusto.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armkusto.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T17:16:24.3644126Z"); return t}()), - // LastModifiedBy: to.Ptr("user2@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoScriptsUpdate.json -func ExampleScriptsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewScriptsClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "kustoScript", armkusto.Script{ - Properties: &armkusto.ScriptProperties{ - ContinueOnErrors: to.Ptr(true), - ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), - ScriptURLSasToken: to.Ptr("?sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=********************************"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Script = armkusto.Script{ - // Name: to.Ptr("kustoCluster/KustoDatabase8/kustoScript"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/Scripts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/Scripts/kustoScript"), - // Properties: &armkusto.ScriptProperties{ - // ContinueOnErrors: to.Ptr(true), - // ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - // ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), - // }, - // SystemData: &armkusto.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), - // CreatedBy: to.Ptr("user@microsoft.com"), - // CreatedByType: to.Ptr(armkusto.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T17:16:24.3644126Z"); return t}()), - // LastModifiedBy: to.Ptr("user2@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoScriptsDelete.json -func ExampleScriptsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewScriptsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "kustoScript", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoScriptsCheckNameAvailability.json -func ExampleScriptsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScriptsClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", "db", armkusto.ScriptCheckNameRequest{ - Name: to.Ptr("kustoScriptName1"), - Type: to.Ptr("Microsoft.Kusto/clusters/databases/scripts"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("kustoScriptName1"), - // Message: to.Ptr("Name 'kustoScriptName1' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), - // } -} diff --git a/sdk/resourcemanager/kusto/armkusto/skus_client.go b/sdk/resourcemanager/kusto/armkusto/skus_client.go index b2f1e5de43f7..f056175b2160 100644 --- a/sdk/resourcemanager/kusto/armkusto/skus_client.go +++ b/sdk/resourcemanager/kusto/armkusto/skus_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto diff --git a/sdk/resourcemanager/kusto/armkusto/skus_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/skus_client_example_test.go deleted file mode 100644 index 1a65436f9805..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/skus_client_example_test.go +++ /dev/null @@ -1,124 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armkusto_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/310a0100f5b020c1900c527a6aa70d21992f078a/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2023-05-02/examples/KustoSkus.json -func ExampleSKUsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armkusto.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSKUsClient().NewListPager("westus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SKUDescriptionList = armkusto.SKUDescriptionList{ - // Value: []*armkusto.SKUDescription{ - // { - // Name: to.Ptr("Standard_L8s_v3"), - // LocationInfo: []*armkusto.SKULocationInfoItem{ - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("West US")}, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_L16s_v3"), - // LocationInfo: []*armkusto.SKULocationInfoItem{ - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("West US")}, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_L8as_v3"), - // LocationInfo: []*armkusto.SKULocationInfoItem{ - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("West US"), - // to.Ptr("West Europe")}, - // Tier: to.Ptr("Standard"), - // }, - // { - // Name: to.Ptr("Standard_L16as_v3"), - // LocationInfo: []*armkusto.SKULocationInfoItem{ - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }, - // { - // Location: to.Ptr("West US"), - // Zones: []*string{ - // }, - // }}, - // Locations: []*string{ - // to.Ptr("West US"), - // to.Ptr("West Europe")}, - // Tier: to.Ptr("Standard"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go b/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go index ad076a47550d..4f68b299feae 100644 --- a/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go +++ b/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armkusto