diff --git a/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md b/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md index 96db04f174f6..a7a926326f5f 100644 --- a/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md +++ b/sdk/resourcemanager/kusto/armkusto/CHANGELOG.md @@ -1,5 +1,50 @@ # Release History +## 2.4.0-beta.1 (2026-05-20) +### Features Added + +- New value `DataConnectionKindEventGridWithManagedIdentity`, `DataConnectionKindEventHubWithManagedIdentity` added to enum type `DataConnectionKind` +- New value `EventGridDataFormatAZMONSTREAM` added to enum type `EventGridDataFormat` +- New value `EventHubDataFormatAZMONSTREAM` added to enum type `EventHubDataFormat` +- New value `IotHubDataFormatAZMONSTREAM` added to enum type `IotHubDataFormat` +- New value `PublicNetworkAccessSecuredByPerimeter` added to enum type `PublicNetworkAccess` +- New function `*EventGridDataConnectionWithManagedIdentity.GetDataConnection() *DataConnection` +- New function `*EventHubDataConnectionWithManagedIdentity.GetDataConnection() *DataConnection` +- New struct `EventGridConnectionWithManagedIdentityProperties` +- New struct `EventGridDataConnectionWithManagedIdentity` +- New struct `EventHubConnectionWithManagedIdentityProperties` +- New struct `EventHubDataConnectionWithManagedIdentity` +- New field `SystemData` in struct `AttachedDatabaseConfiguration` +- New field `NextLink` in struct `AttachedDatabaseConfigurationListResult` +- New field `NextLink` in struct `ClusterListResult` +- New field `SystemData` in struct `ClusterPrincipalAssignment` +- New field `NextLink` in struct `ClusterPrincipalAssignmentListResult` +- New field `SystemData` in struct `ClusterUpdate` +- New field `SystemData` in struct `CosmosDbDataConnection` +- New field `NextLink` in struct `DataConnectionListResult` +- New field `SystemData` in struct `Database` +- New field `SystemData` in struct `DatabasePrincipalAssignment` +- New field `NextLink` in struct `DatabasePrincipalAssignmentListResult` +- New field `NextLink` in struct `DatabasePrincipalListResult` +- New field `SystemData` in struct `EventGridDataConnection` +- New field `SystemData` in struct `EventHubDataConnection` +- New field `NextLink` in struct `FollowerDatabaseListResult` +- New field `SystemData` in struct `IotHubDataConnection` +- New field `FederatedIdentityClientID` in struct `KeyVaultProperties` +- New field `NextLink` in struct `LanguageExtensionsList` +- New field `NextLink` in struct `ListResourceSKUsResult` +- New field `NextLink` in struct `ManagedPrivateEndpointListResult` +- New field `SystemData` in struct `OutboundNetworkDependenciesEndpoint` +- New field `NextLink` in struct `PrivateEndpointConnectionListResult` +- New field `NextLink` in struct `PrivateLinkResourceListResult` +- New field `SystemData` in struct `ReadOnlyFollowingDatabase` +- New field `SystemData` in struct `ReadWriteDatabase` +- New field `NextLink` in struct `SKUDescriptionList` +- New field `SystemData` in struct `SandboxCustomImage` +- New field `NextLink` in struct `ScriptListResult` +- New field `ManagedIdentityResourceID` in struct `ScriptProperties` + + ## 2.3.0 (2025-01-24) ### Features Added diff --git a/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go index 6195f6ca4a4e..677a2f89aa86 100644 --- a/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go +++ b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // AttachedDatabaseConfigurationsClient contains the methods for the AttachedDatabaseConfigurations group. // Don't use this type directly, use NewAttachedDatabaseConfigurationsClient() instead. +// +// Generated from API version 2025-02-14 type AttachedDatabaseConfigurationsClient struct { internal *arm.Client subscriptionID string } // NewAttachedDatabaseConfigurationsClient creates a new instance of AttachedDatabaseConfigurationsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAttachedDatabaseConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AttachedDatabaseConfigurationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewAttachedDatabaseConfigurationsClient(subscriptionID string, credential a // CheckNameAvailability - Checks that the attached database configuration resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - resourceName - The name of the resource. @@ -72,8 +71,12 @@ func (client *AttachedDatabaseConfigurationsClient) CheckNameAvailability(ctx co } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *AttachedDatabaseConfigurationsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, resourceName AttachedDatabaseConfigurationsCheckNameRequest, options *AttachedDatabaseConfigurationsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *AttachedDatabaseConfigurationsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, resourceName AttachedDatabaseConfigurationsCheckNameRequest, _ *AttachedDatabaseConfigurationsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurationCheckNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -82,18 +85,15 @@ func (client *AttachedDatabaseConfigurationsClient) checkNameAvailabilityCreateR return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resourceName); err != nil { return nil, err } @@ -111,8 +111,6 @@ func (client *AttachedDatabaseConfigurationsClient) checkNameAvailabilityHandleR // BeginCreateOrUpdate - Creates or updates an attached database configuration. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - attachedDatabaseConfigurationName - The name of the attached database configuration. @@ -138,8 +136,6 @@ func (client *AttachedDatabaseConfigurationsClient) BeginCreateOrUpdate(ctx cont // CreateOrUpdate - Creates or updates an attached database configuration. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *AttachedDatabaseConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration, options *AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AttachedDatabaseConfigurationsClient.BeginCreateOrUpdate" @@ -162,8 +158,12 @@ func (client *AttachedDatabaseConfigurationsClient) createOrUpdate(ctx context.C } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AttachedDatabaseConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration, options *AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AttachedDatabaseConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, parameters AttachedDatabaseConfiguration, _ *AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -176,18 +176,15 @@ func (client *AttachedDatabaseConfigurationsClient) createOrUpdateCreateRequest( return nil, errors.New("parameter attachedDatabaseConfigurationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{attachedDatabaseConfigurationName}", url.PathEscape(attachedDatabaseConfigurationName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -196,8 +193,6 @@ func (client *AttachedDatabaseConfigurationsClient) createOrUpdateCreateRequest( // BeginDelete - Deletes the attached database configuration with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - attachedDatabaseConfigurationName - The name of the attached database configuration. @@ -222,8 +217,6 @@ func (client *AttachedDatabaseConfigurationsClient) BeginDelete(ctx context.Cont // Delete - Deletes the attached database configuration with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *AttachedDatabaseConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, options *AttachedDatabaseConfigurationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AttachedDatabaseConfigurationsClient.BeginDelete" @@ -246,8 +239,12 @@ func (client *AttachedDatabaseConfigurationsClient) deleteOperation(ctx context. } // deleteCreateRequest creates the Delete request. -func (client *AttachedDatabaseConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, options *AttachedDatabaseConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AttachedDatabaseConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, _ *AttachedDatabaseConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -260,25 +257,18 @@ func (client *AttachedDatabaseConfigurationsClient) deleteCreateRequest(ctx cont return nil, errors.New("parameter attachedDatabaseConfigurationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{attachedDatabaseConfigurationName}", url.PathEscape(attachedDatabaseConfigurationName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Returns an attached database configuration. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - attachedDatabaseConfigurationName - The name of the attached database configuration. @@ -307,8 +297,12 @@ func (client *AttachedDatabaseConfigurationsClient) Get(ctx context.Context, res } // getCreateRequest creates the Get request. -func (client *AttachedDatabaseConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, options *AttachedDatabaseConfigurationsClientGetOptions) (*policy.Request, error) { +func (client *AttachedDatabaseConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, attachedDatabaseConfigurationName string, _ *AttachedDatabaseConfigurationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -321,17 +315,13 @@ func (client *AttachedDatabaseConfigurationsClient) getCreateRequest(ctx context return nil, errors.New("parameter attachedDatabaseConfigurationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{attachedDatabaseConfigurationName}", url.PathEscape(attachedDatabaseConfigurationName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -346,8 +336,6 @@ func (client *AttachedDatabaseConfigurationsClient) getHandleResponse(resp *http } // NewListByClusterPager - Returns the list of attached database configurations of the given Kusto cluster. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - AttachedDatabaseConfigurationsClientListByClusterOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.NewListByClusterPager @@ -355,21 +343,20 @@ func (client *AttachedDatabaseConfigurationsClient) getHandleResponse(resp *http func (client *AttachedDatabaseConfigurationsClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *AttachedDatabaseConfigurationsClientListByClusterOptions) *runtime.Pager[AttachedDatabaseConfigurationsClientListByClusterResponse] { return runtime.NewPager(runtime.PagingHandler[AttachedDatabaseConfigurationsClientListByClusterResponse]{ More: func(page AttachedDatabaseConfigurationsClientListByClusterResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AttachedDatabaseConfigurationsClientListByClusterResponse) (AttachedDatabaseConfigurationsClientListByClusterResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AttachedDatabaseConfigurationsClient.NewListByClusterPager") - req, err := client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return AttachedDatabaseConfigurationsClientListByClusterResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return AttachedDatabaseConfigurationsClientListByClusterResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AttachedDatabaseConfigurationsClientListByClusterResponse{}, runtime.NewResponseError(resp) - } return client.listByClusterHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -377,8 +364,12 @@ func (client *AttachedDatabaseConfigurationsClient) NewListByClusterPager(resour } // listByClusterCreateRequest creates the ListByCluster request. -func (client *AttachedDatabaseConfigurationsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *AttachedDatabaseConfigurationsClientListByClusterOptions) (*policy.Request, error) { +func (client *AttachedDatabaseConfigurationsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *AttachedDatabaseConfigurationsClientListByClusterOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -387,17 +378,13 @@ func (client *AttachedDatabaseConfigurationsClient) listByClusterCreateRequest(c return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go index db2fcfc5e738..0f9b6f3c9c74 100644 --- a/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/attacheddatabaseconfigurations_client_example_test.go @@ -1,28 +1,25 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoAttachedDatabaseConfigurationCheckNameAvailability.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,124 +33,23 @@ func ExampleAttachedDatabaseConfigurationsClient_CheckNameAvailability() { // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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), + // res = armkusto.AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoAttachedDatabaseConfigurationsCreateOrUpdate.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -166,17 +62,23 @@ func ExampleAttachedDatabaseConfigurationsClient_BeginCreateOrUpdate() { DefaultPrincipalsModificationKind: to.Ptr(armkusto.DefaultPrincipalsModificationKindUnion), TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ ExternalTablesToExclude: []*string{ - to.Ptr("ExternalTable2")}, + to.Ptr("ExternalTable2"), + }, ExternalTablesToInclude: []*string{ - to.Ptr("ExternalTable1")}, + to.Ptr("ExternalTable1"), + }, MaterializedViewsToExclude: []*string{ - to.Ptr("MaterializedViewTable2")}, + to.Ptr("MaterializedViewTable2"), + }, MaterializedViewsToInclude: []*string{ - to.Ptr("MaterializedViewTable1")}, + to.Ptr("MaterializedViewTable1"), + }, TablesToExclude: []*string{ - to.Ptr("Table2")}, + to.Ptr("Table2"), + }, TablesToInclude: []*string{ - to.Ptr("Table1")}, + to.Ptr("Table1"), + }, }, }, }, nil) @@ -185,48 +87,56 @@ func ExampleAttachedDatabaseConfigurationsClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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")}, + // res = armkusto.AttachedDatabaseConfigurationsClientCreateOrUpdateResponse{ + // 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")}, - // }, - // }, - // } + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoAttachedDatabaseConfigurationsDelete.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -234,8 +144,129 @@ func ExampleAttachedDatabaseConfigurationsClient_BeginDelete() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to poll 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.AttachedDatabaseConfigurationsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 = armkusto.AttachedDatabaseConfigurationsClientGetResponse{ + // 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: 2025-02-14/KustoAttachedDatabaseConfigurationsListByCluster.json +func ExampleAttachedDatabaseConfigurationsClient_NewListByClusterPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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 = armkusto.AttachedDatabaseConfigurationsClientListByClusterResponse{ + // 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"), + // }, + // }, + // }, + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/kusto/armkusto/autorest.md b/sdk/resourcemanager/kusto/armkusto/autorest.md deleted file mode 100644 index 50c720623e4c..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.3.0 -tag: package-2024-04 -``` diff --git a/sdk/resourcemanager/kusto/armkusto/build.go b/sdk/resourcemanager/kusto/armkusto/build.go deleted file mode 100644 index f854893b621d..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/kusto/armkusto - -package armkusto diff --git a/sdk/resourcemanager/kusto/armkusto/client_factory.go b/sdk/resourcemanager/kusto/armkusto/client_factory.go index 485bced6adf1..e21a8e0152d2 100644 --- a/sdk/resourcemanager/kusto/armkusto/client_factory.go +++ b/sdk/resourcemanager/kusto/armkusto/client_factory.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,7 +18,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { diff --git a/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go index 7950e8131b81..e9523229c251 100644 --- a/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go +++ b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // ClusterPrincipalAssignmentsClient contains the methods for the ClusterPrincipalAssignments group. // Don't use this type directly, use NewClusterPrincipalAssignmentsClient() instead. +// +// Generated from API version 2025-02-14 type ClusterPrincipalAssignmentsClient struct { internal *arm.Client subscriptionID string } // NewClusterPrincipalAssignmentsClient creates a new instance of ClusterPrincipalAssignmentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewClusterPrincipalAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClusterPrincipalAssignmentsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewClusterPrincipalAssignmentsClient(subscriptionID string, credential azco // CheckNameAvailability - Checks that the principal assignment name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - principalAssignmentName - The name of the principal assignment. @@ -72,8 +71,12 @@ func (client *ClusterPrincipalAssignmentsClient) CheckNameAvailability(ctx conte } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *ClusterPrincipalAssignmentsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName ClusterPrincipalAssignmentCheckNameRequest, options *ClusterPrincipalAssignmentsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *ClusterPrincipalAssignmentsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName ClusterPrincipalAssignmentCheckNameRequest, _ *ClusterPrincipalAssignmentsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkPrincipalAssignmentNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -82,18 +85,15 @@ func (client *ClusterPrincipalAssignmentsClient) checkNameAvailabilityCreateRequ return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, principalAssignmentName); err != nil { return nil, err } @@ -111,8 +111,6 @@ func (client *ClusterPrincipalAssignmentsClient) checkNameAvailabilityHandleResp // BeginCreateOrUpdate - Create a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - principalAssignmentName - The name of the Kusto principalAssignment. @@ -138,8 +136,6 @@ func (client *ClusterPrincipalAssignmentsClient) BeginCreateOrUpdate(ctx context // CreateOrUpdate - Create a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClusterPrincipalAssignmentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, parameters ClusterPrincipalAssignment, options *ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ClusterPrincipalAssignmentsClient.BeginCreateOrUpdate" @@ -162,7 +158,7 @@ func (client *ClusterPrincipalAssignmentsClient) createOrUpdate(ctx context.Cont } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ClusterPrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, parameters ClusterPrincipalAssignment, options *ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ClusterPrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, parameters ClusterPrincipalAssignment, _ *ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -185,9 +181,10 @@ func (client *ClusterPrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -196,8 +193,6 @@ func (client *ClusterPrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - principalAssignmentName - The name of the Kusto principalAssignment. @@ -222,8 +217,6 @@ func (client *ClusterPrincipalAssignmentsClient) BeginDelete(ctx context.Context // Delete - Deletes a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClusterPrincipalAssignmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, options *ClusterPrincipalAssignmentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ClusterPrincipalAssignmentsClient.BeginDelete" @@ -246,7 +239,7 @@ func (client *ClusterPrincipalAssignmentsClient) deleteOperation(ctx context.Con } // deleteCreateRequest creates the Delete request. -func (client *ClusterPrincipalAssignmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, options *ClusterPrincipalAssignmentsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ClusterPrincipalAssignmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, _ *ClusterPrincipalAssignmentsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,16 +262,13 @@ func (client *ClusterPrincipalAssignmentsClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets a Kusto cluster principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - principalAssignmentName - The name of the Kusto principalAssignment. @@ -307,7 +297,7 @@ func (client *ClusterPrincipalAssignmentsClient) Get(ctx context.Context, resour } // getCreateRequest creates the Get request. -func (client *ClusterPrincipalAssignmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, options *ClusterPrincipalAssignmentsClientGetOptions) (*policy.Request, error) { +func (client *ClusterPrincipalAssignmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, principalAssignmentName string, _ *ClusterPrincipalAssignmentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -330,8 +320,8 @@ func (client *ClusterPrincipalAssignmentsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -346,8 +336,6 @@ func (client *ClusterPrincipalAssignmentsClient) getHandleResponse(resp *http.Re } // NewListPager - Lists all Kusto cluster principalAssignments. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClusterPrincipalAssignmentsClientListOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.NewListPager @@ -355,21 +343,20 @@ func (client *ClusterPrincipalAssignmentsClient) getHandleResponse(resp *http.Re func (client *ClusterPrincipalAssignmentsClient) NewListPager(resourceGroupName string, clusterName string, options *ClusterPrincipalAssignmentsClientListOptions) *runtime.Pager[ClusterPrincipalAssignmentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClusterPrincipalAssignmentsClientListResponse]{ More: func(page ClusterPrincipalAssignmentsClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClusterPrincipalAssignmentsClientListResponse) (ClusterPrincipalAssignmentsClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClusterPrincipalAssignmentsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return ClusterPrincipalAssignmentsClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return ClusterPrincipalAssignmentsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClusterPrincipalAssignmentsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -377,7 +364,7 @@ func (client *ClusterPrincipalAssignmentsClient) NewListPager(resourceGroupName } // listCreateRequest creates the List request. -func (client *ClusterPrincipalAssignmentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClusterPrincipalAssignmentsClientListOptions) (*policy.Request, error) { +func (client *ClusterPrincipalAssignmentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClusterPrincipalAssignmentsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -396,8 +383,8 @@ func (client *ClusterPrincipalAssignmentsClient) listCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go index 25f095867bb4..4fc1193bdb50 100644 --- a/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/clusterprincipalassignments_client_example_test.go @@ -1,28 +1,25 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterPrincipalAssignmentsCheckNameAvailability.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,123 +33,134 @@ func ExampleClusterPrincipalAssignmentsClient_CheckNameAvailability() { // 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), + // res = armkusto.ClusterPrincipalAssignmentsClientCheckNameAvailabilityResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterPrincipalAssignmentsGet.json -func ExampleClusterPrincipalAssignmentsClient_Get() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewClusterPrincipalAssignmentsClient().Get(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", nil) + 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 poll 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"), + // res = armkusto.ClusterPrincipalAssignmentsClientCreateOrUpdateResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterPrincipalAssignmentsCreateOrUpdate.json -func ExampleClusterPrincipalAssignmentsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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) + poller, err := clientFactory.NewClusterPrincipalAssignmentsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", 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) + log.Fatalf("failed to poll 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"), - // }, + // res = armkusto.ClusterPrincipalAssignmentsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterPrincipalAssignmentsDelete.json -func ExampleClusterPrincipalAssignmentsClient_BeginDelete() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewClusterPrincipalAssignmentsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "kustoprincipal1", nil) + res, err := clientFactory.NewClusterPrincipalAssignmentsClient().Get(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) - } + // 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.ClusterPrincipalAssignmentsClientGetResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterPrincipalAssignmentsList.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -167,38 +175,41 @@ func ExampleClusterPrincipalAssignmentsClient_NewListPager() { _ = 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"), + // page = armkusto.ClusterPrincipalAssignmentsClientListResponse{ + // 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"), + // { + // 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 26fb7b53f669..698f9f5d2a83 100644 --- a/sdk/resourcemanager/kusto/armkusto/clusters_client.go +++ b/sdk/resourcemanager/kusto/armkusto/clusters_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // ClustersClient contains the methods for the Clusters group. // Don't use this type directly, use NewClustersClient() instead. +// +// Generated from API version 2025-02-14 type ClustersClient struct { internal *arm.Client subscriptionID string } // NewClustersClient creates a new instance of ClustersClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClustersClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, // BeginAddCalloutPolicies - Adds a list of callout policies for engine services. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - calloutPolicies - The callout policies to add. @@ -68,8 +67,6 @@ func (client *ClustersClient) BeginAddCalloutPolicies(ctx context.Context, resou // AddCalloutPolicies - Adds a list of callout policies for engine services. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) addCalloutPolicies(ctx context.Context, resourceGroupName string, clusterName string, calloutPolicies CalloutPoliciesList, options *ClustersClientBeginAddCalloutPoliciesOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginAddCalloutPolicies" @@ -92,7 +89,7 @@ func (client *ClustersClient) addCalloutPolicies(ctx context.Context, resourceGr } // addCalloutPoliciesCreateRequest creates the AddCalloutPolicies request. -func (client *ClustersClient) addCalloutPoliciesCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, calloutPolicies CalloutPoliciesList, options *ClustersClientBeginAddCalloutPoliciesOptions) (*policy.Request, error) { +func (client *ClustersClient) addCalloutPoliciesCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, calloutPolicies CalloutPoliciesList, _ *ClustersClientBeginAddCalloutPoliciesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addCalloutPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -111,9 +108,9 @@ func (client *ClustersClient) addCalloutPoliciesCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, calloutPolicies); err != nil { return nil, err } @@ -122,8 +119,6 @@ func (client *ClustersClient) addCalloutPoliciesCreateRequest(ctx context.Contex // BeginAddLanguageExtensions - Add a list of language extensions that can run within KQL queries. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - languageExtensionsToAdd - The language extensions to add. @@ -148,8 +143,6 @@ func (client *ClustersClient) BeginAddLanguageExtensions(ctx context.Context, re // AddLanguageExtensions - Add a list of language extensions that can run within KQL queries. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) addLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList, options *ClustersClientBeginAddLanguageExtensionsOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginAddLanguageExtensions" @@ -172,7 +165,7 @@ func (client *ClustersClient) addLanguageExtensions(ctx context.Context, resourc } // addLanguageExtensionsCreateRequest creates the AddLanguageExtensions request. -func (client *ClustersClient) addLanguageExtensionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList, options *ClustersClientBeginAddLanguageExtensionsOptions) (*policy.Request, error) { +func (client *ClustersClient) addLanguageExtensionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd LanguageExtensionsList, _ *ClustersClientBeginAddLanguageExtensionsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -191,9 +184,9 @@ func (client *ClustersClient) addLanguageExtensionsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, languageExtensionsToAdd); err != nil { return nil, err } @@ -202,10 +195,8 @@ func (client *ClustersClient) addLanguageExtensionsCreateRequest(ctx context.Con // CheckNameAvailability - Checks that the cluster name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 -// - location - The name of Azure region. -// - clusterName - The name of the cluster. +// - location - The location name. +// - clusterName - The request body // - 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) { @@ -231,7 +222,7 @@ func (client *ClustersClient) CheckNameAvailability(ctx context.Context, locatio } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *ClustersClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, clusterName ClusterCheckNameRequest, options *ClustersClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *ClustersClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, clusterName ClusterCheckNameRequest, _ *ClustersClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -246,9 +237,10 @@ func (client *ClustersClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, clusterName); err != nil { return nil, err } @@ -266,8 +258,6 @@ func (client *ClustersClient) checkNameAvailabilityHandleResponse(resp *http.Res // BeginCreateOrUpdate - Create or update a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - parameters - The Kusto cluster parameters supplied to the CreateOrUpdate operation. @@ -292,8 +282,6 @@ func (client *ClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginCreateOrUpdate" @@ -318,6 +306,10 @@ func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupN // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -326,17 +318,13 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -344,6 +332,7 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r if options != nil && options.IfNoneMatch != nil { req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -352,8 +341,6 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Deletes a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. @@ -376,8 +363,6 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginDelete" @@ -400,8 +385,12 @@ func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -410,25 +399,18 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // BeginDetachFollowerDatabases - Detaches all followers of a database owned by this cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - followerDatabaseToRemove - The follower databases properties to remove. @@ -453,8 +435,6 @@ func (client *ClustersClient) BeginDetachFollowerDatabases(ctx context.Context, // DetachFollowerDatabases - Detaches all followers of a database owned by this cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) detachFollowerDatabases(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition, options *ClustersClientBeginDetachFollowerDatabasesOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginDetachFollowerDatabases" @@ -477,8 +457,12 @@ func (client *ClustersClient) detachFollowerDatabases(ctx context.Context, resou } // detachFollowerDatabasesCreateRequest creates the DetachFollowerDatabases request. -func (client *ClustersClient) detachFollowerDatabasesCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition, options *ClustersClientBeginDetachFollowerDatabasesOptions) (*policy.Request, error) { +func (client *ClustersClient) detachFollowerDatabasesCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove FollowerDatabaseDefinition, _ *ClustersClientBeginDetachFollowerDatabasesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -487,18 +471,14 @@ func (client *ClustersClient) detachFollowerDatabasesCreateRequest(ctx context.C return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, followerDatabaseToRemove); err != nil { return nil, err } @@ -508,8 +488,6 @@ func (client *ClustersClient) detachFollowerDatabasesCreateRequest(ctx context.C // BeginDiagnoseVirtualNetwork - Diagnoses network connectivity status for external resources on which the service is dependent // on. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientBeginDiagnoseVirtualNetworkOptions contains the optional parameters for the ClustersClient.BeginDiagnoseVirtualNetwork @@ -534,8 +512,6 @@ func (client *ClustersClient) BeginDiagnoseVirtualNetwork(ctx context.Context, r // DiagnoseVirtualNetwork - Diagnoses network connectivity status for external resources on which the service is dependent // on. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) diagnoseVirtualNetwork(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDiagnoseVirtualNetworkOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginDiagnoseVirtualNetwork" @@ -558,8 +534,12 @@ func (client *ClustersClient) diagnoseVirtualNetwork(ctx context.Context, resour } // diagnoseVirtualNetworkCreateRequest creates the DiagnoseVirtualNetwork request. -func (client *ClustersClient) diagnoseVirtualNetworkCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDiagnoseVirtualNetworkOptions) (*policy.Request, error) { +func (client *ClustersClient) diagnoseVirtualNetworkCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientBeginDiagnoseVirtualNetworkOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -568,25 +548,19 @@ func (client *ClustersClient) diagnoseVirtualNetworkCreateRequest(ctx context.Co return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. @@ -613,8 +587,12 @@ func (client *ClustersClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetOptions) (*policy.Request, error) { +func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -623,17 +601,13 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -648,27 +622,24 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl } // NewListPager - Lists all Kusto clusters within a subscription. -// -// Generated from API version 2024-04-13 // - options - ClustersClientListOptions contains the optional parameters for the ClustersClient.NewListPager method. func (client *ClustersClient) NewListPager(options *ClustersClientListOptions) *runtime.Pager[ClustersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListResponse]{ More: func(page ClustersClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClustersClientListResponse) (ClustersClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListPager") - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return ClustersClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return ClustersClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -676,7 +647,7 @@ func (client *ClustersClient) NewListPager(options *ClustersClientListOptions) * } // listCreateRequest creates the List request. -func (client *ClustersClient) listCreateRequest(ctx context.Context, options *ClustersClientListOptions) (*policy.Request, error) { +func (client *ClustersClient) listCreateRequest(ctx context.Context, _ *ClustersClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -687,8 +658,8 @@ func (client *ClustersClient) listCreateRequest(ctx context.Context, options *Cl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -703,29 +674,26 @@ func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersC } // NewListByResourceGroupPager - Lists all Kusto clusters within a resource group. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager // method. func (client *ClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *ClustersClientListByResourceGroupOptions) *runtime.Pager[ClustersClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListByResourceGroupResponse]{ More: func(page ClustersClientListByResourceGroupResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClustersClientListByResourceGroupResponse) (ClustersClientListByResourceGroupResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return ClustersClientListByResourceGroupResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) if err != nil { return ClustersClientListByResourceGroupResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } return client.listByResourceGroupHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -733,23 +701,23 @@ func (client *ClustersClient) NewListByResourceGroupPager(resourceGroupName stri } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClustersClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ClustersClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -764,8 +732,6 @@ func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Respo } // NewListCalloutPoliciesPager - Returns the allowed callout policies for the specified service. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientListCalloutPoliciesOptions contains the optional parameters for the ClustersClient.NewListCalloutPoliciesPager @@ -773,21 +739,20 @@ func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Respo func (client *ClustersClient) NewListCalloutPoliciesPager(resourceGroupName string, clusterName string, options *ClustersClientListCalloutPoliciesOptions) *runtime.Pager[ClustersClientListCalloutPoliciesResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListCalloutPoliciesResponse]{ More: func(page ClustersClientListCalloutPoliciesResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClustersClientListCalloutPoliciesResponse) (ClustersClientListCalloutPoliciesResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListCalloutPoliciesPager") - req, err := client.listCalloutPoliciesCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return ClustersClientListCalloutPoliciesResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCalloutPoliciesCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return ClustersClientListCalloutPoliciesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListCalloutPoliciesResponse{}, runtime.NewResponseError(resp) - } return client.listCalloutPoliciesHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -795,8 +760,12 @@ func (client *ClustersClient) NewListCalloutPoliciesPager(resourceGroupName stri } // listCalloutPoliciesCreateRequest creates the ListCalloutPolicies request. -func (client *ClustersClient) listCalloutPoliciesCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientListCalloutPoliciesOptions) (*policy.Request, error) { +func (client *ClustersClient) listCalloutPoliciesCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientListCalloutPoliciesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listCalloutPolicies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -805,17 +774,13 @@ func (client *ClustersClient) listCalloutPoliciesCreateRequest(ctx context.Conte return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -831,8 +796,6 @@ func (client *ClustersClient) listCalloutPoliciesHandleResponse(resp *http.Respo // NewListFollowerDatabasesPager - Returns a list of databases that are owned by this cluster and were followed by another // cluster. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientListFollowerDatabasesOptions contains the optional parameters for the ClustersClient.NewListFollowerDatabasesPager @@ -840,21 +803,20 @@ func (client *ClustersClient) listCalloutPoliciesHandleResponse(resp *http.Respo func (client *ClustersClient) NewListFollowerDatabasesPager(resourceGroupName string, clusterName string, options *ClustersClientListFollowerDatabasesOptions) *runtime.Pager[ClustersClientListFollowerDatabasesResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListFollowerDatabasesResponse]{ More: func(page ClustersClientListFollowerDatabasesResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClustersClientListFollowerDatabasesResponse) (ClustersClientListFollowerDatabasesResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListFollowerDatabasesPager") - req, err := client.listFollowerDatabasesCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return ClustersClientListFollowerDatabasesResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listFollowerDatabasesCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return ClustersClientListFollowerDatabasesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListFollowerDatabasesResponse{}, runtime.NewResponseError(resp) - } return client.listFollowerDatabasesHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -862,8 +824,12 @@ func (client *ClustersClient) NewListFollowerDatabasesPager(resourceGroupName st } // listFollowerDatabasesCreateRequest creates the ListFollowerDatabases request. -func (client *ClustersClient) listFollowerDatabasesCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientListFollowerDatabasesOptions) (*policy.Request, error) { +func (client *ClustersClient) listFollowerDatabasesCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientListFollowerDatabasesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -872,17 +838,13 @@ func (client *ClustersClient) listFollowerDatabasesCreateRequest(ctx context.Con return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -898,8 +860,6 @@ func (client *ClustersClient) listFollowerDatabasesHandleResponse(resp *http.Res // NewListFollowerDatabasesGetPager - Returns a list of databases that are owned by this cluster and were followed by another // cluster. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientListFollowerDatabasesGetOptions contains the optional parameters for the ClustersClient.NewListFollowerDatabasesGetPager @@ -907,21 +867,20 @@ func (client *ClustersClient) listFollowerDatabasesHandleResponse(resp *http.Res func (client *ClustersClient) NewListFollowerDatabasesGetPager(resourceGroupName string, clusterName string, options *ClustersClientListFollowerDatabasesGetOptions) *runtime.Pager[ClustersClientListFollowerDatabasesGetResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListFollowerDatabasesGetResponse]{ More: func(page ClustersClientListFollowerDatabasesGetResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClustersClientListFollowerDatabasesGetResponse) (ClustersClientListFollowerDatabasesGetResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListFollowerDatabasesGetPager") - req, err := client.listFollowerDatabasesGetCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return ClustersClientListFollowerDatabasesGetResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listFollowerDatabasesGetCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return ClustersClientListFollowerDatabasesGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListFollowerDatabasesGetResponse{}, runtime.NewResponseError(resp) - } return client.listFollowerDatabasesGetHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -929,8 +888,12 @@ func (client *ClustersClient) NewListFollowerDatabasesGetPager(resourceGroupName } // listFollowerDatabasesGetCreateRequest creates the ListFollowerDatabasesGet request. -func (client *ClustersClient) listFollowerDatabasesGetCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientListFollowerDatabasesGetOptions) (*policy.Request, error) { +func (client *ClustersClient) listFollowerDatabasesGetCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientListFollowerDatabasesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -939,17 +902,13 @@ func (client *ClustersClient) listFollowerDatabasesGetCreateRequest(ctx context. return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -964,8 +923,6 @@ func (client *ClustersClient) listFollowerDatabasesGetHandleResponse(resp *http. } // NewListLanguageExtensionsPager - Returns a list of language extensions that can run within KQL queries. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientListLanguageExtensionsOptions contains the optional parameters for the ClustersClient.NewListLanguageExtensionsPager @@ -973,21 +930,20 @@ func (client *ClustersClient) listFollowerDatabasesGetHandleResponse(resp *http. func (client *ClustersClient) NewListLanguageExtensionsPager(resourceGroupName string, clusterName string, options *ClustersClientListLanguageExtensionsOptions) *runtime.Pager[ClustersClientListLanguageExtensionsResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListLanguageExtensionsResponse]{ More: func(page ClustersClientListLanguageExtensionsResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClustersClientListLanguageExtensionsResponse) (ClustersClientListLanguageExtensionsResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListLanguageExtensionsPager") - req, err := client.listLanguageExtensionsCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return ClustersClientListLanguageExtensionsResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listLanguageExtensionsCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return ClustersClientListLanguageExtensionsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListLanguageExtensionsResponse{}, runtime.NewResponseError(resp) - } return client.listLanguageExtensionsHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -995,7 +951,7 @@ func (client *ClustersClient) NewListLanguageExtensionsPager(resourceGroupName s } // listLanguageExtensionsCreateRequest creates the ListLanguageExtensions request. -func (client *ClustersClient) listLanguageExtensionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientListLanguageExtensionsOptions) (*policy.Request, error) { +func (client *ClustersClient) listLanguageExtensionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientListLanguageExtensionsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listLanguageExtensions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1014,8 +970,8 @@ func (client *ClustersClient) listLanguageExtensionsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -1030,8 +986,6 @@ func (client *ClustersClient) listLanguageExtensionsHandleResponse(resp *http.Re } // NewListOutboundNetworkDependenciesEndpointsPager - Gets the network endpoints of all outbound dependencies of a Kusto cluster -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the ClustersClient.NewListOutboundNetworkDependenciesEndpointsPager @@ -1060,7 +1014,7 @@ func (client *ClustersClient) NewListOutboundNetworkDependenciesEndpointsPager(r } // listOutboundNetworkDependenciesEndpointsCreateRequest creates the ListOutboundNetworkDependenciesEndpoints request. -func (client *ClustersClient) listOutboundNetworkDependenciesEndpointsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientListOutboundNetworkDependenciesEndpointsOptions) (*policy.Request, error) { +func (client *ClustersClient) listOutboundNetworkDependenciesEndpointsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientListOutboundNetworkDependenciesEndpointsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/outboundNetworkDependenciesEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1079,8 +1033,8 @@ func (client *ClustersClient) listOutboundNetworkDependenciesEndpointsCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -1095,27 +1049,24 @@ func (client *ClustersClient) listOutboundNetworkDependenciesEndpointsHandleResp } // NewListSKUsPager - Lists eligible SKUs for Kusto resource provider. -// -// Generated from API version 2024-04-13 // - options - ClustersClientListSKUsOptions contains the optional parameters for the ClustersClient.NewListSKUsPager method. func (client *ClustersClient) NewListSKUsPager(options *ClustersClientListSKUsOptions) *runtime.Pager[ClustersClientListSKUsResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListSKUsResponse]{ More: func(page ClustersClientListSKUsResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClustersClientListSKUsResponse) (ClustersClientListSKUsResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListSKUsPager") - req, err := client.listSKUsCreateRequest(ctx, options) - if err != nil { - return ClustersClientListSKUsResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listSKUsCreateRequest(ctx, options) + }, nil) if err != nil { return ClustersClientListSKUsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListSKUsResponse{}, runtime.NewResponseError(resp) - } return client.listSKUsHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -1123,7 +1074,7 @@ func (client *ClustersClient) NewListSKUsPager(options *ClustersClientListSKUsOp } // listSKUsCreateRequest creates the ListSKUs request. -func (client *ClustersClient) listSKUsCreateRequest(ctx context.Context, options *ClustersClientListSKUsOptions) (*policy.Request, error) { +func (client *ClustersClient) listSKUsCreateRequest(ctx context.Context, _ *ClustersClientListSKUsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1134,8 +1085,8 @@ func (client *ClustersClient) listSKUsCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -1150,8 +1101,6 @@ func (client *ClustersClient) listSKUsHandleResponse(resp *http.Response) (Clust } // NewListSKUsByResourcePager - Returns the SKUs available for the provided resource. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientListSKUsByResourceOptions contains the optional parameters for the ClustersClient.NewListSKUsByResourcePager @@ -1159,21 +1108,20 @@ func (client *ClustersClient) listSKUsHandleResponse(resp *http.Response) (Clust func (client *ClustersClient) NewListSKUsByResourcePager(resourceGroupName string, clusterName string, options *ClustersClientListSKUsByResourceOptions) *runtime.Pager[ClustersClientListSKUsByResourceResponse] { return runtime.NewPager(runtime.PagingHandler[ClustersClientListSKUsByResourceResponse]{ More: func(page ClustersClientListSKUsByResourceResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ClustersClientListSKUsByResourceResponse) (ClustersClientListSKUsByResourceResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ClustersClient.NewListSKUsByResourcePager") - req, err := client.listSKUsByResourceCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return ClustersClientListSKUsByResourceResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listSKUsByResourceCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return ClustersClientListSKUsByResourceResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClustersClientListSKUsByResourceResponse{}, runtime.NewResponseError(resp) - } return client.listSKUsByResourceHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -1181,8 +1129,12 @@ func (client *ClustersClient) NewListSKUsByResourcePager(resourceGroupName strin } // listSKUsByResourceCreateRequest creates the ListSKUsByResource request. -func (client *ClustersClient) listSKUsByResourceCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientListSKUsByResourceOptions) (*policy.Request, error) { +func (client *ClustersClient) listSKUsByResourceCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientListSKUsByResourceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -1191,17 +1143,13 @@ func (client *ClustersClient) listSKUsByResourceCreateRequest(ctx context.Contex return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -1217,8 +1165,6 @@ func (client *ClustersClient) listSKUsByResourceHandleResponse(resp *http.Respon // BeginMigrate - Migrate data from a Kusto cluster to another cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - clusterMigrateRequest - The cluster migrate request parameters. @@ -1242,8 +1188,6 @@ func (client *ClustersClient) BeginMigrate(ctx context.Context, resourceGroupNam // Migrate - Migrate data from a Kusto cluster to another cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) migrate(ctx context.Context, resourceGroupName string, clusterName string, clusterMigrateRequest ClusterMigrateRequest, options *ClustersClientBeginMigrateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginMigrate" @@ -1266,8 +1210,12 @@ func (client *ClustersClient) migrate(ctx context.Context, resourceGroupName str } // migrateCreateRequest creates the Migrate request. -func (client *ClustersClient) migrateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, clusterMigrateRequest ClusterMigrateRequest, options *ClustersClientBeginMigrateOptions) (*policy.Request, error) { +func (client *ClustersClient) migrateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, clusterMigrateRequest ClusterMigrateRequest, _ *ClustersClientBeginMigrateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/migrate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -1276,18 +1224,14 @@ func (client *ClustersClient) migrateCreateRequest(ctx context.Context, resource return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, clusterMigrateRequest); err != nil { return nil, err } @@ -1296,8 +1240,6 @@ func (client *ClustersClient) migrateCreateRequest(ctx context.Context, resource // BeginRemoveCalloutPolicy - Removes callout policy for engine services. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - calloutPolicy - The callout policies to remove. @@ -1322,8 +1264,6 @@ func (client *ClustersClient) BeginRemoveCalloutPolicy(ctx context.Context, reso // RemoveCalloutPolicy - Removes callout policy for engine services. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) removeCalloutPolicy(ctx context.Context, resourceGroupName string, clusterName string, calloutPolicy CalloutPolicyToRemove, options *ClustersClientBeginRemoveCalloutPolicyOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginRemoveCalloutPolicy" @@ -1346,7 +1286,7 @@ func (client *ClustersClient) removeCalloutPolicy(ctx context.Context, resourceG } // removeCalloutPolicyCreateRequest creates the RemoveCalloutPolicy request. -func (client *ClustersClient) removeCalloutPolicyCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, calloutPolicy CalloutPolicyToRemove, options *ClustersClientBeginRemoveCalloutPolicyOptions) (*policy.Request, error) { +func (client *ClustersClient) removeCalloutPolicyCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, calloutPolicy CalloutPolicyToRemove, _ *ClustersClientBeginRemoveCalloutPolicyOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeCalloutPolicy" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1365,9 +1305,9 @@ func (client *ClustersClient) removeCalloutPolicyCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, calloutPolicy); err != nil { return nil, err } @@ -1376,8 +1316,6 @@ func (client *ClustersClient) removeCalloutPolicyCreateRequest(ctx context.Conte // BeginRemoveLanguageExtensions - Remove a list of language extensions that can run within KQL queries. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - languageExtensionsToRemove - The language extensions to remove. @@ -1402,8 +1340,6 @@ func (client *ClustersClient) BeginRemoveLanguageExtensions(ctx context.Context, // RemoveLanguageExtensions - Remove a list of language extensions that can run within KQL queries. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) removeLanguageExtensions(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList, options *ClustersClientBeginRemoveLanguageExtensionsOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginRemoveLanguageExtensions" @@ -1426,7 +1362,7 @@ func (client *ClustersClient) removeLanguageExtensions(ctx context.Context, reso } // removeLanguageExtensionsCreateRequest creates the RemoveLanguageExtensions request. -func (client *ClustersClient) removeLanguageExtensionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList, options *ClustersClientBeginRemoveLanguageExtensionsOptions) (*policy.Request, error) { +func (client *ClustersClient) removeLanguageExtensionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove LanguageExtensionsList, _ *ClustersClientBeginRemoveLanguageExtensionsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1445,9 +1381,9 @@ func (client *ClustersClient) removeLanguageExtensionsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, languageExtensionsToRemove); err != nil { return nil, err } @@ -1456,8 +1392,6 @@ func (client *ClustersClient) removeLanguageExtensionsCreateRequest(ctx context. // BeginStart - Starts a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientBeginStartOptions contains the optional parameters for the ClustersClient.BeginStart method. @@ -1480,8 +1414,6 @@ func (client *ClustersClient) BeginStart(ctx context.Context, resourceGroupName // Start - Starts a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) start(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginStart" @@ -1504,8 +1436,12 @@ func (client *ClustersClient) start(ctx context.Context, resourceGroupName strin } // startCreateRequest creates the Start request. -func (client *ClustersClient) startCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStartOptions) (*policy.Request, error) { +func (client *ClustersClient) startCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -1514,25 +1450,18 @@ func (client *ClustersClient) startCreateRequest(ctx context.Context, resourceGr return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // BeginStop - Stops a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ClustersClientBeginStopOptions contains the optional parameters for the ClustersClient.BeginStop method. @@ -1555,8 +1484,6 @@ func (client *ClustersClient) BeginStop(ctx context.Context, resourceGroupName s // Stop - Stops a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) stop(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginStop" @@ -1579,8 +1506,12 @@ func (client *ClustersClient) stop(ctx context.Context, resourceGroupName string } // stopCreateRequest creates the Stop request. -func (client *ClustersClient) stopCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStopOptions) (*policy.Request, error) { +func (client *ClustersClient) stopCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientBeginStopOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -1589,25 +1520,18 @@ func (client *ClustersClient) stopCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // BeginUpdate - Update a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - parameters - The Kusto cluster parameters supplied to the Update operation. @@ -1631,8 +1555,6 @@ func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Update a Kusto cluster. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ClustersClient) update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *ClustersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginUpdate" @@ -1657,6 +1579,10 @@ func (client *ClustersClient) update(ctx context.Context, resourceGroupName stri // updateCreateRequest creates the Update request. func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *ClustersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -1665,21 +1591,18 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go index 4261792d7646..458cc2a12037 100644 --- a/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/clusters_client_example_test.go @@ -1,131 +1,326 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersGet.json -func ExampleClustersClient_Get() { +// Generated from example definition: 2025-02-14/KustoClusterAddCalloutPolicies.json +func ExampleClustersClient_BeginAddCalloutPolicies() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewClustersClient().Get(ctx, "kustorptest", "kustoCluster", nil) + poller, err := clientFactory.NewClustersClient().BeginAddCalloutPolicies(ctx, "kustorptest", "kustoCluster", armkusto.CalloutPoliciesList{ + Value: []*armkusto.CalloutPolicy{ + { + CalloutType: to.Ptr(armkusto.CalloutTypeKusto), + CalloutURIRegex: to.Ptr("*"), + OutboundAccess: to.Ptr(armkusto.OutboundAccessAllow), + }, + }, + }, 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 poll 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("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{ - // }, + // res = armkusto.ClustersClientAddCalloutPoliciesResponse{ + // } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to poll 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.ClustersClientAddLanguageExtensionsResponse{ + // } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 = armkusto.ClustersClientCheckNameAvailabilityResponse{ + // CheckNameResult: armkusto.CheckNameResult{ + // Name: to.Ptr("kuskusprod"), + // Message: to.Ptr("Name 'kuskusprod' is already taken. Please specify a different name"), + // NameAvailable: to.Ptr(false), // }, - // Properties: &armkusto.ClusterProperties{ - // AllowedFqdnList: []*string{ - // to.Ptr("my-stroage.blob.core.windows.net")}, - // AllowedIPRangeList: []*string{ - // }, - // EnableAutoStop: to.Ptr(true), + // } +} + +// Generated from example definition: 2025-02-14/KustoClusterCreateWithCMKFederatedIdentity.json +func ExampleClustersClient_BeginCreateOrUpdate_kustoClusterCreateWithCmkFederatedIdentity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClustersClient().BeginCreateOrUpdate(ctx, "kustoRgTest", "kustoClusterCMK", armkusto.Cluster{ + Location: to.Ptr("westus"), + SKU: &armkusto.AzureSKU{ + Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), + Capacity: to.Ptr[int32](2), + Tier: to.Ptr(armkusto.AzureSKUTierStandard), + }, + Identity: &armkusto.Identity{ + Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": {}, + }, + }, + Properties: &armkusto.ClusterProperties{ + EnableStreamingIngest: to.Ptr(true), + EnablePurge: to.Ptr(true), + EnableDoubleEncryption: to.Ptr(false), + EnableAutoStop: to.Ptr(true), + PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), + PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), + RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), + KeyVaultProperties: &armkusto.KeyVaultProperties{ + KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + KeyName: to.Ptr("myClusterCMKKey"), + KeyVersion: to.Ptr("12345678-1234-1234-1234-123456789098"), + UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + FederatedIdentityClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), + }, + EngineType: to.Ptr(armkusto.EngineTypeV3), + }, + }, 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 poll 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.ClustersClientCreateOrUpdateResponse{ + // Cluster: armkusto.Cluster{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.Kusto/Clusters/kustoClusterCMK"), + // Name: to.Ptr("kustoClusterCMK"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), // EnableDiskEncryption: to.Ptr(false), - // EnablePurge: to.Ptr(false), // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV3), + // EnablePurge: to.Ptr(true), + // EnableDoubleEncryption: to.Ptr(false), + // EnableAutoStop: to.Ptr(true), + // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), + // PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), + // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), // KeyVaultProperties: &armkusto.KeyVaultProperties{ - // KeyName: to.Ptr("keyName"), - // KeyVaultURI: to.Ptr("https://dummy.keyvault.com"), - // KeyVersion: to.Ptr("keyVersion"), + // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + // KeyName: to.Ptr("myClusterCMKKey"), + // KeyVersion: to.Ptr("12345678-1234-1234-1234-123456789098"), + // UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + // FederatedIdentityClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), // }, - // 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"), + // EngineType: to.Ptr(armkusto.EngineTypeV3), + // }, + // SKU: &armkusto.AzureSKU{ + // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), + // Tier: to.Ptr(armkusto.AzureSKUTierStandard), + // Capacity: to.Ptr[int32](2), + // }, + // Identity: &armkusto.Identity{ + // Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": &armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // ClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), + // PrincipalID: to.Ptr("66666666-7777-8888-9999-000000000000"), + // }, // }, - // 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"), - // }, - // }}, + // }, + // Etag: to.Ptr("abcd1234"), + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoClusterCreateWithCMKUserAssignedIdentity.json +func ExampleClustersClient_BeginCreateOrUpdate_kustoClusterCreateWithCmkUserAssignedIdentity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClustersClient().BeginCreateOrUpdate(ctx, "kustoRgTest", "kustoClusterCMK", armkusto.Cluster{ + Location: to.Ptr("westus"), + SKU: &armkusto.AzureSKU{ + Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), + Capacity: to.Ptr[int32](2), + Tier: to.Ptr(armkusto.AzureSKUTierStandard), + }, + Identity: &armkusto.Identity{ + Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": {}, + }, + }, + Properties: &armkusto.ClusterProperties{ + EnableStreamingIngest: to.Ptr(true), + EnablePurge: to.Ptr(true), + EnableDoubleEncryption: to.Ptr(false), + EnableAutoStop: to.Ptr(true), + PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), + PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), + RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), + KeyVaultProperties: &armkusto.KeyVaultProperties{ + KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + KeyName: to.Ptr("myClusterCMKKey"), + KeyVersion: to.Ptr("12345678-1234-1234-1234-123456789098"), + UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + }, + EngineType: to.Ptr(armkusto.EngineTypeV3), + }, + }, 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 poll 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.ClustersClientCreateOrUpdateResponse{ + // Cluster: armkusto.Cluster{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.Kusto/Clusters/kustoClusterCMK"), + // Name: to.Ptr("kustoClusterCMK"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // EnableDiskEncryption: to.Ptr(false), + // EnableStreamingIngest: to.Ptr(true), + // EnablePurge: to.Ptr(true), + // EnableDoubleEncryption: to.Ptr(false), + // EnableAutoStop: to.Ptr(true), // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), // PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), - // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagEnabled), - // ZoneStatus: to.Ptr(armkusto.ZoneStatusNonZonal), + // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), + // KeyVaultProperties: &armkusto.KeyVaultProperties{ + // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + // KeyName: to.Ptr("myClusterCMKKey"), + // KeyVersion: to.Ptr("12345678-1234-1234-1234-123456789098"), + // UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + // }, + // EngineType: to.Ptr(armkusto.EngineTypeV3), // }, // SKU: &armkusto.AzureSKU{ // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), // Tier: to.Ptr(armkusto.AzureSKUTierStandard), + // Capacity: to.Ptr[int32](2), // }, - // SystemData: &armkusto.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.275Z"); 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.275Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), + // Identity: &armkusto.Identity{ + // Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": &armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // ClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), + // PrincipalID: to.Ptr("66666666-7777-8888-9999-000000000000"), + // }, + // }, // }, - // } + // Etag: to.Ptr("abcd1234"), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersCreateOrUpdate.json -func ExampleClustersClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-02-14/KustoClustersCreateOrUpdate.json +func ExampleClustersClient_BeginCreateOrUpdate_kustoClustersCreateOrUpdate() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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), }, + Location: to.Ptr("westus"), Properties: &armkusto.ClusterProperties{ AllowedIPRangeList: []*string{ - to.Ptr("0.0.0.0/0")}, + to.Ptr("0.0.0.0/0"), + }, EnableAutoStop: to.Ptr(true), EnableDoubleEncryption: to.Ptr(false), EnablePurge: to.Ptr(true), @@ -139,7 +334,8 @@ func ExampleClustersClient_BeginCreateOrUpdate() { { LanguageExtensionImageName: to.Ptr(armkusto.LanguageExtensionImageNameR), LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - }}, + }, + }, }, PublicIPType: to.Ptr(armkusto.PublicIPTypeDualStack), PublicNetworkAccess: to.Ptr(armkusto.PublicNetworkAccessEnabled), @@ -149,35 +345,35 @@ func ExampleClustersClient_BeginCreateOrUpdate() { Capacity: to.Ptr[int32](2), Tier: to.Ptr(armkusto.AzureSKUTierStandard), }, - }, &armkusto.ClustersClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) + }, 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) + log.Fatalf("failed to poll 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{ + // res = armkusto.ClustersClientCreateOrUpdateResponse{ + // Cluster: armkusto.Cluster{ + // Name: to.Ptr("kustoCluster"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Etag: to.Ptr("abcd"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster"), + // 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")}, + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ + // AllowedIPRangeList: []*string{ + // to.Ptr("0.0.0.0/0"), + // }, // EnableAutoStop: to.Ptr(true), // EnableDiskEncryption: to.Ptr(false), // EnableDoubleEncryption: to.Ptr(false), @@ -198,7 +394,8 @@ func ExampleClustersClient_BeginCreateOrUpdate() { // { // LanguageExtensionImageName: to.Ptr(armkusto.LanguageExtensionImageNameR), // LanguageExtensionName: to.Ptr(armkusto.LanguageExtensionNameR), - // }}, + // }, + // }, // }, // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), // PublicIPType: to.Ptr(armkusto.PublicIPTypeDualStack), @@ -210,331 +407,204 @@ func ExampleClustersClient_BeginCreateOrUpdate() { // Capacity: to.Ptr[int32](2), // Tier: to.Ptr(armkusto.AzureSKUTierStandard), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersUpdate.json -func ExampleClustersClient_BeginUpdate() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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("*")}) + poller, err := clientFactory.NewClustersClient().BeginDelete(ctx, "kustorptest", "kustoCluster2", 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) + log.Fatalf("failed to poll 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), - // }, + // res = armkusto.ClustersClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersDelete.json -func ExampleClustersClient_BeginDelete() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewClustersClient().BeginDelete(ctx, "kustorptest", "kustoCluster2", nil) + 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) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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.ClustersClientDetachFollowerDatabasesResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersStop.json -func ExampleClustersClient_BeginStop() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewClustersClient().BeginStop(ctx, "kustorptest", "kustoCluster2", nil) + poller, err := clientFactory.NewClustersClient().BeginDiagnoseVirtualNetwork(ctx, "kustorptest", "kustoCluster", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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.ClustersClientDiagnoseVirtualNetworkResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersStart.json -func ExampleClustersClient_BeginStart() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewClustersClient().BeginStart(ctx, "kustorptest", "kustoCluster2", nil) + res, err := clientFactory.NewClustersClient().Get(ctx, "kustorptest", "kustoCluster", 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterListFollowerDatabasesGet.json -func ExampleClustersClient_NewListFollowerDatabasesGetPager() { - 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().NewListFollowerDatabasesGetPager("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.FollowerDatabaseListResultGet = armkusto.FollowerDatabaseListResultGet{ - // Value: []*armkusto.FollowerDatabaseDefinitionGet{ - // { - // Properties: &armkusto.FollowerDatabaseProperties{ - // AttachedDatabaseConfigurationName: to.Ptr("attachedDbConfiguration"), - // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/kustoCluster"), - // DatabaseName: to.Ptr("*"), - // DatabaseShareOrigin: to.Ptr(armkusto.DatabaseShareOriginDataShare), - // }, - // }, - // { - // Properties: &armkusto.FollowerDatabaseProperties{ - // AttachedDatabaseConfigurationName: to.Ptr("attachedDbConfiguration2"), - // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/kustoCluster"), - // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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)")}, - // } + // res = armkusto.ClustersClientGetResponse{ + // Cluster: armkusto.Cluster{ + // Name: to.Ptr("kustoCluster"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Etag: to.Ptr("abcd123"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster"), + // 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{ + // }, + // }, + // Location: to.Ptr("westus"), + // 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), + // ZoneStatus: to.Ptr(armkusto.ZoneStatusNonZonal), + // }, + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersListByResourceGroup.json -func ExampleClustersClient_NewListByResourceGroupPager() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewClustersClient().NewListByResourceGroupPager("kustorptest", nil) + pager := clientFactory.NewClustersClient().NewListPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -545,22 +615,33 @@ func ExampleClustersClient_NewListByResourceGroupPager() { _ = 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")}, + // page = armkusto.ClustersClientListResponse{ + // ClusterListResult: armkusto.ClusterListResult{ + // Value: []*armkusto.Cluster{ + // { + // Name: to.Ptr("kustoCluster"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Etag: to.Ptr("abcd123"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster"), + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ + // AllowedFqdnList: []*string{ + // to.Ptr("my-stroage.blob.core.windows.net"), + // }, // AllowedIPRangeList: []*string{ // }, + // CalloutPolicies: []*armkusto.CalloutPolicy{ + // { + // CalloutID: to.Ptr("*_kusto"), + // CalloutType: to.Ptr(armkusto.CalloutTypeKusto), + // CalloutURIRegex: to.Ptr("*"), + // OutboundAccess: to.Ptr(armkusto.OutboundAccessAllow), + // }, + // }, + // EnableAutoStop: to.Ptr(true), // EnableDiskEncryption: to.Ptr(false), // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV2), + // EngineType: to.Ptr(armkusto.EngineTypeV3), // KeyVaultProperties: &armkusto.KeyVaultProperties{ // KeyName: to.Ptr("keyName"), // KeyVaultURI: to.Ptr("https://dummy.keyvault.com"), @@ -572,9 +653,29 @@ func ExampleClustersClient_NewListByResourceGroupPager() { // 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.ClusterNetworkAccessFlagDisabled), + // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagEnabled), // ZoneStatus: to.Ptr(armkusto.ZoneStatusNonZonal), // }, // SKU: &armkusto.AzureSKU{ @@ -586,41 +687,47 @@ func ExampleClustersClient_NewListByResourceGroupPager() { // { // Name: to.Ptr("KustoClusterRPTest3"), // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Etag: to.Ptr("abcd123"), // 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), + // to.Ptr("0.0.0.0/0"), // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersList.json -func ExampleClustersClient_NewListPager() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewClustersClient().NewListPager(nil) + pager := clientFactory.NewClustersClient().NewListByResourceGroupPager("kustorptest", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -631,30 +738,24 @@ func ExampleClustersClient_NewListPager() { _ = 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")}, + // page = armkusto.ClustersClientListByResourceGroupResponse{ + // ClusterListResult: armkusto.ClusterListResult{ + // Value: []*armkusto.Cluster{ + // { + // Name: to.Ptr("KustoClusterRPTest4"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Etag: to.Ptr("abcd123"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterRPTest4"), + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ + // AllowedFqdnList: []*string{ + // to.Ptr("my-stroage.blob.core.windows.net"), + // }, // AllowedIPRangeList: []*string{ // }, - // CalloutPolicies: []*armkusto.CalloutPolicy{ - // { - // CalloutID: to.Ptr("*_kusto"), - // CalloutType: to.Ptr(armkusto.CalloutTypeKusto), - // CalloutURIRegex: to.Ptr("*"), - // OutboundAccess: to.Ptr(armkusto.OutboundAccessAllow), - // }}, - // EnableAutoStop: to.Ptr(true), // EnableDiskEncryption: to.Ptr(false), // EnableStreamingIngest: to.Ptr(true), - // EngineType: to.Ptr(armkusto.EngineTypeV3), + // EngineType: to.Ptr(armkusto.EngineTypeV2), // KeyVaultProperties: &armkusto.KeyVaultProperties{ // KeyName: to.Ptr("keyName"), // KeyVaultURI: to.Ptr("https://dummy.keyvault.com"), @@ -666,28 +767,9 @@ func ExampleClustersClient_NewListPager() { // 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), + // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), // ZoneStatus: to.Ptr(armkusto.ZoneStatusNonZonal), // }, // SKU: &armkusto.AzureSKU{ @@ -699,44 +781,44 @@ func ExampleClustersClient_NewListPager() { // { // Name: to.Ptr("KustoClusterRPTest3"), // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Etag: to.Ptr("abcd123"), // 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), + // to.Ptr("0.0.0.0/0"), // }, - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Capacity: to.Ptr[int32](2), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), - // }, - // }}, - // } + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersListSkus.json -func ExampleClustersClient_NewListSKUsPager() { +// Generated from example definition: 2025-02-14/KustoClustersListCalloutPolicies.json +func ExampleClustersClient_NewListCalloutPoliciesPager() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewClustersClient().NewListSKUsPager(nil) + pager := clientFactory.NewClustersClient().NewListCalloutPoliciesPager("kustorptest", "kustoCluster", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -747,132 +829,33 @@ func ExampleClustersClient_NewListSKUsPager() { _ = 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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) + // page = armkusto.ClustersClientListCalloutPoliciesResponse{ + // CalloutPoliciesList: armkusto.CalloutPoliciesList{ + // Value: []*armkusto.CalloutPolicy{ + // { + // CalloutID: to.Ptr("*_kusto"), + // CalloutType: to.Ptr(armkusto.CalloutTypeKusto), + // CalloutURIRegex: to.Ptr("*"), + // OutboundAccess: to.Ptr(armkusto.OutboundAccessAllow), + // }, + // }, + // }, + // } } - // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersListResourceSkus.json -func ExampleClustersClient_NewListSKUsByResourcePager() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewClustersClient().NewListSKUsByResourcePager("kustorptest", "kustoCluster", nil) + pager := clientFactory.NewClustersClient().NewListFollowerDatabasesPager("kustorptest", "kustoCluster", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -883,76 +866,59 @@ func ExampleClustersClient_NewListSKUsByResourcePager() { _ = 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), + // page = armkusto.ClustersClientListFollowerDatabasesResponse{ + // 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), // }, - // ResourceType: to.Ptr("clusters"), - // SKU: &armkusto.AzureSKU{ - // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), - // Tier: to.Ptr(armkusto.AzureSKUTierStandard), + // { + // 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"), + // }, + // }, // }, // }, - // { - // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoOutboundNetworkDependenciesList.json -func ExampleClustersClient_NewListOutboundNetworkDependenciesEndpointsPager() { +// Generated from example definition: 2025-02-14/KustoClusterListFollowerDatabasesGet.json +func ExampleClustersClient_NewListFollowerDatabasesGetPager() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewClustersClient().NewListOutboundNetworkDependenciesEndpointsPager("kustorptest", "kustoCluster", nil) + pager := clientFactory.NewClustersClient().NewListFollowerDatabasesGetPager("kustorptest", "kustoCluster", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -963,243 +929,63 @@ func ExampleClustersClient_NewListOutboundNetworkDependenciesEndpointsPager() { _ = 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{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("graph.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("graph.microsoft.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("graph.microsoft-ppe.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // 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{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("gcs.prod.monitoring.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("production.diagnostics.monitoring.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("shoebox2.metrics.nsatc.net:443"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }}, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // page = armkusto.ClustersClientListFollowerDatabasesGetResponse{ + // FollowerDatabaseListResultGet: armkusto.FollowerDatabaseListResultGet{ + // Value: []*armkusto.FollowerDatabaseDefinitionGet{ + // { + // Properties: &armkusto.FollowerDatabaseProperties{ + // AttachedDatabaseConfigurationName: to.Ptr("attachedDbConfiguration"), + // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/kustoCluster"), + // DatabaseName: to.Ptr("*"), + // DatabaseShareOrigin: to.Ptr(armkusto.DatabaseShareOriginDataShare), + // }, // }, - // }, - // { - // 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{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](80), - // }}, - // }, - // { - // DomainName: to.Ptr("ocsp.digicert.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](80), - // }}, - // }, - // { - // DomainName: to.Ptr("crl3.digicert.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](80), - // }}, - // }, - // { - // DomainName: to.Ptr("crl.microsoft.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](80), - // }}, + // { + // Properties: &armkusto.FollowerDatabaseProperties{ + // AttachedDatabaseConfigurationName: to.Ptr("attachedDbConfiguration2"), + // ClusterResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/kustoCluster"), + // 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"), + // }, // }, - // { - // DomainName: to.Ptr("www.microsoft.com"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // 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{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("clusterinternalsa.queue.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // DomainName: to.Ptr("clusterinternalsa.table.core.windows.net"), - // EndpointDetails: []*armkusto.EndpointDetail{ - // { - // IPAddress: to.Ptr("1.2.3.4"), - // Port: to.Ptr[int32](443), - // }}, - // }}, - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // }, - // }}, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterAddCalloutPolicies.json -func ExampleClustersClient_BeginAddCalloutPolicies() { - 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().BeginAddCalloutPolicies(ctx, "kustorptest", "kustoCluster", armkusto.CalloutPoliciesList{ - Value: []*armkusto.CalloutPolicy{ - { - CalloutType: to.Ptr(armkusto.CalloutTypeKusto), - CalloutURIRegex: to.Ptr("*"), - OutboundAccess: to.Ptr(armkusto.OutboundAccessAllow), - }}, - }, 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterRemoveCalloutPolicy.json -func ExampleClustersClient_BeginRemoveCalloutPolicy() { - 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().BeginRemoveCalloutPolicy(ctx, "kustorptest", "kustoCluster", armkusto.CalloutPolicyToRemove{ - CalloutID: to.Ptr("*_kusto"), - }, 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClustersListCalloutPolicies.json -func ExampleClustersClient_NewListCalloutPoliciesPager() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewClustersClient().NewListCalloutPoliciesPager("kustorptest", "kustoCluster", nil) + pager := clientFactory.NewClustersClient().NewListLanguageExtensionsPager("kustorptest", "kustoCluster", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -1210,30 +996,33 @@ func ExampleClustersClient_NewListCalloutPoliciesPager() { _ = 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.CalloutPoliciesList = armkusto.CalloutPoliciesList{ - // Value: []*armkusto.CalloutPolicy{ - // { - // CalloutID: to.Ptr("*_kusto"), - // CalloutType: to.Ptr(armkusto.CalloutTypeKusto), - // CalloutURIRegex: to.Ptr("*"), - // OutboundAccess: to.Ptr(armkusto.OutboundAccessAllow), - // }}, + // page = armkusto.ClustersClientListLanguageExtensionsResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoClusterListLanguageExtensions.json -func ExampleClustersClient_NewListLanguageExtensionsPager() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewClustersClient().NewListLanguageExtensionsPager("kustorptest", "kustoCluster", nil) + pager := clientFactory.NewClustersClient().NewListOutboundNetworkDependenciesEndpointsPager("kustorptest", "kustoCluster", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -1244,72 +1033,913 @@ func ExampleClustersClient_NewListLanguageExtensionsPager() { _ = 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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), - }}, + // page = armkusto.ClustersClientListOutboundNetworkDependenciesEndpointsResponse{ + // 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{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("graph.windows.net"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("graph.microsoft.com"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("graph.microsoft-ppe.com"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // 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{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("gcs.prod.monitoring.core.windows.net"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("production.diagnostics.monitoring.core.windows.net"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("shoebox2.metrics.nsatc.net:443"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // 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{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](80), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("ocsp.digicert.com"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](80), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("crl3.digicert.com"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](80), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("crl.microsoft.com"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](80), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("www.microsoft.com"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // 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{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("clusterinternalsa.queue.core.windows.net"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // { + // DomainName: to.Ptr("clusterinternalsa.table.core.windows.net"), + // EndpointDetails: []*armkusto.EndpointDetail{ + // { + // IPAddress: to.Ptr("1.2.3.4"), + // Port: to.Ptr[int32](443), + // }, + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 = armkusto.ClustersClientListSKUsResponse{ + // 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: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 = armkusto.ClustersClientListSKUsByResourceResponse{ + // 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: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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.ClustersClientMigrateResponse{ + // } +} + +// Generated from example definition: 2025-02-14/KustoClusterRemoveCalloutPolicy.json +func ExampleClustersClient_BeginRemoveCalloutPolicy() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClustersClient().BeginRemoveCalloutPolicy(ctx, "kustorptest", "kustoCluster", armkusto.CalloutPolicyToRemove{ + CalloutID: to.Ptr("*_kusto"), + }, 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 poll 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.ClustersClientRemoveCalloutPolicyResponse{ + // } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to poll 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.ClustersClientRemoveLanguageExtensionsResponse{ + // } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to poll 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.ClustersClientStartResponse{ + // } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to poll 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.ClustersClientStopResponse{ + // } +} + +// Generated from example definition: 2025-02-14/KustoClusterUpdateCMKKeyRotation.json +func ExampleClustersClient_BeginUpdate_kustoClusterUpdateCmkKeyRotation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClustersClient().BeginUpdate(ctx, "kustoRgTest", "kustoClusterCMK", armkusto.ClusterUpdate{ + Location: to.Ptr("westus"), + Properties: &armkusto.ClusterProperties{ + KeyVaultProperties: &armkusto.KeyVaultProperties{ + KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + KeyName: to.Ptr("myClusterCMKKey"), + KeyVersion: to.Ptr("87654321-4321-4321-4321-210987654321"), + UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + }, + }, + }, &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 poll 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.ClustersClientUpdateResponse{ + // Cluster: armkusto.Cluster{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.Kusto/Clusters/kustoClusterCMK"), + // Name: to.Ptr("kustoClusterCMK"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // EnableDiskEncryption: to.Ptr(false), + // EnableStreamingIngest: to.Ptr(true), + // EnablePurge: to.Ptr(true), + // EnableAutoStop: to.Ptr(true), + // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), + // KeyVaultProperties: &armkusto.KeyVaultProperties{ + // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + // KeyName: to.Ptr("myClusterCMKKey"), + // KeyVersion: to.Ptr("87654321-4321-4321-4321-210987654321"), + // UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + // }, + // EngineType: to.Ptr(armkusto.EngineTypeV3), + // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), + // }, + // SKU: &armkusto.AzureSKU{ + // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), + // Tier: to.Ptr(armkusto.AzureSKUTierStandard), + // Capacity: to.Ptr[int32](2), + // }, + // Identity: &armkusto.Identity{ + // Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": &armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // ClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), + // PrincipalID: to.Ptr("66666666-7777-8888-9999-000000000000"), + // }, + // }, + // }, + // Etag: to.Ptr("abcd1234"), + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoClusterUpdateDisableCMK.json +func ExampleClustersClient_BeginUpdate_kustoClusterUpdateDisableCmk() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClustersClient().BeginUpdate(ctx, "kustoRgTest", "kustoClusterCMK", armkusto.ClusterUpdate{ + Location: to.Ptr("westus"), + Properties: &armkusto.ClusterProperties{ + KeyVaultProperties: &armkusto.KeyVaultProperties{}, + }, + }, &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 poll 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.ClustersClientUpdateResponse{ + // Cluster: armkusto.Cluster{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.Kusto/Clusters/kustoClusterCMK"), + // Name: to.Ptr("kustoClusterCMK"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // EnableDiskEncryption: to.Ptr(false), + // EnableStreamingIngest: to.Ptr(true), + // EnablePurge: to.Ptr(true), + // EnableAutoStop: to.Ptr(true), + // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), + // EngineType: to.Ptr(armkusto.EngineTypeV3), + // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), + // }, + // SKU: &armkusto.AzureSKU{ + // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), + // Tier: to.Ptr(armkusto.AzureSKUTierStandard), + // Capacity: to.Ptr[int32](2), + // }, + // Identity: &armkusto.Identity{ + // Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": &armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // ClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), + // PrincipalID: to.Ptr("66666666-7777-8888-9999-000000000000"), + // }, + // }, + // }, + // Etag: to.Ptr("abcd1234"), + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoClusterUpdateEnableCMK.json +func ExampleClustersClient_BeginUpdate_kustoClusterUpdateEnableCmk() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClustersClient().BeginUpdate(ctx, "kustoRgTest", "kustoCluster", armkusto.ClusterUpdate{ + Location: to.Ptr("westus"), + Identity: &armkusto.Identity{ + Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": {}, + }, + }, + Properties: &armkusto.ClusterProperties{ + KeyVaultProperties: &armkusto.KeyVaultProperties{ + KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + KeyName: to.Ptr("myClusterCMKKey"), + KeyVersion: to.Ptr("12345678-1234-1234-1234-123456789098"), + UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + }, + }, + }, &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 poll 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.ClustersClientUpdateResponse{ + // Cluster: armkusto.Cluster{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.Kusto/Clusters/kustoCluster"), + // Name: to.Ptr("kustoCluster"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // EnableDiskEncryption: to.Ptr(false), + // EnableStreamingIngest: to.Ptr(true), + // EnablePurge: to.Ptr(true), + // EnableAutoStop: to.Ptr(true), + // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), + // KeyVaultProperties: &armkusto.KeyVaultProperties{ + // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + // KeyName: to.Ptr("myClusterCMKKey"), + // KeyVersion: to.Ptr("12345678-1234-1234-1234-123456789098"), + // UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + // }, + // EngineType: to.Ptr(armkusto.EngineTypeV3), + // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), + // }, + // SKU: &armkusto.AzureSKU{ + // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), + // Tier: to.Ptr(armkusto.AzureSKUTierStandard), + // Capacity: to.Ptr[int32](2), + // }, + // Identity: &armkusto.Identity{ + // Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": &armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // ClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), + // PrincipalID: to.Ptr("66666666-7777-8888-9999-000000000000"), + // }, + // }, + // }, + // Etag: to.Ptr("abcd1234"), + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoClusterUpdateWithCMKFederatedIdentity.json +func ExampleClustersClient_BeginUpdate_kustoClusterUpdateWithCmkFederatedIdentity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClustersClient().BeginUpdate(ctx, "kustoRgTest", "kustoCluster2", armkusto.ClusterUpdate{ + Location: to.Ptr("westus"), + Identity: &armkusto.Identity{ + Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": {}, + }, + }, + Properties: &armkusto.ClusterProperties{ + EnableStreamingIngest: to.Ptr(true), + EnablePurge: to.Ptr(true), + EnableAutoStop: to.Ptr(true), + PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), + KeyVaultProperties: &armkusto.KeyVaultProperties{ + KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + KeyName: to.Ptr("myClusterCMKKey"), + KeyVersion: to.Ptr("12345678-1234-1234-1234-123456789098"), + UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + FederatedIdentityClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), + }, + EngineType: to.Ptr(armkusto.EngineTypeV3), + RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), + }, + }, &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 poll 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.ClustersClientUpdateResponse{ + // Cluster: armkusto.Cluster{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), + // Name: to.Ptr("kustoCluster2"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Location: to.Ptr("westus"), + // Properties: &armkusto.ClusterProperties{ + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // EnableDiskEncryption: to.Ptr(false), + // EnableStreamingIngest: to.Ptr(true), + // EnablePurge: to.Ptr(true), + // EnableAutoStop: to.Ptr(true), + // PublicIPType: to.Ptr(armkusto.PublicIPTypeIPv4), + // KeyVaultProperties: &armkusto.KeyVaultProperties{ + // KeyVaultURI: to.Ptr("https://myvault.vault.azure.net"), + // KeyName: to.Ptr("myClusterCMKKey"), + // KeyVersion: to.Ptr("12345678-1234-1234-1234-123456789098"), + // UserIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity"), + // FederatedIdentityClientID: to.Ptr("11111111-2222-3333-4444-555555555555"), + // }, + // EngineType: to.Ptr(armkusto.EngineTypeV3), + // RestrictOutboundNetworkAccess: to.Ptr(armkusto.ClusterNetworkAccessFlagDisabled), + // }, + // SKU: &armkusto.AzureSKU{ + // Name: to.Ptr(armkusto.AzureSKUNameStandardL16AsV3), + // Tier: to.Ptr(armkusto.AzureSKUTierStandard), + // Capacity: to.Ptr[int32](2), + // }, + // Identity: &armkusto.Identity{ + // Type: to.Ptr(armkusto.IdentityTypeUserAssigned), + // UserAssignedIdentities: map[string]*armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoRgTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoClusterIdentity": &armkusto.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties{ + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoClustersUpdate.json +func ExampleClustersClient_BeginUpdate_kustoClustersUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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 poll 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.ClustersClientUpdateResponse{ + // Cluster: armkusto.Cluster{ + // Name: to.Ptr("kustoCluster2"), + // Type: to.Ptr("Microsoft.Kusto/Clusters"), + // Etag: to.Ptr("abcd123"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster2"), + // 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{ + // }, + // }, + // Location: to.Ptr("westus"), + // 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), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/kusto/armkusto/constants.go b/sdk/resourcemanager/kusto/armkusto/constants.go index d23d0fa2ed19..b21edc7c0f7a 100644 --- a/sdk/resourcemanager/kusto/armkusto/constants.go +++ b/sdk/resourcemanager/kusto/armkusto/constants.go @@ -1,83 +1,145 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto const ( - moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" - moduleVersion = "v2.3.0" + version20250214 string = "2025-02-14" ) // AzureSKUName - SKU name. type AzureSKUName string const ( + // AzureSKUNameDevNoSLAStandardD11V2 - Dev(No SLA)_Standard_D11_v2 AzureSKUNameDevNoSLAStandardD11V2 AzureSKUName = "Dev(No SLA)_Standard_D11_v2" + // AzureSKUNameDevNoSLAStandardE2AV4 - Dev(No SLA)_Standard_E2a_v4 AzureSKUNameDevNoSLAStandardE2AV4 AzureSKUName = "Dev(No SLA)_Standard_E2a_v4" - AzureSKUNameStandardD11V2 AzureSKUName = "Standard_D11_v2" - AzureSKUNameStandardD12V2 AzureSKUName = "Standard_D12_v2" - AzureSKUNameStandardD13V2 AzureSKUName = "Standard_D13_v2" - AzureSKUNameStandardD14V2 AzureSKUName = "Standard_D14_v2" - AzureSKUNameStandardD16DV5 AzureSKUName = "Standard_D16d_v5" - AzureSKUNameStandardD32DV4 AzureSKUName = "Standard_D32d_v4" - AzureSKUNameStandardD32DV5 AzureSKUName = "Standard_D32d_v5" - AzureSKUNameStandardDS13V21TBPS AzureSKUName = "Standard_DS13_v2+1TB_PS" - AzureSKUNameStandardDS13V22TBPS AzureSKUName = "Standard_DS13_v2+2TB_PS" - AzureSKUNameStandardDS14V23TBPS AzureSKUName = "Standard_DS14_v2+3TB_PS" - AzureSKUNameStandardDS14V24TBPS AzureSKUName = "Standard_DS14_v2+4TB_PS" - AzureSKUNameStandardE16AV4 AzureSKUName = "Standard_E16a_v4" - AzureSKUNameStandardE16AdsV5 AzureSKUName = "Standard_E16ads_v5" - AzureSKUNameStandardE16AsV43TBPS AzureSKUName = "Standard_E16as_v4+3TB_PS" - AzureSKUNameStandardE16AsV44TBPS AzureSKUName = "Standard_E16as_v4+4TB_PS" - AzureSKUNameStandardE16AsV53TBPS AzureSKUName = "Standard_E16as_v5+3TB_PS" - AzureSKUNameStandardE16AsV54TBPS AzureSKUName = "Standard_E16as_v5+4TB_PS" - AzureSKUNameStandardE16DV4 AzureSKUName = "Standard_E16d_v4" - AzureSKUNameStandardE16DV5 AzureSKUName = "Standard_E16d_v5" - AzureSKUNameStandardE16SV43TBPS AzureSKUName = "Standard_E16s_v4+3TB_PS" - AzureSKUNameStandardE16SV44TBPS AzureSKUName = "Standard_E16s_v4+4TB_PS" - AzureSKUNameStandardE16SV53TBPS AzureSKUName = "Standard_E16s_v5+3TB_PS" - AzureSKUNameStandardE16SV54TBPS AzureSKUName = "Standard_E16s_v5+4TB_PS" - AzureSKUNameStandardE2AV4 AzureSKUName = "Standard_E2a_v4" - AzureSKUNameStandardE2AdsV5 AzureSKUName = "Standard_E2ads_v5" - AzureSKUNameStandardE2DV4 AzureSKUName = "Standard_E2d_v4" - AzureSKUNameStandardE2DV5 AzureSKUName = "Standard_E2d_v5" - AzureSKUNameStandardE4AV4 AzureSKUName = "Standard_E4a_v4" - AzureSKUNameStandardE4AdsV5 AzureSKUName = "Standard_E4ads_v5" - AzureSKUNameStandardE4DV4 AzureSKUName = "Standard_E4d_v4" - AzureSKUNameStandardE4DV5 AzureSKUName = "Standard_E4d_v5" - AzureSKUNameStandardE64IV3 AzureSKUName = "Standard_E64i_v3" - AzureSKUNameStandardE80IDsV4 AzureSKUName = "Standard_E80ids_v4" - AzureSKUNameStandardE8AV4 AzureSKUName = "Standard_E8a_v4" - AzureSKUNameStandardE8AdsV5 AzureSKUName = "Standard_E8ads_v5" - AzureSKUNameStandardE8AsV41TBPS AzureSKUName = "Standard_E8as_v4+1TB_PS" - AzureSKUNameStandardE8AsV42TBPS AzureSKUName = "Standard_E8as_v4+2TB_PS" - AzureSKUNameStandardE8AsV51TBPS AzureSKUName = "Standard_E8as_v5+1TB_PS" - AzureSKUNameStandardE8AsV52TBPS AzureSKUName = "Standard_E8as_v5+2TB_PS" - AzureSKUNameStandardE8DV4 AzureSKUName = "Standard_E8d_v4" - AzureSKUNameStandardE8DV5 AzureSKUName = "Standard_E8d_v5" - AzureSKUNameStandardE8SV41TBPS AzureSKUName = "Standard_E8s_v4+1TB_PS" - AzureSKUNameStandardE8SV42TBPS AzureSKUName = "Standard_E8s_v4+2TB_PS" - AzureSKUNameStandardE8SV51TBPS AzureSKUName = "Standard_E8s_v5+1TB_PS" - AzureSKUNameStandardE8SV52TBPS AzureSKUName = "Standard_E8s_v5+2TB_PS" - AzureSKUNameStandardEC16AdsV5 AzureSKUName = "Standard_EC16ads_v5" + // AzureSKUNameStandardD11V2 - Standard_D11_v2 + AzureSKUNameStandardD11V2 AzureSKUName = "Standard_D11_v2" + // AzureSKUNameStandardD12V2 - Standard_D12_v2 + AzureSKUNameStandardD12V2 AzureSKUName = "Standard_D12_v2" + // AzureSKUNameStandardD13V2 - Standard_D13_v2 + AzureSKUNameStandardD13V2 AzureSKUName = "Standard_D13_v2" + // AzureSKUNameStandardD14V2 - Standard_D14_v2 + AzureSKUNameStandardD14V2 AzureSKUName = "Standard_D14_v2" + // AzureSKUNameStandardD16DV5 - Standard_D16d_v5 + AzureSKUNameStandardD16DV5 AzureSKUName = "Standard_D16d_v5" + // AzureSKUNameStandardD32DV4 - Standard_D32d_v4 + AzureSKUNameStandardD32DV4 AzureSKUName = "Standard_D32d_v4" + // AzureSKUNameStandardD32DV5 - Standard_D32d_v5 + AzureSKUNameStandardD32DV5 AzureSKUName = "Standard_D32d_v5" + // AzureSKUNameStandardDS13V21TBPS - Standard_DS13_v2+1TB_PS + AzureSKUNameStandardDS13V21TBPS AzureSKUName = "Standard_DS13_v2+1TB_PS" + // AzureSKUNameStandardDS13V22TBPS - Standard_DS13_v2+2TB_PS + AzureSKUNameStandardDS13V22TBPS AzureSKUName = "Standard_DS13_v2+2TB_PS" + // AzureSKUNameStandardDS14V23TBPS - Standard_DS14_v2+3TB_PS + AzureSKUNameStandardDS14V23TBPS AzureSKUName = "Standard_DS14_v2+3TB_PS" + // AzureSKUNameStandardDS14V24TBPS - Standard_DS14_v2+4TB_PS + AzureSKUNameStandardDS14V24TBPS AzureSKUName = "Standard_DS14_v2+4TB_PS" + // AzureSKUNameStandardE16AV4 - Standard_E16a_v4 + AzureSKUNameStandardE16AV4 AzureSKUName = "Standard_E16a_v4" + // AzureSKUNameStandardE16AdsV5 - Standard_E16ads_v5 + AzureSKUNameStandardE16AdsV5 AzureSKUName = "Standard_E16ads_v5" + // AzureSKUNameStandardE16AsV43TBPS - Standard_E16as_v4+3TB_PS + AzureSKUNameStandardE16AsV43TBPS AzureSKUName = "Standard_E16as_v4+3TB_PS" + // AzureSKUNameStandardE16AsV44TBPS - Standard_E16as_v4+4TB_PS + AzureSKUNameStandardE16AsV44TBPS AzureSKUName = "Standard_E16as_v4+4TB_PS" + // AzureSKUNameStandardE16AsV53TBPS - Standard_E16as_v5+3TB_PS + AzureSKUNameStandardE16AsV53TBPS AzureSKUName = "Standard_E16as_v5+3TB_PS" + // AzureSKUNameStandardE16AsV54TBPS - Standard_E16as_v5+4TB_PS + AzureSKUNameStandardE16AsV54TBPS AzureSKUName = "Standard_E16as_v5+4TB_PS" + // AzureSKUNameStandardE16DV4 - Standard_E16d_v4 + AzureSKUNameStandardE16DV4 AzureSKUName = "Standard_E16d_v4" + // AzureSKUNameStandardE16DV5 - Standard_E16d_v5 + AzureSKUNameStandardE16DV5 AzureSKUName = "Standard_E16d_v5" + // AzureSKUNameStandardE16SV43TBPS - Standard_E16s_v4+3TB_PS + AzureSKUNameStandardE16SV43TBPS AzureSKUName = "Standard_E16s_v4+3TB_PS" + // AzureSKUNameStandardE16SV44TBPS - Standard_E16s_v4+4TB_PS + AzureSKUNameStandardE16SV44TBPS AzureSKUName = "Standard_E16s_v4+4TB_PS" + // AzureSKUNameStandardE16SV53TBPS - Standard_E16s_v5+3TB_PS + AzureSKUNameStandardE16SV53TBPS AzureSKUName = "Standard_E16s_v5+3TB_PS" + // AzureSKUNameStandardE16SV54TBPS - Standard_E16s_v5+4TB_PS + AzureSKUNameStandardE16SV54TBPS AzureSKUName = "Standard_E16s_v5+4TB_PS" + // AzureSKUNameStandardE2AV4 - Standard_E2a_v4 + AzureSKUNameStandardE2AV4 AzureSKUName = "Standard_E2a_v4" + // AzureSKUNameStandardE2AdsV5 - Standard_E2ads_v5 + AzureSKUNameStandardE2AdsV5 AzureSKUName = "Standard_E2ads_v5" + // AzureSKUNameStandardE2DV4 - Standard_E2d_v4 + AzureSKUNameStandardE2DV4 AzureSKUName = "Standard_E2d_v4" + // AzureSKUNameStandardE2DV5 - Standard_E2d_v5 + AzureSKUNameStandardE2DV5 AzureSKUName = "Standard_E2d_v5" + // AzureSKUNameStandardE4AV4 - Standard_E4a_v4 + AzureSKUNameStandardE4AV4 AzureSKUName = "Standard_E4a_v4" + // AzureSKUNameStandardE4AdsV5 - Standard_E4ads_v5 + AzureSKUNameStandardE4AdsV5 AzureSKUName = "Standard_E4ads_v5" + // AzureSKUNameStandardE4DV4 - Standard_E4d_v4 + AzureSKUNameStandardE4DV4 AzureSKUName = "Standard_E4d_v4" + // AzureSKUNameStandardE4DV5 - Standard_E4d_v5 + AzureSKUNameStandardE4DV5 AzureSKUName = "Standard_E4d_v5" + // AzureSKUNameStandardE64IV3 - Standard_E64i_v3 + AzureSKUNameStandardE64IV3 AzureSKUName = "Standard_E64i_v3" + // AzureSKUNameStandardE80IDsV4 - Standard_E80ids_v4 + AzureSKUNameStandardE80IDsV4 AzureSKUName = "Standard_E80ids_v4" + // AzureSKUNameStandardE8AV4 - Standard_E8a_v4 + AzureSKUNameStandardE8AV4 AzureSKUName = "Standard_E8a_v4" + // AzureSKUNameStandardE8AdsV5 - Standard_E8ads_v5 + AzureSKUNameStandardE8AdsV5 AzureSKUName = "Standard_E8ads_v5" + // AzureSKUNameStandardE8AsV41TBPS - Standard_E8as_v4+1TB_PS + AzureSKUNameStandardE8AsV41TBPS AzureSKUName = "Standard_E8as_v4+1TB_PS" + // AzureSKUNameStandardE8AsV42TBPS - Standard_E8as_v4+2TB_PS + AzureSKUNameStandardE8AsV42TBPS AzureSKUName = "Standard_E8as_v4+2TB_PS" + // AzureSKUNameStandardE8AsV51TBPS - Standard_E8as_v5+1TB_PS + AzureSKUNameStandardE8AsV51TBPS AzureSKUName = "Standard_E8as_v5+1TB_PS" + // AzureSKUNameStandardE8AsV52TBPS - Standard_E8as_v5+2TB_PS + AzureSKUNameStandardE8AsV52TBPS AzureSKUName = "Standard_E8as_v5+2TB_PS" + // AzureSKUNameStandardE8DV4 - Standard_E8d_v4 + AzureSKUNameStandardE8DV4 AzureSKUName = "Standard_E8d_v4" + // AzureSKUNameStandardE8DV5 - Standard_E8d_v5 + AzureSKUNameStandardE8DV5 AzureSKUName = "Standard_E8d_v5" + // AzureSKUNameStandardE8SV41TBPS - Standard_E8s_v4+1TB_PS + AzureSKUNameStandardE8SV41TBPS AzureSKUName = "Standard_E8s_v4+1TB_PS" + // AzureSKUNameStandardE8SV42TBPS - Standard_E8s_v4+2TB_PS + AzureSKUNameStandardE8SV42TBPS AzureSKUName = "Standard_E8s_v4+2TB_PS" + // AzureSKUNameStandardE8SV51TBPS - Standard_E8s_v5+1TB_PS + AzureSKUNameStandardE8SV51TBPS AzureSKUName = "Standard_E8s_v5+1TB_PS" + // AzureSKUNameStandardE8SV52TBPS - Standard_E8s_v5+2TB_PS + AzureSKUNameStandardE8SV52TBPS AzureSKUName = "Standard_E8s_v5+2TB_PS" + // AzureSKUNameStandardEC16AdsV5 - Standard_EC16ads_v5 + AzureSKUNameStandardEC16AdsV5 AzureSKUName = "Standard_EC16ads_v5" + // AzureSKUNameStandardEC16AsV53TBPS - Standard_EC16as_v5+3TB_PS AzureSKUNameStandardEC16AsV53TBPS AzureSKUName = "Standard_EC16as_v5+3TB_PS" + // AzureSKUNameStandardEC16AsV54TBPS - Standard_EC16as_v5+4TB_PS AzureSKUNameStandardEC16AsV54TBPS AzureSKUName = "Standard_EC16as_v5+4TB_PS" - AzureSKUNameStandardEC8AdsV5 AzureSKUName = "Standard_EC8ads_v5" - AzureSKUNameStandardEC8AsV51TBPS AzureSKUName = "Standard_EC8as_v5+1TB_PS" - AzureSKUNameStandardEC8AsV52TBPS AzureSKUName = "Standard_EC8as_v5+2TB_PS" - AzureSKUNameStandardL16AsV3 AzureSKUName = "Standard_L16as_v3" - AzureSKUNameStandardL16S AzureSKUName = "Standard_L16s" - AzureSKUNameStandardL16SV2 AzureSKUName = "Standard_L16s_v2" - AzureSKUNameStandardL16SV3 AzureSKUName = "Standard_L16s_v3" - AzureSKUNameStandardL32AsV3 AzureSKUName = "Standard_L32as_v3" - AzureSKUNameStandardL32SV3 AzureSKUName = "Standard_L32s_v3" - AzureSKUNameStandardL4S AzureSKUName = "Standard_L4s" - AzureSKUNameStandardL8AsV3 AzureSKUName = "Standard_L8as_v3" - AzureSKUNameStandardL8S AzureSKUName = "Standard_L8s" - AzureSKUNameStandardL8SV2 AzureSKUName = "Standard_L8s_v2" - AzureSKUNameStandardL8SV3 AzureSKUName = "Standard_L8s_v3" + // AzureSKUNameStandardEC8AdsV5 - Standard_EC8ads_v5 + AzureSKUNameStandardEC8AdsV5 AzureSKUName = "Standard_EC8ads_v5" + // AzureSKUNameStandardEC8AsV51TBPS - Standard_EC8as_v5+1TB_PS + AzureSKUNameStandardEC8AsV51TBPS AzureSKUName = "Standard_EC8as_v5+1TB_PS" + // AzureSKUNameStandardEC8AsV52TBPS - Standard_EC8as_v5+2TB_PS + AzureSKUNameStandardEC8AsV52TBPS AzureSKUName = "Standard_EC8as_v5+2TB_PS" + // AzureSKUNameStandardL16AsV3 - Standard_L16as_v3 + AzureSKUNameStandardL16AsV3 AzureSKUName = "Standard_L16as_v3" + // AzureSKUNameStandardL16S - Standard_L16s + AzureSKUNameStandardL16S AzureSKUName = "Standard_L16s" + // AzureSKUNameStandardL16SV2 - Standard_L16s_v2 + AzureSKUNameStandardL16SV2 AzureSKUName = "Standard_L16s_v2" + // AzureSKUNameStandardL16SV3 - Standard_L16s_v3 + AzureSKUNameStandardL16SV3 AzureSKUName = "Standard_L16s_v3" + // AzureSKUNameStandardL32AsV3 - Standard_L32as_v3 + AzureSKUNameStandardL32AsV3 AzureSKUName = "Standard_L32as_v3" + // AzureSKUNameStandardL32SV3 - Standard_L32s_v3 + AzureSKUNameStandardL32SV3 AzureSKUName = "Standard_L32s_v3" + // AzureSKUNameStandardL4S - Standard_L4s + AzureSKUNameStandardL4S AzureSKUName = "Standard_L4s" + // AzureSKUNameStandardL8AsV3 - Standard_L8as_v3 + AzureSKUNameStandardL8AsV3 AzureSKUName = "Standard_L8as_v3" + // AzureSKUNameStandardL8S - Standard_L8s + AzureSKUNameStandardL8S AzureSKUName = "Standard_L8s" + // AzureSKUNameStandardL8SV2 - Standard_L8s_v2 + AzureSKUNameStandardL8SV2 AzureSKUName = "Standard_L8s_v2" + // AzureSKUNameStandardL8SV3 - Standard_L8s_v3 + AzureSKUNameStandardL8SV3 AzureSKUName = "Standard_L8s_v3" ) // PossibleAzureSKUNameValues returns the possible values for the AzureSKUName const type. @@ -154,7 +216,9 @@ func PossibleAzureSKUNameValues() []AzureSKUName { type AzureSKUTier string const ( - AzureSKUTierBasic AzureSKUTier = "Basic" + // AzureSKUTierBasic - Basic + AzureSKUTierBasic AzureSKUTier = "Basic" + // AzureSKUTierStandard - Standard AzureSKUTierStandard AzureSKUTier = "Standard" ) @@ -170,9 +234,12 @@ func PossibleAzureSKUTierValues() []AzureSKUTier { type AzureScaleType string const ( + // AzureScaleTypeAutomatic - automatic AzureScaleTypeAutomatic AzureScaleType = "automatic" - AzureScaleTypeManual AzureScaleType = "manual" - AzureScaleTypeNone AzureScaleType = "none" + // AzureScaleTypeManual - manual + AzureScaleTypeManual AzureScaleType = "manual" + // AzureScaleTypeNone - none + AzureScaleTypeNone AzureScaleType = "none" ) // PossibleAzureScaleTypeValues returns the possible values for the AzureScaleType const type. @@ -188,7 +255,9 @@ func PossibleAzureScaleTypeValues() []AzureScaleType { type BlobStorageEventType string const ( + // BlobStorageEventTypeMicrosoftStorageBlobCreated - Microsoft.Storage.BlobCreated BlobStorageEventTypeMicrosoftStorageBlobCreated BlobStorageEventType = "Microsoft.Storage.BlobCreated" + // BlobStorageEventTypeMicrosoftStorageBlobRenamed - Microsoft.Storage.BlobRenamed BlobStorageEventTypeMicrosoftStorageBlobRenamed BlobStorageEventType = "Microsoft.Storage.BlobRenamed" ) @@ -203,8 +272,10 @@ func PossibleBlobStorageEventTypeValues() []BlobStorageEventType { type CallerRole string const ( + // CallerRoleAdmin - Admin CallerRoleAdmin CallerRole = "Admin" - CallerRoleNone CallerRole = "None" + // CallerRoleNone - None + CallerRoleNone CallerRole = "None" ) // PossibleCallerRoleValues returns the possible values for the CallerRole const type. @@ -219,17 +290,28 @@ func PossibleCallerRoleValues() []CallerRole { type CalloutType string const ( + // CalloutTypeAzureDigitalTwins - azure_digital_twins CalloutTypeAzureDigitalTwins CalloutType = "azure_digital_twins" - CalloutTypeAzureOpenai CalloutType = "azure_openai" - CalloutTypeCosmosdb CalloutType = "cosmosdb" - CalloutTypeExternalData CalloutType = "external_data" - CalloutTypeGenevametrics CalloutType = "genevametrics" - CalloutTypeKusto CalloutType = "kusto" - CalloutTypeMysql CalloutType = "mysql" - CalloutTypePostgresql CalloutType = "postgresql" - CalloutTypeSQL CalloutType = "sql" - CalloutTypeSandboxArtifacts CalloutType = "sandbox_artifacts" - CalloutTypeWebapi CalloutType = "webapi" + // CalloutTypeAzureOpenai - azure_openai + CalloutTypeAzureOpenai CalloutType = "azure_openai" + // CalloutTypeCosmosdb - cosmosdb + CalloutTypeCosmosdb CalloutType = "cosmosdb" + // CalloutTypeExternalData - external_data + CalloutTypeExternalData CalloutType = "external_data" + // CalloutTypeGenevametrics - genevametrics + CalloutTypeGenevametrics CalloutType = "genevametrics" + // CalloutTypeKusto - kusto + CalloutTypeKusto CalloutType = "kusto" + // CalloutTypeMysql - mysql + CalloutTypeMysql CalloutType = "mysql" + // CalloutTypePostgresql - postgresql + CalloutTypePostgresql CalloutType = "postgresql" + // CalloutTypeSQL - sql + CalloutTypeSQL CalloutType = "sql" + // CalloutTypeSandboxArtifacts - sandbox_artifacts + CalloutTypeSandboxArtifacts CalloutType = "sandbox_artifacts" + // CalloutTypeWebapi - webapi + CalloutTypeWebapi CalloutType = "webapi" ) // PossibleCalloutTypeValues returns the possible values for the CalloutType const type. @@ -254,8 +336,10 @@ func PossibleCalloutTypeValues() []CalloutType { type ClusterNetworkAccessFlag string const ( + // ClusterNetworkAccessFlagDisabled - Disabled ClusterNetworkAccessFlagDisabled ClusterNetworkAccessFlag = "Disabled" - ClusterNetworkAccessFlagEnabled ClusterNetworkAccessFlag = "Enabled" + // ClusterNetworkAccessFlagEnabled - Enabled + ClusterNetworkAccessFlagEnabled ClusterNetworkAccessFlag = "Enabled" ) // PossibleClusterNetworkAccessFlagValues returns the possible values for the ClusterNetworkAccessFlag const type. @@ -270,9 +354,12 @@ func PossibleClusterNetworkAccessFlagValues() []ClusterNetworkAccessFlag { type ClusterPrincipalRole string const ( - ClusterPrincipalRoleAllDatabasesAdmin ClusterPrincipalRole = "AllDatabasesAdmin" + // ClusterPrincipalRoleAllDatabasesAdmin - AllDatabasesAdmin + ClusterPrincipalRoleAllDatabasesAdmin ClusterPrincipalRole = "AllDatabasesAdmin" + // ClusterPrincipalRoleAllDatabasesMonitor - AllDatabasesMonitor ClusterPrincipalRoleAllDatabasesMonitor ClusterPrincipalRole = "AllDatabasesMonitor" - ClusterPrincipalRoleAllDatabasesViewer ClusterPrincipalRole = "AllDatabasesViewer" + // ClusterPrincipalRoleAllDatabasesViewer - AllDatabasesViewer + ClusterPrincipalRoleAllDatabasesViewer ClusterPrincipalRole = "AllDatabasesViewer" ) // PossibleClusterPrincipalRoleValues returns the possible values for the ClusterPrincipalRole const type. @@ -288,7 +375,9 @@ func PossibleClusterPrincipalRoleValues() []ClusterPrincipalRole { type Compression string const ( + // CompressionGZip - GZip CompressionGZip Compression = "GZip" + // CompressionNone - None CompressionNone Compression = "None" ) @@ -300,14 +389,18 @@ func PossibleCompressionValues() []Compression { } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -324,10 +417,18 @@ func PossibleCreatedByTypeValues() []CreatedByType { type DataConnectionKind string const ( - DataConnectionKindCosmosDb DataConnectionKind = "CosmosDb" + // DataConnectionKindCosmosDb - CosmosDb + DataConnectionKindCosmosDb DataConnectionKind = "CosmosDb" + // DataConnectionKindEventGrid - EventGrid DataConnectionKindEventGrid DataConnectionKind = "EventGrid" - DataConnectionKindEventHub DataConnectionKind = "EventHub" - DataConnectionKindIotHub DataConnectionKind = "IotHub" + // DataConnectionKindEventGridWithManagedIdentity - EventGridWithManagedIdentity + DataConnectionKindEventGridWithManagedIdentity DataConnectionKind = "EventGridWithManagedIdentity" + // DataConnectionKindEventHub - EventHub + DataConnectionKindEventHub DataConnectionKind = "EventHub" + // DataConnectionKindEventHubWithManagedIdentity - EventHubWithManagedIdentity + DataConnectionKindEventHubWithManagedIdentity DataConnectionKind = "EventHubWithManagedIdentity" + // DataConnectionKindIotHub - IotHub + DataConnectionKindIotHub DataConnectionKind = "IotHub" ) // PossibleDataConnectionKindValues returns the possible values for the DataConnectionKind const type. @@ -335,7 +436,9 @@ func PossibleDataConnectionKindValues() []DataConnectionKind { return []DataConnectionKind{ DataConnectionKindCosmosDb, DataConnectionKindEventGrid, + DataConnectionKindEventGridWithManagedIdentity, DataConnectionKindEventHub, + DataConnectionKindEventHubWithManagedIdentity, DataConnectionKindIotHub, } } @@ -344,12 +447,18 @@ func PossibleDataConnectionKindValues() []DataConnectionKind { type DatabasePrincipalRole string const ( - DatabasePrincipalRoleAdmin DatabasePrincipalRole = "Admin" - DatabasePrincipalRoleIngestor DatabasePrincipalRole = "Ingestor" - DatabasePrincipalRoleMonitor DatabasePrincipalRole = "Monitor" + // DatabasePrincipalRoleAdmin - Admin + DatabasePrincipalRoleAdmin DatabasePrincipalRole = "Admin" + // DatabasePrincipalRoleIngestor - Ingestor + DatabasePrincipalRoleIngestor DatabasePrincipalRole = "Ingestor" + // DatabasePrincipalRoleMonitor - Monitor + DatabasePrincipalRoleMonitor DatabasePrincipalRole = "Monitor" + // DatabasePrincipalRoleUnrestrictedViewer - UnrestrictedViewer DatabasePrincipalRoleUnrestrictedViewer DatabasePrincipalRole = "UnrestrictedViewer" - DatabasePrincipalRoleUser DatabasePrincipalRole = "User" - DatabasePrincipalRoleViewer DatabasePrincipalRole = "Viewer" + // DatabasePrincipalRoleUser - User + DatabasePrincipalRoleUser DatabasePrincipalRole = "User" + // DatabasePrincipalRoleViewer - Viewer + DatabasePrincipalRoleViewer DatabasePrincipalRole = "Viewer" ) // PossibleDatabasePrincipalRoleValues returns the possible values for the DatabasePrincipalRole const type. @@ -368,9 +477,12 @@ func PossibleDatabasePrincipalRoleValues() []DatabasePrincipalRole { type DatabasePrincipalType string const ( - DatabasePrincipalTypeApp DatabasePrincipalType = "App" + // DatabasePrincipalTypeApp - App + DatabasePrincipalTypeApp DatabasePrincipalType = "App" + // DatabasePrincipalTypeGroup - Group DatabasePrincipalTypeGroup DatabasePrincipalType = "Group" - DatabasePrincipalTypeUser DatabasePrincipalType = "User" + // DatabasePrincipalTypeUser - User + DatabasePrincipalTypeUser DatabasePrincipalType = "User" ) // PossibleDatabasePrincipalTypeValues returns the possible values for the DatabasePrincipalType const type. @@ -387,7 +499,9 @@ func PossibleDatabasePrincipalTypeValues() []DatabasePrincipalType { type DatabaseRouting string const ( - DatabaseRoutingMulti DatabaseRouting = "Multi" + // DatabaseRoutingMulti - Multi + DatabaseRoutingMulti DatabaseRouting = "Multi" + // DatabaseRoutingSingle - Single DatabaseRoutingSingle DatabaseRouting = "Single" ) @@ -403,9 +517,12 @@ func PossibleDatabaseRoutingValues() []DatabaseRouting { type DatabaseShareOrigin string const ( + // DatabaseShareOriginDataShare - DataShare DatabaseShareOriginDataShare DatabaseShareOrigin = "DataShare" - DatabaseShareOriginDirect DatabaseShareOrigin = "Direct" - DatabaseShareOriginOther DatabaseShareOrigin = "Other" + // DatabaseShareOriginDirect - Direct + DatabaseShareOriginDirect DatabaseShareOrigin = "Direct" + // DatabaseShareOriginOther - Other + DatabaseShareOriginOther DatabaseShareOrigin = "Other" ) // PossibleDatabaseShareOriginValues returns the possible values for the DatabaseShareOrigin const type. @@ -421,9 +538,12 @@ func PossibleDatabaseShareOriginValues() []DatabaseShareOrigin { type DefaultPrincipalsModificationKind string const ( - DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = "None" + // DefaultPrincipalsModificationKindNone - None + DefaultPrincipalsModificationKindNone DefaultPrincipalsModificationKind = "None" + // DefaultPrincipalsModificationKindReplace - Replace DefaultPrincipalsModificationKindReplace DefaultPrincipalsModificationKind = "Replace" - DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = "Union" + // DefaultPrincipalsModificationKindUnion - Union + DefaultPrincipalsModificationKindUnion DefaultPrincipalsModificationKind = "Union" ) // PossibleDefaultPrincipalsModificationKindValues returns the possible values for the DefaultPrincipalsModificationKind const type. @@ -439,7 +559,9 @@ func PossibleDefaultPrincipalsModificationKindValues() []DefaultPrincipalsModifi type EngineType string const ( + // EngineTypeV2 - V2 EngineTypeV2 EngineType = "V2" + // EngineTypeV3 - V3 EngineTypeV3 EngineType = "V3" ) @@ -455,21 +577,39 @@ func PossibleEngineTypeValues() []EngineType { type EventGridDataFormat string const ( + // EventGridDataFormatAPACHEAVRO - APACHEAVRO EventGridDataFormatAPACHEAVRO EventGridDataFormat = "APACHEAVRO" - EventGridDataFormatAVRO EventGridDataFormat = "AVRO" - EventGridDataFormatCSV EventGridDataFormat = "CSV" - EventGridDataFormatJSON EventGridDataFormat = "JSON" - EventGridDataFormatMULTIJSON EventGridDataFormat = "MULTIJSON" - EventGridDataFormatORC EventGridDataFormat = "ORC" - EventGridDataFormatPARQUET EventGridDataFormat = "PARQUET" - EventGridDataFormatPSV EventGridDataFormat = "PSV" - EventGridDataFormatRAW EventGridDataFormat = "RAW" - EventGridDataFormatSCSV EventGridDataFormat = "SCSV" + // EventGridDataFormatAVRO - AVRO + EventGridDataFormatAVRO EventGridDataFormat = "AVRO" + // EventGridDataFormatAZMONSTREAM - AZMONSTREAM + EventGridDataFormatAZMONSTREAM EventGridDataFormat = "AZMONSTREAM" + // EventGridDataFormatCSV - CSV + EventGridDataFormatCSV EventGridDataFormat = "CSV" + // EventGridDataFormatJSON - JSON + EventGridDataFormatJSON EventGridDataFormat = "JSON" + // EventGridDataFormatMULTIJSON - MULTIJSON + EventGridDataFormatMULTIJSON EventGridDataFormat = "MULTIJSON" + // EventGridDataFormatORC - ORC + EventGridDataFormatORC EventGridDataFormat = "ORC" + // EventGridDataFormatPARQUET - PARQUET + EventGridDataFormatPARQUET EventGridDataFormat = "PARQUET" + // EventGridDataFormatPSV - PSV + EventGridDataFormatPSV EventGridDataFormat = "PSV" + // EventGridDataFormatRAW - RAW + EventGridDataFormatRAW EventGridDataFormat = "RAW" + // EventGridDataFormatSCSV - SCSV + EventGridDataFormatSCSV EventGridDataFormat = "SCSV" + // EventGridDataFormatSINGLEJSON - SINGLEJSON EventGridDataFormatSINGLEJSON EventGridDataFormat = "SINGLEJSON" - EventGridDataFormatSOHSV EventGridDataFormat = "SOHSV" - EventGridDataFormatTSV EventGridDataFormat = "TSV" - EventGridDataFormatTSVE EventGridDataFormat = "TSVE" - EventGridDataFormatTXT EventGridDataFormat = "TXT" + // EventGridDataFormatSOHSV - SOHSV + EventGridDataFormatSOHSV EventGridDataFormat = "SOHSV" + // EventGridDataFormatTSV - TSV + EventGridDataFormatTSV EventGridDataFormat = "TSV" + // EventGridDataFormatTSVE - TSVE + EventGridDataFormatTSVE EventGridDataFormat = "TSVE" + // EventGridDataFormatTXT - TXT + EventGridDataFormatTXT EventGridDataFormat = "TXT" + // EventGridDataFormatW3CLOGFILE - W3CLOGFILE EventGridDataFormatW3CLOGFILE EventGridDataFormat = "W3CLOGFILE" ) @@ -478,6 +618,7 @@ func PossibleEventGridDataFormatValues() []EventGridDataFormat { return []EventGridDataFormat{ EventGridDataFormatAPACHEAVRO, EventGridDataFormatAVRO, + EventGridDataFormatAZMONSTREAM, EventGridDataFormatCSV, EventGridDataFormatJSON, EventGridDataFormatMULTIJSON, @@ -499,21 +640,39 @@ func PossibleEventGridDataFormatValues() []EventGridDataFormat { type EventHubDataFormat string const ( + // EventHubDataFormatAPACHEAVRO - APACHEAVRO EventHubDataFormatAPACHEAVRO EventHubDataFormat = "APACHEAVRO" - EventHubDataFormatAVRO EventHubDataFormat = "AVRO" - EventHubDataFormatCSV EventHubDataFormat = "CSV" - EventHubDataFormatJSON EventHubDataFormat = "JSON" - EventHubDataFormatMULTIJSON EventHubDataFormat = "MULTIJSON" - EventHubDataFormatORC EventHubDataFormat = "ORC" - EventHubDataFormatPARQUET EventHubDataFormat = "PARQUET" - EventHubDataFormatPSV EventHubDataFormat = "PSV" - EventHubDataFormatRAW EventHubDataFormat = "RAW" - EventHubDataFormatSCSV EventHubDataFormat = "SCSV" + // EventHubDataFormatAVRO - AVRO + EventHubDataFormatAVRO EventHubDataFormat = "AVRO" + // EventHubDataFormatAZMONSTREAM - AZMONSTREAM + EventHubDataFormatAZMONSTREAM EventHubDataFormat = "AZMONSTREAM" + // EventHubDataFormatCSV - CSV + EventHubDataFormatCSV EventHubDataFormat = "CSV" + // EventHubDataFormatJSON - JSON + EventHubDataFormatJSON EventHubDataFormat = "JSON" + // EventHubDataFormatMULTIJSON - MULTIJSON + EventHubDataFormatMULTIJSON EventHubDataFormat = "MULTIJSON" + // EventHubDataFormatORC - ORC + EventHubDataFormatORC EventHubDataFormat = "ORC" + // EventHubDataFormatPARQUET - PARQUET + EventHubDataFormatPARQUET EventHubDataFormat = "PARQUET" + // EventHubDataFormatPSV - PSV + EventHubDataFormatPSV EventHubDataFormat = "PSV" + // EventHubDataFormatRAW - RAW + EventHubDataFormatRAW EventHubDataFormat = "RAW" + // EventHubDataFormatSCSV - SCSV + EventHubDataFormatSCSV EventHubDataFormat = "SCSV" + // EventHubDataFormatSINGLEJSON - SINGLEJSON EventHubDataFormatSINGLEJSON EventHubDataFormat = "SINGLEJSON" - EventHubDataFormatSOHSV EventHubDataFormat = "SOHSV" - EventHubDataFormatTSV EventHubDataFormat = "TSV" - EventHubDataFormatTSVE EventHubDataFormat = "TSVE" - EventHubDataFormatTXT EventHubDataFormat = "TXT" + // EventHubDataFormatSOHSV - SOHSV + EventHubDataFormatSOHSV EventHubDataFormat = "SOHSV" + // EventHubDataFormatTSV - TSV + EventHubDataFormatTSV EventHubDataFormat = "TSV" + // EventHubDataFormatTSVE - TSVE + EventHubDataFormatTSVE EventHubDataFormat = "TSVE" + // EventHubDataFormatTXT - TXT + EventHubDataFormatTXT EventHubDataFormat = "TXT" + // EventHubDataFormatW3CLOGFILE - W3CLOGFILE EventHubDataFormatW3CLOGFILE EventHubDataFormat = "W3CLOGFILE" ) @@ -522,6 +681,7 @@ func PossibleEventHubDataFormatValues() []EventHubDataFormat { return []EventHubDataFormat{ EventHubDataFormatAPACHEAVRO, EventHubDataFormatAVRO, + EventHubDataFormatAZMONSTREAM, EventHubDataFormatCSV, EventHubDataFormatJSON, EventHubDataFormatMULTIJSON, @@ -540,15 +700,18 @@ func PossibleEventHubDataFormatValues() []EventHubDataFormat { } // IdentityType - The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created -// identity and a set of user-assigned identities. The type 'None' will remove all -// identities. +// identity and a set of user-assigned identities. The type 'None' will remove all identities. type IdentityType string const ( - IdentityTypeNone IdentityType = "None" - IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + // IdentityTypeNone - None + IdentityTypeNone IdentityType = "None" + // IdentityTypeSystemAssigned - SystemAssigned + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + // IdentityTypeSystemAssignedUserAssigned - SystemAssigned, UserAssigned IdentityTypeSystemAssignedUserAssigned IdentityType = "SystemAssigned, UserAssigned" - IdentityTypeUserAssigned IdentityType = "UserAssigned" + // IdentityTypeUserAssigned - UserAssigned + IdentityTypeUserAssigned IdentityType = "UserAssigned" ) // PossibleIdentityTypeValues returns the possible values for the IdentityType const type. @@ -565,21 +728,39 @@ func PossibleIdentityTypeValues() []IdentityType { type IotHubDataFormat string const ( + // IotHubDataFormatAPACHEAVRO - APACHEAVRO IotHubDataFormatAPACHEAVRO IotHubDataFormat = "APACHEAVRO" - IotHubDataFormatAVRO IotHubDataFormat = "AVRO" - IotHubDataFormatCSV IotHubDataFormat = "CSV" - IotHubDataFormatJSON IotHubDataFormat = "JSON" - IotHubDataFormatMULTIJSON IotHubDataFormat = "MULTIJSON" - IotHubDataFormatORC IotHubDataFormat = "ORC" - IotHubDataFormatPARQUET IotHubDataFormat = "PARQUET" - IotHubDataFormatPSV IotHubDataFormat = "PSV" - IotHubDataFormatRAW IotHubDataFormat = "RAW" - IotHubDataFormatSCSV IotHubDataFormat = "SCSV" + // IotHubDataFormatAVRO - AVRO + IotHubDataFormatAVRO IotHubDataFormat = "AVRO" + // IotHubDataFormatAZMONSTREAM - AZMONSTREAM + IotHubDataFormatAZMONSTREAM IotHubDataFormat = "AZMONSTREAM" + // IotHubDataFormatCSV - CSV + IotHubDataFormatCSV IotHubDataFormat = "CSV" + // IotHubDataFormatJSON - JSON + IotHubDataFormatJSON IotHubDataFormat = "JSON" + // IotHubDataFormatMULTIJSON - MULTIJSON + IotHubDataFormatMULTIJSON IotHubDataFormat = "MULTIJSON" + // IotHubDataFormatORC - ORC + IotHubDataFormatORC IotHubDataFormat = "ORC" + // IotHubDataFormatPARQUET - PARQUET + IotHubDataFormatPARQUET IotHubDataFormat = "PARQUET" + // IotHubDataFormatPSV - PSV + IotHubDataFormatPSV IotHubDataFormat = "PSV" + // IotHubDataFormatRAW - RAW + IotHubDataFormatRAW IotHubDataFormat = "RAW" + // IotHubDataFormatSCSV - SCSV + IotHubDataFormatSCSV IotHubDataFormat = "SCSV" + // IotHubDataFormatSINGLEJSON - SINGLEJSON IotHubDataFormatSINGLEJSON IotHubDataFormat = "SINGLEJSON" - IotHubDataFormatSOHSV IotHubDataFormat = "SOHSV" - IotHubDataFormatTSV IotHubDataFormat = "TSV" - IotHubDataFormatTSVE IotHubDataFormat = "TSVE" - IotHubDataFormatTXT IotHubDataFormat = "TXT" + // IotHubDataFormatSOHSV - SOHSV + IotHubDataFormatSOHSV IotHubDataFormat = "SOHSV" + // IotHubDataFormatTSV - TSV + IotHubDataFormatTSV IotHubDataFormat = "TSV" + // IotHubDataFormatTSVE - TSVE + IotHubDataFormatTSVE IotHubDataFormat = "TSVE" + // IotHubDataFormatTXT - TXT + IotHubDataFormatTXT IotHubDataFormat = "TXT" + // IotHubDataFormatW3CLOGFILE - W3CLOGFILE IotHubDataFormatW3CLOGFILE IotHubDataFormat = "W3CLOGFILE" ) @@ -588,6 +769,7 @@ func PossibleIotHubDataFormatValues() []IotHubDataFormat { return []IotHubDataFormat{ IotHubDataFormatAPACHEAVRO, IotHubDataFormatAVRO, + IotHubDataFormatAZMONSTREAM, IotHubDataFormatCSV, IotHubDataFormatJSON, IotHubDataFormatMULTIJSON, @@ -609,8 +791,10 @@ func PossibleIotHubDataFormatValues() []IotHubDataFormat { type Kind string const ( + // KindReadOnlyFollowing - ReadOnlyFollowing KindReadOnlyFollowing Kind = "ReadOnlyFollowing" - KindReadWrite Kind = "ReadWrite" + // KindReadWrite - ReadWrite + KindReadWrite Kind = "ReadWrite" ) // PossibleKindValues returns the possible values for the Kind const type. @@ -625,6 +809,7 @@ func PossibleKindValues() []Kind { type Language string const ( + // LanguagePython - Python LanguagePython Language = "Python" ) @@ -639,13 +824,20 @@ func PossibleLanguageValues() []Language { type LanguageExtensionImageName string const ( - LanguageExtensionImageNamePython3108 LanguageExtensionImageName = "Python3_10_8" - LanguageExtensionImageNamePython3108DL LanguageExtensionImageName = "Python3_10_8_DL" - LanguageExtensionImageNamePython3117 LanguageExtensionImageName = "Python3_11_7" - LanguageExtensionImageNamePython3117DL LanguageExtensionImageName = "Python3_11_7_DL" - LanguageExtensionImageNamePython365 LanguageExtensionImageName = "Python3_6_5" + // LanguageExtensionImageNamePython3108 - Python3_10_8 + LanguageExtensionImageNamePython3108 LanguageExtensionImageName = "Python3_10_8" + // LanguageExtensionImageNamePython3108DL - Python3_10_8_DL + LanguageExtensionImageNamePython3108DL LanguageExtensionImageName = "Python3_10_8_DL" + // LanguageExtensionImageNamePython3117 - Python3_11_7 + LanguageExtensionImageNamePython3117 LanguageExtensionImageName = "Python3_11_7" + // LanguageExtensionImageNamePython3117DL - Python3_11_7_DL + LanguageExtensionImageNamePython3117DL LanguageExtensionImageName = "Python3_11_7_DL" + // LanguageExtensionImageNamePython365 - Python3_6_5 + LanguageExtensionImageNamePython365 LanguageExtensionImageName = "Python3_6_5" + // LanguageExtensionImageNamePythonCustomImage - PythonCustomImage LanguageExtensionImageNamePythonCustomImage LanguageExtensionImageName = "PythonCustomImage" - LanguageExtensionImageNameR LanguageExtensionImageName = "R" + // LanguageExtensionImageNameR - R + LanguageExtensionImageNameR LanguageExtensionImageName = "R" ) // PossibleLanguageExtensionImageNameValues returns the possible values for the LanguageExtensionImageName const type. @@ -665,8 +857,10 @@ func PossibleLanguageExtensionImageNameValues() []LanguageExtensionImageName { type LanguageExtensionName string const ( + // LanguageExtensionNamePYTHON - PYTHON LanguageExtensionNamePYTHON LanguageExtensionName = "PYTHON" - LanguageExtensionNameR LanguageExtensionName = "R" + // LanguageExtensionNameR - R + LanguageExtensionNameR LanguageExtensionName = "R" ) // PossibleLanguageExtensionNameValues returns the possible values for the LanguageExtensionName const type. @@ -681,8 +875,10 @@ func PossibleLanguageExtensionNameValues() []LanguageExtensionName { type MigrationClusterRole string const ( + // MigrationClusterRoleDestination - Destination MigrationClusterRoleDestination MigrationClusterRole = "Destination" - MigrationClusterRoleSource MigrationClusterRole = "Source" + // MigrationClusterRoleSource - Source + MigrationClusterRoleSource MigrationClusterRole = "Source" ) // PossibleMigrationClusterRoleValues returns the possible values for the MigrationClusterRole const type. @@ -697,8 +893,10 @@ func PossibleMigrationClusterRoleValues() []MigrationClusterRole { type OutboundAccess string const ( + // OutboundAccessAllow - Allow OutboundAccessAllow OutboundAccess = "Allow" - OutboundAccessDeny OutboundAccess = "Deny" + // OutboundAccessDeny - Deny + OutboundAccessDeny OutboundAccess = "Deny" ) // PossibleOutboundAccessValues returns the possible values for the OutboundAccess const type. @@ -713,7 +911,9 @@ func PossibleOutboundAccessValues() []OutboundAccess { type PrincipalPermissionsAction string const ( + // PrincipalPermissionsActionRemovePermissionOnScriptCompletion - RemovePermissionOnScriptCompletion PrincipalPermissionsActionRemovePermissionOnScriptCompletion PrincipalPermissionsAction = "RemovePermissionOnScriptCompletion" + // PrincipalPermissionsActionRetainPermissionOnScriptCompletion - RetainPermissionOnScriptCompletion PrincipalPermissionsActionRetainPermissionOnScriptCompletion PrincipalPermissionsAction = "RetainPermissionOnScriptCompletion" ) @@ -729,9 +929,12 @@ func PossiblePrincipalPermissionsActionValues() []PrincipalPermissionsAction { type PrincipalType string const ( - PrincipalTypeApp PrincipalType = "App" + // PrincipalTypeApp - App + PrincipalTypeApp PrincipalType = "App" + // PrincipalTypeGroup - Group PrincipalTypeGroup PrincipalType = "Group" - PrincipalTypeUser PrincipalType = "User" + // PrincipalTypeUser - User + PrincipalTypeUser PrincipalType = "User" ) // PossiblePrincipalTypeValues returns the possible values for the PrincipalType const type. @@ -747,9 +950,12 @@ func PossiblePrincipalTypeValues() []PrincipalType { type PrincipalsModificationKind string const ( - PrincipalsModificationKindNone PrincipalsModificationKind = "None" + // PrincipalsModificationKindNone - None + PrincipalsModificationKindNone PrincipalsModificationKind = "None" + // PrincipalsModificationKindReplace - Replace PrincipalsModificationKindReplace PrincipalsModificationKind = "Replace" - PrincipalsModificationKindUnion PrincipalsModificationKind = "Union" + // PrincipalsModificationKindUnion - Union + PrincipalsModificationKindUnion PrincipalsModificationKind = "Union" ) // PossiblePrincipalsModificationKindValues returns the possible values for the PrincipalsModificationKind const type. @@ -765,12 +971,19 @@ func PossiblePrincipalsModificationKindValues() []PrincipalsModificationKind { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateCanceled - Canceled + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Creating + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting - Deleting + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Failed + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoving - Moving + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateRunning - Running + ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateSucceeded - Succeeded ProvisioningStateSucceeded ProvisioningState = "Succeeded" ) @@ -791,8 +1004,10 @@ func PossibleProvisioningStateValues() []ProvisioningState { type PublicIPType string const ( + // PublicIPTypeDualStack - DualStack PublicIPTypeDualStack PublicIPType = "DualStack" - PublicIPTypeIPv4 PublicIPType = "IPv4" + // PublicIPTypeIPv4 - IPv4 + PublicIPTypeIPv4 PublicIPType = "IPv4" ) // PossiblePublicIPTypeValues returns the possible values for the PublicIPType const type. @@ -808,8 +1023,12 @@ func PossiblePublicIPTypeValues() []PublicIPType { type PublicNetworkAccess string const ( + // PublicNetworkAccessDisabled - Disabled PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + // PublicNetworkAccessEnabled - Enabled + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" + // PublicNetworkAccessSecuredByPerimeter - SecuredByPerimeter + PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" ) // PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. @@ -817,6 +1036,7 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { return []PublicNetworkAccess{ PublicNetworkAccessDisabled, PublicNetworkAccessEnabled, + PublicNetworkAccessSecuredByPerimeter, } } @@ -824,8 +1044,10 @@ func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { type Reason string const ( + // ReasonAlreadyExists - AlreadyExists ReasonAlreadyExists Reason = "AlreadyExists" - ReasonInvalid Reason = "Invalid" + // ReasonInvalid - Invalid + ReasonInvalid Reason = "Invalid" ) // PossibleReasonValues returns the possible values for the Reason const type. @@ -840,7 +1062,9 @@ func PossibleReasonValues() []Reason { type ScriptLevel string const ( - ScriptLevelCluster ScriptLevel = "Cluster" + // ScriptLevelCluster - Cluster + ScriptLevelCluster ScriptLevel = "Cluster" + // ScriptLevelDatabase - Database ScriptLevelDatabase ScriptLevel = "Database" ) @@ -856,16 +1080,26 @@ func PossibleScriptLevelValues() []ScriptLevel { type State string const ( - StateCreating State = "Creating" - StateDeleted State = "Deleted" - StateDeleting State = "Deleting" - StateMigrated State = "Migrated" - StateRunning State = "Running" - StateStarting State = "Starting" - StateStopped State = "Stopped" - StateStopping State = "Stopping" + // StateCreating - Creating + StateCreating State = "Creating" + // StateDeleted - Deleted + StateDeleted State = "Deleted" + // StateDeleting - Deleting + StateDeleting State = "Deleting" + // StateMigrated - Migrated + StateMigrated State = "Migrated" + // StateRunning - Running + StateRunning State = "Running" + // StateStarting - Starting + StateStarting State = "Starting" + // StateStopped - Stopped + StateStopped State = "Stopped" + // StateStopping - Stopping + StateStopping State = "Stopping" + // StateUnavailable - Unavailable StateUnavailable State = "Unavailable" - StateUpdating State = "Updating" + // StateUpdating - Updating + StateUpdating State = "Updating" ) // PossibleStateValues returns the possible values for the State const type. @@ -888,9 +1122,13 @@ func PossibleStateValues() []State { type Status string const ( - StatusCanceled Status = "Canceled" - StatusFailed Status = "Failed" - StatusRunning Status = "Running" + // StatusCanceled - Canceled + StatusCanceled Status = "Canceled" + // StatusFailed - Failed + StatusFailed Status = "Failed" + // StatusRunning - Running + StatusRunning Status = "Running" + // StatusSucceeded - Succeeded StatusSucceeded Status = "Succeeded" ) @@ -908,8 +1146,10 @@ func PossibleStatusValues() []Status { type Type string const ( + // TypeMicrosoftKustoClustersAttachedDatabaseConfigurations - Microsoft.Kusto/clusters/attachedDatabaseConfigurations TypeMicrosoftKustoClustersAttachedDatabaseConfigurations Type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" - TypeMicrosoftKustoClustersDatabases Type = "Microsoft.Kusto/clusters/databases" + // TypeMicrosoftKustoClustersDatabases - Microsoft.Kusto/clusters/databases + TypeMicrosoftKustoClustersDatabases Type = "Microsoft.Kusto/clusters/databases" ) // PossibleTypeValues returns the possible values for the Type const type. @@ -925,8 +1165,10 @@ func PossibleTypeValues() []Type { type VnetState string const ( + // VnetStateDisabled - Disabled VnetStateDisabled VnetState = "Disabled" - VnetStateEnabled VnetState = "Enabled" + // VnetStateEnabled - Enabled + VnetStateEnabled VnetState = "Enabled" ) // PossibleVnetStateValues returns the possible values for the VnetState const type. @@ -941,8 +1183,11 @@ func PossibleVnetStateValues() []VnetState { type ZoneStatus string const ( - ZoneStatusNonZonal ZoneStatus = "NonZonal" - ZoneStatusZonal ZoneStatus = "Zonal" + // ZoneStatusNonZonal - NonZonal + ZoneStatusNonZonal ZoneStatus = "NonZonal" + // ZoneStatusZonal - Zonal + ZoneStatusZonal ZoneStatus = "Zonal" + // ZoneStatusZonalInconsistency - ZonalInconsistency ZoneStatusZonalInconsistency ZoneStatus = "ZonalInconsistency" ) diff --git a/sdk/resourcemanager/kusto/armkusto/database_client.go b/sdk/resourcemanager/kusto/armkusto/database_client.go index 3e64eb67eb72..6abe9f977e9a 100644 --- a/sdk/resourcemanager/kusto/armkusto/database_client.go +++ b/sdk/resourcemanager/kusto/armkusto/database_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // DatabaseClient contains the methods for the Database group. // Don't use this type directly, use NewDatabaseClient() instead. +// +// Generated from API version 2025-02-14 type DatabaseClient struct { internal *arm.Client subscriptionID string } // NewDatabaseClient creates a new instance of DatabaseClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDatabaseClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabaseClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewDatabaseClient(subscriptionID string, credential azcore.TokenCredential, // InviteFollower - Generates an invitation token that allows attaching a follower database to this database. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -72,7 +71,7 @@ func (client *DatabaseClient) InviteFollower(ctx context.Context, resourceGroupN } // inviteFollowerCreateRequest creates the InviteFollower request. -func (client *DatabaseClient) inviteFollowerCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseInviteFollowerRequest, options *DatabaseClientInviteFollowerOptions) (*policy.Request, error) { +func (client *DatabaseClient) inviteFollowerCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseInviteFollowerRequest, _ *DatabaseClientInviteFollowerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/inviteFollower" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -95,9 +94,10 @@ func (client *DatabaseClient) inviteFollowerCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/kusto/armkusto/database_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/database_client_example_test.go index 6ee4d9cf6ee3..4e689e444068 100644 --- a/sdk/resourcemanager/kusto/armkusto/database_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/database_client_example_test.go @@ -1,28 +1,25 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabaseInviteFollower.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -31,19 +28,26 @@ func ExampleDatabaseClient_InviteFollower() { TableLevelSharingProperties: &armkusto.TableLevelSharingProperties{ ExternalTablesToExclude: []*string{}, ExternalTablesToInclude: []*string{ - to.Ptr("ExternalTable*")}, + to.Ptr("ExternalTable*"), + }, FunctionsToExclude: []*string{ - to.Ptr("functionsToExclude2")}, + to.Ptr("functionsToExclude2"), + }, FunctionsToInclude: []*string{ - to.Ptr("functionsToInclude1")}, + to.Ptr("functionsToInclude1"), + }, MaterializedViewsToExclude: []*string{ - to.Ptr("MaterializedViewTable2")}, + to.Ptr("MaterializedViewTable2"), + }, MaterializedViewsToInclude: []*string{ - to.Ptr("MaterializedViewTable1")}, + to.Ptr("MaterializedViewTable1"), + }, TablesToExclude: []*string{ - to.Ptr("Table2")}, + to.Ptr("Table2"), + }, TablesToInclude: []*string{ - to.Ptr("Table1")}, + to.Ptr("Table1"), + }, }, }, nil) if err != nil { @@ -52,7 +56,9 @@ func ExampleDatabaseClient_InviteFollower() { // 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"), + // res = armkusto.DatabaseClientInviteFollowerResponse{ + // 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 4c46d70246b9..ef421782edb9 100644 --- a/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go +++ b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // DatabasePrincipalAssignmentsClient contains the methods for the DatabasePrincipalAssignments group. // Don't use this type directly, use NewDatabasePrincipalAssignmentsClient() instead. +// +// Generated from API version 2025-02-14 type DatabasePrincipalAssignmentsClient struct { internal *arm.Client subscriptionID string } // NewDatabasePrincipalAssignmentsClient creates a new instance of DatabasePrincipalAssignmentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDatabasePrincipalAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabasePrincipalAssignmentsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewDatabasePrincipalAssignmentsClient(subscriptionID string, credential azc // CheckNameAvailability - Checks that the database principal assignment is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -73,8 +72,12 @@ func (client *DatabasePrincipalAssignmentsClient) CheckNameAvailability(ctx cont } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *DatabasePrincipalAssignmentsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName DatabasePrincipalAssignmentCheckNameRequest, options *DatabasePrincipalAssignmentsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *DatabasePrincipalAssignmentsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName DatabasePrincipalAssignmentCheckNameRequest, _ *DatabasePrincipalAssignmentsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -87,18 +90,15 @@ func (client *DatabasePrincipalAssignmentsClient) checkNameAvailabilityCreateReq return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, principalAssignmentName); err != nil { return nil, err } @@ -116,8 +116,6 @@ func (client *DatabasePrincipalAssignmentsClient) checkNameAvailabilityHandleRes // BeginCreateOrUpdate - Creates a Kusto cluster database principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -144,8 +142,6 @@ func (client *DatabasePrincipalAssignmentsClient) BeginCreateOrUpdate(ctx contex // CreateOrUpdate - Creates a Kusto cluster database principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 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 const operationName = "DatabasePrincipalAssignmentsClient.BeginCreateOrUpdate" @@ -168,7 +164,7 @@ func (client *DatabasePrincipalAssignmentsClient) createOrUpdate(ctx context.Con } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DatabasePrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, parameters DatabasePrincipalAssignment, options *DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DatabasePrincipalAssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, parameters DatabasePrincipalAssignment, _ *DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,9 +191,10 @@ func (client *DatabasePrincipalAssignmentsClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -206,8 +203,6 @@ func (client *DatabasePrincipalAssignmentsClient) createOrUpdateCreateRequest(ct // BeginDelete - Deletes a Kusto principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -233,8 +228,6 @@ func (client *DatabasePrincipalAssignmentsClient) BeginDelete(ctx context.Contex // Delete - Deletes a Kusto principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *DatabasePrincipalAssignmentsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, options *DatabasePrincipalAssignmentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DatabasePrincipalAssignmentsClient.BeginDelete" @@ -257,7 +250,7 @@ func (client *DatabasePrincipalAssignmentsClient) deleteOperation(ctx context.Co } // deleteCreateRequest creates the Delete request. -func (client *DatabasePrincipalAssignmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, options *DatabasePrincipalAssignmentsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DatabasePrincipalAssignmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, _ *DatabasePrincipalAssignmentsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -284,16 +277,13 @@ func (client *DatabasePrincipalAssignmentsClient) deleteCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets a Kusto cluster database principalAssignment. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -323,7 +313,7 @@ func (client *DatabasePrincipalAssignmentsClient) Get(ctx context.Context, resou } // getCreateRequest creates the Get request. -func (client *DatabasePrincipalAssignmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, options *DatabasePrincipalAssignmentsClientGetOptions) (*policy.Request, error) { +func (client *DatabasePrincipalAssignmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, principalAssignmentName string, _ *DatabasePrincipalAssignmentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -350,8 +340,8 @@ func (client *DatabasePrincipalAssignmentsClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -366,8 +356,6 @@ func (client *DatabasePrincipalAssignmentsClient) getHandleResponse(resp *http.R } // NewListPager - Lists all Kusto cluster database principalAssignments. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -376,21 +364,20 @@ func (client *DatabasePrincipalAssignmentsClient) getHandleResponse(resp *http.R func (client *DatabasePrincipalAssignmentsClient) NewListPager(resourceGroupName string, clusterName string, databaseName string, options *DatabasePrincipalAssignmentsClientListOptions) *runtime.Pager[DatabasePrincipalAssignmentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[DatabasePrincipalAssignmentsClientListResponse]{ More: func(page DatabasePrincipalAssignmentsClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DatabasePrincipalAssignmentsClientListResponse) (DatabasePrincipalAssignmentsClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DatabasePrincipalAssignmentsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) - if err != nil { - return DatabasePrincipalAssignmentsClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) + }, nil) if err != nil { return DatabasePrincipalAssignmentsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasePrincipalAssignmentsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -398,7 +385,7 @@ func (client *DatabasePrincipalAssignmentsClient) NewListPager(resourceGroupName } // listCreateRequest creates the List request. -func (client *DatabasePrincipalAssignmentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasePrincipalAssignmentsClientListOptions) (*policy.Request, error) { +func (client *DatabasePrincipalAssignmentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, _ *DatabasePrincipalAssignmentsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -421,8 +408,8 @@ func (client *DatabasePrincipalAssignmentsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go index c4095c82446c..943fe93ab7c8 100644 --- a/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/databaseprincipalassignments_client_example_test.go @@ -1,28 +1,25 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasePrincipalAssignmentsCheckNameAvailability.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,123 +33,134 @@ func ExampleDatabasePrincipalAssignmentsClient_CheckNameAvailability() { // 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), + // res = armkusto.DatabasePrincipalAssignmentsClientCheckNameAvailabilityResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasePrincipalAssignmentsGet.json -func ExampleDatabasePrincipalAssignmentsClient_Get() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewDatabasePrincipalAssignmentsClient().Get(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", nil) + 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 poll 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"), + // res = armkusto.DatabasePrincipalAssignmentsClientCreateOrUpdateResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasePrincipalAssignmentsCreateOrUpdate.json -func ExampleDatabasePrincipalAssignmentsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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) + poller, err := clientFactory.NewDatabasePrincipalAssignmentsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", 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) + log.Fatalf("failed to poll 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"), - // }, + // res = armkusto.DatabasePrincipalAssignmentsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasePrincipalAssignmentsDelete.json -func ExampleDatabasePrincipalAssignmentsClient_BeginDelete() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewDatabasePrincipalAssignmentsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoprincipal1", nil) + res, err := clientFactory.NewDatabasePrincipalAssignmentsClient().Get(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) - } + // 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.DatabasePrincipalAssignmentsClientGetResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasePrincipalAssignmentsList.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -167,38 +175,41 @@ func ExampleDatabasePrincipalAssignmentsClient_NewListPager() { _ = 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"), + // page = armkusto.DatabasePrincipalAssignmentsClientListResponse{ + // 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"), + // { + // 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 577fa163b357..4bf62fcf3447 100644 --- a/sdk/resourcemanager/kusto/armkusto/databases_client.go +++ b/sdk/resourcemanager/kusto/armkusto/databases_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -20,15 +19,17 @@ import ( // DatabasesClient contains the methods for the Databases group. // Don't use this type directly, use NewDatabasesClient() instead. +// +// Generated from API version 2025-02-14 type DatabasesClient struct { internal *arm.Client subscriptionID string } // NewDatabasesClient creates a new instance of DatabasesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DatabasesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,8 +44,6 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // AddPrincipals - Add Database principals permissions. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -73,8 +72,12 @@ func (client *DatabasesClient) AddPrincipals(ctx context.Context, resourceGroupN } // addPrincipalsCreateRequest creates the AddPrincipals request. -func (client *DatabasesClient) addPrincipalsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest, options *DatabasesClientAddPrincipalsOptions) (*policy.Request, error) { +func (client *DatabasesClient) addPrincipalsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToAdd DatabasePrincipalListRequest, _ *DatabasesClientAddPrincipalsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -87,18 +90,15 @@ func (client *DatabasesClient) addPrincipalsCreateRequest(ctx context.Context, r return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, databasePrincipalsToAdd); err != nil { return nil, err } @@ -116,8 +116,6 @@ func (client *DatabasesClient) addPrincipalsHandleResponse(resp *http.Response) // CheckNameAvailability - Checks that the databases resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - resourceName - The name of the resource. @@ -146,8 +144,12 @@ func (client *DatabasesClient) CheckNameAvailability(ctx context.Context, resour } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *DatabasesClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest, options *DatabasesClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *DatabasesClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, resourceName CheckNameRequest, _ *DatabasesClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -156,18 +158,15 @@ func (client *DatabasesClient) checkNameAvailabilityCreateRequest(ctx context.Co return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resourceName); err != nil { return nil, err } @@ -185,8 +184,6 @@ func (client *DatabasesClient) checkNameAvailabilityHandleResponse(resp *http.Re // BeginCreateOrUpdate - Creates or updates a database. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -212,8 +209,6 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Creates or updates a database. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseClassification, options *DatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DatabasesClient.BeginCreateOrUpdate" @@ -238,6 +233,10 @@ func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroup // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseClassification, options *DatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -250,21 +249,18 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") + reqQP.Set("api-version", version20250214) if options != nil && options.CallerRole != nil { reqQP.Set("callerRole", string(*options.CallerRole)) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -273,8 +269,6 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Deletes the database with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -298,8 +292,6 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes the database with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DatabasesClient.BeginDelete" @@ -322,8 +314,12 @@ func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGrou } // deleteCreateRequest creates the Delete request. -func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, _ *DatabasesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -336,25 +332,18 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Returns a database. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -382,8 +371,12 @@ func (client *DatabasesClient) Get(ctx context.Context, resourceGroupName string } // getCreateRequest creates the Get request. -func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientGetOptions) (*policy.Request, error) { +func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, _ *DatabasesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -396,17 +389,13 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -421,8 +410,6 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases } // NewListByClusterPager - Returns the list of databases of the given Kusto cluster. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - DatabasesClientListByClusterOptions contains the optional parameters for the DatabasesClient.NewListByClusterPager @@ -453,6 +440,10 @@ func (client *DatabasesClient) NewListByClusterPager(resourceGroupName string, c // listByClusterCreateRequest creates the ListByCluster request. func (client *DatabasesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *DatabasesClientListByClusterOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -461,10 +452,6 @@ func (client *DatabasesClient) listByClusterCreateRequest(ctx context.Context, r return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -476,8 +463,8 @@ func (client *DatabasesClient) listByClusterCreateRequest(ctx context.Context, r if options != nil && options.Top != nil { reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) } - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -492,8 +479,6 @@ func (client *DatabasesClient) listByClusterHandleResponse(resp *http.Response) } // NewListPrincipalsPager - Returns a list of database principals of the given Kusto cluster and database. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -502,21 +487,20 @@ func (client *DatabasesClient) listByClusterHandleResponse(resp *http.Response) func (client *DatabasesClient) NewListPrincipalsPager(resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientListPrincipalsOptions) *runtime.Pager[DatabasesClientListPrincipalsResponse] { return runtime.NewPager(runtime.PagingHandler[DatabasesClientListPrincipalsResponse]{ More: func(page DatabasesClientListPrincipalsResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DatabasesClientListPrincipalsResponse) (DatabasesClientListPrincipalsResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DatabasesClient.NewListPrincipalsPager") - req, err := client.listPrincipalsCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) - if err != nil { - return DatabasesClientListPrincipalsResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listPrincipalsCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) + }, nil) if err != nil { return DatabasesClientListPrincipalsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientListPrincipalsResponse{}, runtime.NewResponseError(resp) - } return client.listPrincipalsHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -524,8 +508,12 @@ func (client *DatabasesClient) NewListPrincipalsPager(resourceGroupName string, } // listPrincipalsCreateRequest creates the ListPrincipals request. -func (client *DatabasesClient) listPrincipalsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientListPrincipalsOptions) (*policy.Request, error) { +func (client *DatabasesClient) listPrincipalsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, _ *DatabasesClientListPrincipalsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -538,17 +526,13 @@ func (client *DatabasesClient) listPrincipalsCreateRequest(ctx context.Context, return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -564,8 +548,6 @@ func (client *DatabasesClient) listPrincipalsHandleResponse(resp *http.Response) // RemovePrincipals - Remove Database principals permissions. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -595,8 +577,12 @@ func (client *DatabasesClient) RemovePrincipals(ctx context.Context, resourceGro } // removePrincipalsCreateRequest creates the RemovePrincipals request. -func (client *DatabasesClient) removePrincipalsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest, options *DatabasesClientRemovePrincipalsOptions) (*policy.Request, error) { +func (client *DatabasesClient) removePrincipalsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, databasePrincipalsToRemove DatabasePrincipalListRequest, _ *DatabasesClientRemovePrincipalsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -609,18 +595,15 @@ func (client *DatabasesClient) removePrincipalsCreateRequest(ctx context.Context return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, databasePrincipalsToRemove); err != nil { return nil, err } @@ -638,8 +621,6 @@ func (client *DatabasesClient) removePrincipalsHandleResponse(resp *http.Respons // BeginUpdate - Updates a database. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -664,8 +645,6 @@ func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Updates a database. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *DatabasesClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseClassification, options *DatabasesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DatabasesClient.BeginUpdate" @@ -690,6 +669,10 @@ func (client *DatabasesClient) update(ctx context.Context, resourceGroupName str // updateCreateRequest creates the Update request. func (client *DatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseClassification, options *DatabasesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -702,21 +685,18 @@ func (client *DatabasesClient) updateCreateRequest(ctx context.Context, resource return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") + reqQP.Set("api-version", version20250214) if options != nil && options.CallerRole != nil { reqQP.Set("callerRole", string(*options.CallerRole)) } - req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go index ab307fe40e14..9cbef51fd7dc 100644 --- a/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/databases_client_example_test.go @@ -1,34 +1,55 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasesCheckNameAvailability.json -func ExampleDatabasesClient_CheckNameAvailability() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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), + 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) @@ -36,181 +57,76 @@ func ExampleDatabasesClient_CheckNameAvailability() { // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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.275Z"); return t}()), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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"), + // res = armkusto.DatabasesClientAddPrincipalsResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSuspendedDatabasesGet.json -func ExampleDatabasesClient_Get_kustoSuspendedDatabasesGet() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewDatabasesClient().Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase9", nil) + 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 = 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.275Z"); return t}()), - // }, - // }, + // res = armkusto.DatabasesClientCheckNameAvailabilityResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabaseReadonlyUpdate.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -220,36 +136,36 @@ func ExampleDatabasesClient_BeginCreateOrUpdate_kustoReadOnlyDatabaseUpdate() { Properties: &armkusto.ReadOnlyFollowingDatabaseProperties{ HotCachePeriod: to.Ptr("P1D"), }, - }, &armkusto.DatabasesClientBeginCreateOrUpdateOptions{CallerRole: nil}) + }, 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) + log.Fatalf("failed to poll 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{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasesCreateOrUpdate.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -259,99 +175,230 @@ func ExampleDatabasesClient_BeginCreateOrUpdate_kustoReadWriteDatabaseCreateOrUp Properties: &armkusto.ReadWriteDatabaseProperties{ SoftDeletePeriod: to.Ptr("P1D"), }, - }, &armkusto.DatabasesClientBeginCreateOrUpdateOptions{CallerRole: to.Ptr(armkusto.CallerRoleAdmin)}) + }, &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) + log.Fatalf("failed to poll 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{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasesUpdate.json -func ExampleDatabasesClient_BeginUpdate() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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}) + poller, err := clientFactory.NewDatabasesClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", 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) + log.Fatalf("failed to poll 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{ + // res = armkusto.DatabasesClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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{ - // HotCachePeriod: to.Ptr("P1D"), // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // SoftDeletePeriod: to.Ptr("P1D"), // }, // }, - // } + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabasesDelete.json -func ExampleDatabasesClient_BeginDelete() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewDatabasesClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", nil) + res, err := clientFactory.NewDatabasesClient().Get(ctx, "kustorptest", "kustoCluster", "KustoDatabase9", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + // 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: 2025-02-14/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("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewDatabasesClient().NewListByClusterPager("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 = armkusto.DatabasesClientListByClusterResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabaseListPrincipals.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -366,48 +413,51 @@ func ExampleDatabasesClient_NewListPrincipalsPager() { _ = 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), + // page = armkusto.DatabasesClientListPrincipalsResponse{ + // 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), + // }, // }, - // { - // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabaseAddPrincipals.json -func ExampleDatabasesClient_AddPrincipals() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewDatabasesClient().AddPrincipals(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DatabasePrincipalListRequest{ + res, err := clientFactory.NewDatabasesClient().RemovePrincipals(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", armkusto.DatabasePrincipalListRequest{ Value: []*armkusto.DatabasePrincipal{ { Name: to.Ptr("Some User"), @@ -432,7 +482,8 @@ func ExampleDatabasesClient_AddPrincipals() { 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) @@ -440,104 +491,76 @@ func ExampleDatabasesClient_AddPrincipals() { // 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), + // res = armkusto.DatabasesClientRemovePrincipalsResponse{ + // 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), + // }, // }, - // { - // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDatabaseRemovePrincipals.json -func ExampleDatabasesClient_RemovePrincipals() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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), - }}, + poller, err := clientFactory.NewDatabasesClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", &armkusto.ReadWriteDatabase{ + Kind: to.Ptr(armkusto.KindReadWrite), + Properties: &armkusto.ReadWriteDatabaseProperties{ + HotCachePeriod: to.Ptr("P1D"), + }, }, 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 poll 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.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), + // 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), // }, - // { - // 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 2150484e4325..45adb2a82a58 100644 --- a/sdk/resourcemanager/kusto/armkusto/dataconnections_client.go +++ b/sdk/resourcemanager/kusto/armkusto/dataconnections_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // DataConnectionsClient contains the methods for the DataConnections group. // Don't use this type directly, use NewDataConnectionsClient() instead. +// +// Generated from API version 2025-02-14 type DataConnectionsClient struct { internal *arm.Client subscriptionID string } // NewDataConnectionsClient creates a new instance of DataConnectionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDataConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataConnectionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewDataConnectionsClient(subscriptionID string, credential azcore.TokenCred // CheckNameAvailability - Checks that the data connection name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -73,8 +72,12 @@ func (client *DataConnectionsClient) CheckNameAvailability(ctx context.Context, } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *DataConnectionsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName DataConnectionCheckNameRequest, options *DataConnectionsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *DataConnectionsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName DataConnectionCheckNameRequest, _ *DataConnectionsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -87,18 +90,15 @@ func (client *DataConnectionsClient) checkNameAvailabilityCreateRequest(ctx cont return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, dataConnectionName); err != nil { return nil, err } @@ -116,8 +116,6 @@ func (client *DataConnectionsClient) checkNameAvailabilityHandleResponse(resp *h // BeginCreateOrUpdate - Creates or updates a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -144,8 +142,6 @@ func (client *DataConnectionsClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Creates or updates a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 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 const operationName = "DataConnectionsClient.BeginCreateOrUpdate" @@ -168,8 +164,12 @@ func (client *DataConnectionsClient) createOrUpdate(ctx context.Context, resourc } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DataConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters DataConnectionClassification, options *DataConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DataConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters DataConnectionClassification, _ *DataConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -186,18 +186,15 @@ func (client *DataConnectionsClient) createOrUpdateCreateRequest(ctx context.Con return nil, errors.New("parameter dataConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataConnectionName}", url.PathEscape(dataConnectionName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -206,8 +203,6 @@ func (client *DataConnectionsClient) createOrUpdateCreateRequest(ctx context.Con // BeginDataConnectionValidation - Checks that the data connection parameters are valid. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -233,8 +228,6 @@ func (client *DataConnectionsClient) BeginDataConnectionValidation(ctx context.C // DataConnectionValidation - Checks that the data connection parameters are valid. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *DataConnectionsClient) dataConnectionValidation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DataConnectionValidation, options *DataConnectionsClientBeginDataConnectionValidationOptions) (*http.Response, error) { var err error const operationName = "DataConnectionsClient.BeginDataConnectionValidation" @@ -257,8 +250,12 @@ func (client *DataConnectionsClient) dataConnectionValidation(ctx context.Contex } // dataConnectionValidationCreateRequest creates the DataConnectionValidation request. -func (client *DataConnectionsClient) dataConnectionValidationCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DataConnectionValidation, options *DataConnectionsClientBeginDataConnectionValidationOptions) (*policy.Request, error) { +func (client *DataConnectionsClient) dataConnectionValidationCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DataConnectionValidation, _ *DataConnectionsClientBeginDataConnectionValidationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -271,18 +268,15 @@ func (client *DataConnectionsClient) dataConnectionValidationCreateRequest(ctx c return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -291,8 +285,6 @@ func (client *DataConnectionsClient) dataConnectionValidationCreateRequest(ctx c // BeginDelete - Deletes the data connection with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -318,8 +310,6 @@ func (client *DataConnectionsClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deletes the data connection with the given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *DataConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, options *DataConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DataConnectionsClient.BeginDelete" @@ -342,8 +332,12 @@ func (client *DataConnectionsClient) deleteOperation(ctx context.Context, resour } // deleteCreateRequest creates the Delete request. -func (client *DataConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, options *DataConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DataConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, _ *DataConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -360,25 +354,18 @@ func (client *DataConnectionsClient) deleteCreateRequest(ctx context.Context, re return nil, errors.New("parameter dataConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataConnectionName}", url.PathEscape(dataConnectionName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Returns a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -407,8 +394,12 @@ func (client *DataConnectionsClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *DataConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, options *DataConnectionsClientGetOptions) (*policy.Request, error) { +func (client *DataConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, _ *DataConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -425,17 +416,13 @@ func (client *DataConnectionsClient) getCreateRequest(ctx context.Context, resou return nil, errors.New("parameter dataConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataConnectionName}", url.PathEscape(dataConnectionName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -450,8 +437,6 @@ func (client *DataConnectionsClient) getHandleResponse(resp *http.Response) (Dat } // NewListByDatabasePager - Returns the list of data connections of the given Kusto database. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -460,21 +445,20 @@ func (client *DataConnectionsClient) getHandleResponse(resp *http.Response) (Dat func (client *DataConnectionsClient) NewListByDatabasePager(resourceGroupName string, clusterName string, databaseName string, options *DataConnectionsClientListByDatabaseOptions) *runtime.Pager[DataConnectionsClientListByDatabaseResponse] { return runtime.NewPager(runtime.PagingHandler[DataConnectionsClientListByDatabaseResponse]{ More: func(page DataConnectionsClientListByDatabaseResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *DataConnectionsClientListByDatabaseResponse) (DataConnectionsClientListByDatabaseResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataConnectionsClient.NewListByDatabasePager") - req, err := client.listByDatabaseCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) - if err != nil { - return DataConnectionsClientListByDatabaseResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByDatabaseCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) + }, nil) if err != nil { return DataConnectionsClientListByDatabaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DataConnectionsClientListByDatabaseResponse{}, runtime.NewResponseError(resp) - } return client.listByDatabaseHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -482,8 +466,12 @@ func (client *DataConnectionsClient) NewListByDatabasePager(resourceGroupName st } // listByDatabaseCreateRequest creates the ListByDatabase request. -func (client *DataConnectionsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DataConnectionsClientListByDatabaseOptions) (*policy.Request, error) { +func (client *DataConnectionsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, _ *DataConnectionsClientListByDatabaseOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -496,17 +484,13 @@ func (client *DataConnectionsClient) listByDatabaseCreateRequest(ctx context.Con return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -522,8 +506,6 @@ func (client *DataConnectionsClient) listByDatabaseHandleResponse(resp *http.Res // BeginUpdate - Updates a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -550,8 +532,6 @@ func (client *DataConnectionsClient) BeginUpdate(ctx context.Context, resourceGr // Update - Updates a data connection. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 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 const operationName = "DataConnectionsClient.BeginUpdate" @@ -574,8 +554,12 @@ func (client *DataConnectionsClient) update(ctx context.Context, resourceGroupNa } // updateCreateRequest creates the Update request. -func (client *DataConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters DataConnectionClassification, options *DataConnectionsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *DataConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, dataConnectionName string, parameters DataConnectionClassification, _ *DataConnectionsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -592,18 +576,15 @@ func (client *DataConnectionsClient) updateCreateRequest(ctx context.Context, re return nil, errors.New("parameter dataConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{dataConnectionName}", url.PathEscape(dataConnectionName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go index 447a887dccec..6382eb3721f3 100644 --- a/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/dataconnections_client_example_test.go @@ -1,120 +1,332 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" + "time" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsListByDatabase.json -func ExampleDataConnectionsClient_NewListByDatabasePager() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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.EventHubDataFormatMULTIJSON), - // 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.655Z"); 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.EventGridDataFormatMULTIJSON), - // 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.655Z"); return t}()), - // TableName: to.Ptr("TestTable"), - // }, - // }}, - // } + 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 = armkusto.DataConnectionsClientCheckNameAvailabilityResponse{ + // 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: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 poll 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: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 poll 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: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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.EventGridDataFormatMULTIJSON), + 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 poll 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.EventGridDataFormatMULTIJSON), + // 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: 2025-02-14/KustoDataConnectionsEventGridWithManagedIdentityCreateOrUpdate.json +func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsEventGridWithManagedIdentityCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewDataConnectionsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventGridDataConnectionWithManagedIdentity{ + Location: to.Ptr("westus"), + Kind: to.Ptr(armkusto.DataConnectionKindEventGridWithManagedIdentity), + Properties: &armkusto.EventGridConnectionWithManagedIdentityProperties{ + IgnoreFirstRecord: to.Ptr(false), + StorageAccountResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + EventHubResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), + ConsumerGroup: to.Ptr("$Default"), + TableName: to.Ptr("TestTable"), + MappingRuleName: to.Ptr("TestMapping"), + DataFormat: to.Ptr(armkusto.EventGridDataFormatMULTIJSON), + BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), + }, + }, 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 poll 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.EventGridDataConnectionWithManagedIdentity{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection9"), + // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), + // Location: to.Ptr("westus"), + // Kind: to.Ptr(armkusto.DataConnectionKindEventGridWithManagedIdentity), + // Properties: &armkusto.EventGridConnectionWithManagedIdentityProperties{ + // IgnoreFirstRecord: to.Ptr(false), + // StorageAccountResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + // EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + // EventHubResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), + // ConsumerGroup: to.Ptr("$Default"), + // TableName: to.Ptr("TestTable"), + // MappingRuleName: to.Ptr("TestMapping"), + // DataFormat: to.Ptr(armkusto.EventGridDataFormatMULTIJSON), + // BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), + // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoDataConnectionsEventHubWithManagedIdentityCreateOrUpdate.json +func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsEventHubWithManagedIdentityCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewDataConnectionsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventHubDataConnectionWithManagedIdentity{ + Location: to.Ptr("westus"), + Kind: to.Ptr(armkusto.DataConnectionKindEventHubWithManagedIdentity), + Properties: &armkusto.EventHubConnectionWithManagedIdentityProperties{ + EventHubResourceIDForManagedIdentity: 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"), + ConsumerGroup: to.Ptr("testConsumerGroup1"), + }, + }, 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 poll 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.EventHubDataConnectionWithManagedIdentity{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/dataConnectionTest"), + // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), + // Location: to.Ptr("westus"), + // Kind: to.Ptr(armkusto.DataConnectionKindEventHubWithManagedIdentity), + // Properties: &armkusto.EventHubConnectionWithManagedIdentityProperties{ + // EventHubResourceIDForManagedIdentity: 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"), + // ConsumerGroup: to.Ptr("testConsumerGroup1"), + // Compression: to.Ptr(armkusto.CompressionNone), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionEventGridValidationAsync.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -142,23 +354,131 @@ func ExampleDataConnectionsClient_BeginDataConnectionValidation_kustoDataConnect } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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{ + // res = armkusto.DataConnectionsClientDataConnectionValidationResponse{ + // DataConnectionValidationListResult: armkusto.DataConnectionValidationListResult{ + // Value: []*armkusto.DataConnectionValidationResult{ + // { + // ErrorMessage: to.Ptr("Database does not exist"), + // }, + // }, + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionValidationAsync.json +// Generated from example definition: 2025-02-14/KustoDataConnectionEventGridWithManagedIdentityValidationAsync.json +func ExampleDataConnectionsClient_BeginDataConnectionValidation_kustoDataConnectionEventGridWithManagedIdentityValidationAsync() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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.EventGridDataConnectionWithManagedIdentity{ + Kind: to.Ptr(armkusto.DataConnectionKindEventGridWithManagedIdentity), + Properties: &armkusto.EventGridConnectionWithManagedIdentityProperties{ + ConsumerGroup: to.Ptr("$Default"), + EventHubResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), + EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + TableName: to.Ptr("TestTable"), + MappingRuleName: to.Ptr("TestMapping"), + DataFormat: to.Ptr(armkusto.EventGridDataFormatMULTIJSON), + StorageAccountResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + IgnoreFirstRecord: to.Ptr(false), + BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), + }, + }, + }, 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 poll 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.DataConnectionsClientDataConnectionValidationResponse{ + // DataConnectionValidationListResult: armkusto.DataConnectionValidationListResult{ + // Value: []*armkusto.DataConnectionValidationResult{ + // { + // ErrorMessage: to.Ptr("Database does not exist"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoDataConnectionEventHubWithManagedIdentityValidationAsync.json +func ExampleDataConnectionsClient_BeginDataConnectionValidation_kustoDataConnectionEventHubWithManagedIdentityValidationAsync() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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.EventHubDataConnectionWithManagedIdentity{ + Kind: to.Ptr(armkusto.DataConnectionKindEventHubWithManagedIdentity), + Properties: &armkusto.EventHubConnectionWithManagedIdentityProperties{ + ConsumerGroup: to.Ptr("testConsumerGroup1"), + EventHubResourceIDForManagedIdentity: 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"), + Compression: to.Ptr(armkusto.CompressionNone), + TableName: to.Ptr("TestTable"), + MappingRuleName: to.Ptr("TestMapping"), + DataFormat: to.Ptr(armkusto.EventHubDataFormatMULTIJSON), + }, + }, + }, 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 poll 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.DataConnectionsClientDataConnectionValidationResponse{ + // DataConnectionValidationListResult: armkusto.DataConnectionValidationListResult{ + // Value: []*armkusto.DataConnectionValidationResult{ + // { + // ErrorMessage: to.Ptr("Event hub's namespace does not exist"), + // }, + // { + // ErrorMessage: to.Ptr("Database does not exist"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -182,52 +502,59 @@ func ExampleDataConnectionsClient_BeginDataConnectionValidation_kustoDataConnect } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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{ + // res = armkusto.DataConnectionsClientDataConnectionValidationResponse{ + // DataConnectionValidationListResult: armkusto.DataConnectionValidationListResult{ + // Value: []*armkusto.DataConnectionValidationResult{ + // { + // ErrorMessage: to.Ptr("Event hub's namespace does not exist"), + // }, + // { + // ErrorMessage: to.Ptr("Database does not exist"), + // }, + // }, + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsCheckNameAvailability.json -func ExampleDataConnectionsClient_CheckNameAvailability() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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) + poller, err := clientFactory.NewDataConnectionsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", 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 poll 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.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), + // res = armkusto.DataConnectionsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsCosmosDbGet.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -239,7 +566,7 @@ func ExampleDataConnectionsClient_Get_kustoDataConnectionsCosmosDbGet() { _ = 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{ + // 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"), @@ -253,21 +580,21 @@ func ExampleDataConnectionsClient_Get_kustoDataConnectionsCosmosDbGet() { // 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.655Z"); return t}()), + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsEventGridGet.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -279,7 +606,7 @@ func ExampleDataConnectionsClient_Get_kustoDataConnectionsEventGridGet() { _ = 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{ + // 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"), @@ -301,17 +628,105 @@ func ExampleDataConnectionsClient_Get_kustoDataConnectionsEventGridGet() { // TableName: to.Ptr("TestTable"), // }, // }, - // } + // } +} + +// Generated from example definition: 2025-02-14/KustoDataConnectionsEventGridWithManagedIdentityGet.json +func ExampleDataConnectionsClient_Get_kustoDataConnectionsEventGridWithManagedIdentityGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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.EventGridDataConnectionWithManagedIdentity{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection9"), + // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), + // Location: to.Ptr("westus"), + // Kind: to.Ptr(armkusto.DataConnectionKindEventGridWithManagedIdentity), + // Properties: &armkusto.EventGridConnectionWithManagedIdentityProperties{ + // IgnoreFirstRecord: to.Ptr(false), + // StorageAccountResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + // EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + // EventHubResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), + // ConsumerGroup: to.Ptr("$Default"), + // TableName: to.Ptr("TestTable"), + // MappingRuleName: to.Ptr("TestMapping"), + // DataFormat: to.Ptr(armkusto.EventGridDataFormatMULTIJSON), + // BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), + // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoDataConnectionsEventHubWithManagedIdentityGet.json +func ExampleDataConnectionsClient_Get_kustoDataConnectionsEventHubWithManagedIdentityGet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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.EventHubDataConnectionWithManagedIdentity{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/dataConnectionTest"), + // Name: to.Ptr("kustoCluster/KustoDatabase8/dataConnectionTest"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/DataConnections"), + // Location: to.Ptr("westus"), + // Kind: to.Ptr(armkusto.DataConnectionKindEventHubWithManagedIdentity), + // Properties: &armkusto.EventHubConnectionWithManagedIdentityProperties{ + // EventHubResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest1"), + // ConsumerGroup: to.Ptr("$Default"), + // TableName: to.Ptr("TestTable"), + // MappingRuleName: to.Ptr("TestMapping"), + // DataFormat: to.Ptr(armkusto.EventHubDataFormatMULTIJSON), + // EventSystemProperties: []*string{ + // }, + // Compression: to.Ptr(armkusto.CompressionNone), + // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), + // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), + // RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t}()), + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsGet.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -323,7 +738,7 @@ func ExampleDataConnectionsClient_Get_kustoDataConnectionsGet() { _ = 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{ + // 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"), @@ -341,25 +756,118 @@ func ExampleDataConnectionsClient_Get_kustoDataConnectionsGet() { // 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.655Z"); return t}()), + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsCosmosDbCreateOrUpdate.json -func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsCosmosDbCreateOrUpdate() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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{ + 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 = armkusto.DataConnectionsClientListByDatabaseResponse{ + // 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.EventHubDataFormatMULTIJSON), + // 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.EventGridDataFormatMULTIJSON), + // 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: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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{ @@ -368,7 +876,7 @@ func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsCosmos 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.655Z"); return t }()), + RetrievalStartDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-07-29T12:00:00.6554616Z"); return t }()), TableName: to.Ptr("TestTable"), }, }, nil) @@ -377,13 +885,13 @@ func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsCosmos } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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{ + // 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"), @@ -396,72 +904,25 @@ func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsCosmos // 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.655Z"); return t}()), + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsEventGridCreateOrUpdate.json -func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsEventGridCreateOrUpdate() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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{ + poller, err := clientFactory.NewDataConnectionsClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventGridDataConnection{ Kind: to.Ptr(armkusto.DataConnectionKindEventGrid), Location: to.Ptr("westus"), Properties: &armkusto.EventGridConnectionProperties{ @@ -483,13 +944,13 @@ func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsEventG } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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{ + // 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"), @@ -510,31 +971,35 @@ func ExampleDataConnectionsClient_BeginCreateOrUpdate_kustoDataConnectionsEventG // TableName: to.Ptr("TestTable"), // }, // }, - // } + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsCosmosDbUpdate.json -func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsCosmosDbUpdate() { +// Generated from example definition: 2025-02-14/KustoDataConnectionsEventGridWithManagedIdentityUpdate.json +func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsEventGridWithManagedIdentityUpdate() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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), + poller, err := clientFactory.NewDataConnectionsClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventGridDataConnectionWithManagedIdentity{ 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.655Z"); return t }()), - TableName: to.Ptr("TestTable"), + Kind: to.Ptr(armkusto.DataConnectionKindEventGridWithManagedIdentity), + Properties: &armkusto.EventGridConnectionWithManagedIdentityProperties{ + IgnoreFirstRecord: to.Ptr(false), + StorageAccountResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + EventHubResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), + ConsumerGroup: to.Ptr("$Default"), + TableName: to.Ptr("TestTable"), + MappingRuleName: to.Ptr("TestMapping"), + DataFormat: to.Ptr(armkusto.EventGridDataFormatMULTIJSON), + BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), }, }, nil) if err != nil { @@ -542,58 +1007,54 @@ func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsCosmosDbUpdate } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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"), + // DataConnectionClassification: &armkusto.EventGridDataConnectionWithManagedIdentity{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/KustoDataConnection9"), + // 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/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.655Z"); return t}()), + // Kind: to.Ptr(armkusto.DataConnectionKindEventGridWithManagedIdentity), + // Properties: &armkusto.EventGridConnectionWithManagedIdentityProperties{ + // IgnoreFirstRecord: to.Ptr(false), + // StorageAccountResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), + // EventGridResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount/providers/Microsoft.EventGrid/eventSubscriptions/eventSubscriptionTest"), + // EventHubResourceIDForManagedIdentity: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventHub/namespaces/eventhubTestns1/eventhubs/eventhubTest2"), + // ConsumerGroup: to.Ptr("$Default"), // TableName: to.Ptr("TestTable"), + // MappingRuleName: to.Ptr("TestMapping"), + // DataFormat: to.Ptr(armkusto.EventGridDataFormatMULTIJSON), + // BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), + // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedidentityTest1"), + // ManagedIdentityObjectID: to.Ptr("87654321-1234-1234-1234-123456789123"), + // DatabaseRouting: to.Ptr(armkusto.DatabaseRoutingSingle), // }, // }, - // } + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsEventGridUpdate.json -func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsEventGridUpdate() { +// Generated from example definition: 2025-02-14/KustoDataConnectionsEventHubWithManagedIdentityUpdate.json +func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsEventHubWithManagedIdentityUpdate() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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), + poller, err := clientFactory.NewDataConnectionsClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "dataConnectionTest", &armkusto.EventHubDataConnectionWithManagedIdentity{ Location: to.Ptr("westus"), - Properties: &armkusto.EventGridConnectionProperties{ - BlobStorageEventType: to.Ptr(armkusto.BlobStorageEventTypeMicrosoftStorageBlobCreated), - ConsumerGroup: to.Ptr("$Default"), - DataFormat: to.Ptr(armkusto.EventGridDataFormatMULTIJSON), - 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"), + Kind: to.Ptr(armkusto.DataConnectionKindEventHubWithManagedIdentity), + Properties: &armkusto.EventHubConnectionWithManagedIdentityProperties{ + EventHubResourceIDForManagedIdentity: 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"), + ConsumerGroup: to.Ptr("testConsumerGroup1"), }, }, nil) if err != nil { @@ -601,44 +1062,36 @@ func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsEventGridUpdat } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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{ + // DataConnectionClassification: &armkusto.EventHubDataConnectionWithManagedIdentity{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/DataConnections/dataConnectionTest"), // 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.EventGridDataFormatMULTIJSON), - // 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"), + // Kind: to.Ptr(armkusto.DataConnectionKindEventHubWithManagedIdentity), + // Properties: &armkusto.EventHubConnectionWithManagedIdentityProperties{ + // EventHubResourceIDForManagedIdentity: 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"), - // StorageAccountResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Storage/storageAccounts/teststorageaccount"), - // TableName: to.Ptr("TestTable"), + // ConsumerGroup: to.Ptr("testConsumerGroup1"), + // Compression: to.Ptr(armkusto.CompressionNone), // }, // }, - // } + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoDataConnectionsUpdate.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -656,13 +1109,13 @@ func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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{ + // 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"), @@ -675,26 +1128,5 @@ func ExampleDataConnectionsClient_BeginUpdate_kustoDataConnectionsUpdate() { // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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/fake/attacheddatabaseconfigurations_server.go b/sdk/resourcemanager/kusto/armkusto/fake/attacheddatabaseconfigurations_server.go index b1ead28d2b73..90d70fddec00 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/attacheddatabaseconfigurations_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/attacheddatabaseconfigurations_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // AttachedDatabaseConfigurationsServer is a fake server for instances of the armkusto.AttachedDatabaseConfigurationsClient type. @@ -70,29 +71,43 @@ func (a *AttachedDatabaseConfigurationsServerTransport) Do(req *http.Request) (* return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AttachedDatabaseConfigurationsClient.CheckNameAvailability": - resp, err = a.dispatchCheckNameAvailability(req) - case "AttachedDatabaseConfigurationsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AttachedDatabaseConfigurationsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AttachedDatabaseConfigurationsClient.Get": - resp, err = a.dispatchGet(req) - case "AttachedDatabaseConfigurationsClient.NewListByClusterPager": - resp, err = a.dispatchNewListByClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AttachedDatabaseConfigurationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if attachedDatabaseConfigurationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = attachedDatabaseConfigurationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AttachedDatabaseConfigurationsClient.CheckNameAvailability": + res.resp, res.err = a.dispatchCheckNameAvailability(req) + case "AttachedDatabaseConfigurationsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AttachedDatabaseConfigurationsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AttachedDatabaseConfigurationsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AttachedDatabaseConfigurationsClient.NewListByClusterPager": + res.resp, res.err = a.dispatchNewListByClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AttachedDatabaseConfigurationsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -102,7 +117,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchCheckNameAvailab const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/attachedDatabaseConfigurationCheckNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.AttachedDatabaseConfigurationsCheckNameRequest](req) @@ -122,7 +137,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchCheckNameAvailab return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -141,7 +156,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchBeginCreateOrUpd const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/attachedDatabaseConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.AttachedDatabaseConfiguration](req) @@ -173,7 +188,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchBeginCreateOrUpd return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { a.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -193,7 +208,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchBeginDelete(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/attachedDatabaseConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +236,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchBeginDelete(req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -239,7 +254,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchGet(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/attachedDatabaseConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -259,7 +274,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchGet(req *http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AttachedDatabaseConfiguration, req) @@ -278,7 +293,7 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchNewListByCluster const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/attachedDatabaseConfigurations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -292,12 +307,15 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchNewListByCluster resp := a.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, nil) newListByClusterPager = &resp a.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armkusto.AttachedDatabaseConfigurationsClientListByClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByClusterPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListByClusterPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -306,3 +324,9 @@ func (a *AttachedDatabaseConfigurationsServerTransport) dispatchNewListByCluster } return resp, nil } + +// set this to conditionally intercept incoming requests to AttachedDatabaseConfigurationsServerTransport +var attachedDatabaseConfigurationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/clusterprincipalassignments_server.go b/sdk/resourcemanager/kusto/armkusto/fake/clusterprincipalassignments_server.go index 6e247d081980..21a917533c09 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/clusterprincipalassignments_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/clusterprincipalassignments_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // ClusterPrincipalAssignmentsServer is a fake server for instances of the armkusto.ClusterPrincipalAssignmentsClient type. @@ -70,29 +71,43 @@ func (c *ClusterPrincipalAssignmentsServerTransport) Do(req *http.Request) (*htt return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "ClusterPrincipalAssignmentsClient.CheckNameAvailability": - resp, err = c.dispatchCheckNameAvailability(req) - case "ClusterPrincipalAssignmentsClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "ClusterPrincipalAssignmentsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "ClusterPrincipalAssignmentsClient.Get": - resp, err = c.dispatchGet(req) - case "ClusterPrincipalAssignmentsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ClusterPrincipalAssignmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if clusterPrincipalAssignmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = clusterPrincipalAssignmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ClusterPrincipalAssignmentsClient.CheckNameAvailability": + res.resp, res.err = c.dispatchCheckNameAvailability(req) + case "ClusterPrincipalAssignmentsClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "ClusterPrincipalAssignmentsClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "ClusterPrincipalAssignmentsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ClusterPrincipalAssignmentsClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ClusterPrincipalAssignmentsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -102,7 +117,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchCheckNameAvailabili const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkPrincipalAssignmentNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ClusterPrincipalAssignmentCheckNameRequest](req) @@ -122,7 +137,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchCheckNameAvailabili return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -141,7 +156,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchBeginCreateOrUpdate const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/principalAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ClusterPrincipalAssignment](req) @@ -173,7 +188,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchBeginCreateOrUpdate return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { c.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -193,7 +208,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchBeginDelete(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/principalAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +236,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchBeginDelete(req *ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -239,7 +254,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchGet(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/principalAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -259,7 +274,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchGet(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ClusterPrincipalAssignment, req) @@ -278,7 +293,7 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchNewListPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/principalAssignments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -292,12 +307,15 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchNewListPager(req *h resp := c.srv.NewListPager(resourceGroupNameParam, clusterNameParam, nil) newListPager = &resp c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armkusto.ClusterPrincipalAssignmentsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -306,3 +324,9 @@ func (c *ClusterPrincipalAssignmentsServerTransport) dispatchNewListPager(req *h } return resp, nil } + +// set this to conditionally intercept incoming requests to ClusterPrincipalAssignmentsServerTransport +var clusterPrincipalAssignmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/clusters_server.go b/sdk/resourcemanager/kusto/armkusto/fake/clusters_server.go index 541cf9fffa71..cc93c47f1d63 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/clusters_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/clusters_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,16 +16,17 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ClustersServer is a fake server for instances of the armkusto.ClustersClient type. type ClustersServer struct { // BeginAddCalloutPolicies is the fake for method ClustersClient.BeginAddCalloutPolicies - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginAddCalloutPolicies func(ctx context.Context, resourceGroupName string, clusterName string, calloutPolicies armkusto.CalloutPoliciesList, options *armkusto.ClustersClientBeginAddCalloutPoliciesOptions) (resp azfake.PollerResponder[armkusto.ClustersClientAddCalloutPoliciesResponse], errResp azfake.ErrorResponder) // BeginAddLanguageExtensions is the fake for method ClustersClient.BeginAddLanguageExtensions - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginAddLanguageExtensions func(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToAdd armkusto.LanguageExtensionsList, options *armkusto.ClustersClientBeginAddLanguageExtensionsOptions) (resp azfake.PollerResponder[armkusto.ClustersClientAddLanguageExtensionsResponse], errResp azfake.ErrorResponder) // CheckNameAvailability is the fake for method ClustersClient.CheckNameAvailability @@ -42,7 +42,7 @@ type ClustersServer struct { BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, options *armkusto.ClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armkusto.ClustersClientDeleteResponse], errResp azfake.ErrorResponder) // BeginDetachFollowerDatabases is the fake for method ClustersClient.BeginDetachFollowerDatabases - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDetachFollowerDatabases func(ctx context.Context, resourceGroupName string, clusterName string, followerDatabaseToRemove armkusto.FollowerDatabaseDefinition, options *armkusto.ClustersClientBeginDetachFollowerDatabasesOptions) (resp azfake.PollerResponder[armkusto.ClustersClientDetachFollowerDatabasesResponse], errResp azfake.ErrorResponder) // BeginDiagnoseVirtualNetwork is the fake for method ClustersClient.BeginDiagnoseVirtualNetwork @@ -90,23 +90,23 @@ type ClustersServer struct { NewListSKUsByResourcePager func(resourceGroupName string, clusterName string, options *armkusto.ClustersClientListSKUsByResourceOptions) (resp azfake.PagerResponder[armkusto.ClustersClientListSKUsByResourceResponse]) // BeginMigrate is the fake for method ClustersClient.BeginMigrate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginMigrate func(ctx context.Context, resourceGroupName string, clusterName string, clusterMigrateRequest armkusto.ClusterMigrateRequest, options *armkusto.ClustersClientBeginMigrateOptions) (resp azfake.PollerResponder[armkusto.ClustersClientMigrateResponse], errResp azfake.ErrorResponder) // BeginRemoveCalloutPolicy is the fake for method ClustersClient.BeginRemoveCalloutPolicy - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRemoveCalloutPolicy func(ctx context.Context, resourceGroupName string, clusterName string, calloutPolicy armkusto.CalloutPolicyToRemove, options *armkusto.ClustersClientBeginRemoveCalloutPolicyOptions) (resp azfake.PollerResponder[armkusto.ClustersClientRemoveCalloutPolicyResponse], errResp azfake.ErrorResponder) // BeginRemoveLanguageExtensions is the fake for method ClustersClient.BeginRemoveLanguageExtensions - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRemoveLanguageExtensions func(ctx context.Context, resourceGroupName string, clusterName string, languageExtensionsToRemove armkusto.LanguageExtensionsList, options *armkusto.ClustersClientBeginRemoveLanguageExtensionsOptions) (resp azfake.PollerResponder[armkusto.ClustersClientRemoveLanguageExtensionsResponse], errResp azfake.ErrorResponder) // BeginStart is the fake for method ClustersClient.BeginStart - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginStart func(ctx context.Context, resourceGroupName string, clusterName string, options *armkusto.ClustersClientBeginStartOptions) (resp azfake.PollerResponder[armkusto.ClustersClientStartResponse], errResp azfake.ErrorResponder) // BeginStop is the fake for method ClustersClient.BeginStop - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginStop func(ctx context.Context, resourceGroupName string, clusterName string, options *armkusto.ClustersClientBeginStopOptions) (resp azfake.PollerResponder[armkusto.ClustersClientStopResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method ClustersClient.BeginUpdate @@ -179,65 +179,79 @@ func (c *ClustersServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "ClustersClient.BeginAddCalloutPolicies": - resp, err = c.dispatchBeginAddCalloutPolicies(req) - case "ClustersClient.BeginAddLanguageExtensions": - resp, err = c.dispatchBeginAddLanguageExtensions(req) - case "ClustersClient.CheckNameAvailability": - resp, err = c.dispatchCheckNameAvailability(req) - case "ClustersClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "ClustersClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "ClustersClient.BeginDetachFollowerDatabases": - resp, err = c.dispatchBeginDetachFollowerDatabases(req) - case "ClustersClient.BeginDiagnoseVirtualNetwork": - resp, err = c.dispatchBeginDiagnoseVirtualNetwork(req) - case "ClustersClient.Get": - resp, err = c.dispatchGet(req) - case "ClustersClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "ClustersClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "ClustersClient.NewListCalloutPoliciesPager": - resp, err = c.dispatchNewListCalloutPoliciesPager(req) - case "ClustersClient.NewListFollowerDatabasesPager": - resp, err = c.dispatchNewListFollowerDatabasesPager(req) - case "ClustersClient.NewListFollowerDatabasesGetPager": - resp, err = c.dispatchNewListFollowerDatabasesGetPager(req) - case "ClustersClient.NewListLanguageExtensionsPager": - resp, err = c.dispatchNewListLanguageExtensionsPager(req) - case "ClustersClient.NewListOutboundNetworkDependenciesEndpointsPager": - resp, err = c.dispatchNewListOutboundNetworkDependenciesEndpointsPager(req) - case "ClustersClient.NewListSKUsPager": - resp, err = c.dispatchNewListSKUsPager(req) - case "ClustersClient.NewListSKUsByResourcePager": - resp, err = c.dispatchNewListSKUsByResourcePager(req) - case "ClustersClient.BeginMigrate": - resp, err = c.dispatchBeginMigrate(req) - case "ClustersClient.BeginRemoveCalloutPolicy": - resp, err = c.dispatchBeginRemoveCalloutPolicy(req) - case "ClustersClient.BeginRemoveLanguageExtensions": - resp, err = c.dispatchBeginRemoveLanguageExtensions(req) - case "ClustersClient.BeginStart": - resp, err = c.dispatchBeginStart(req) - case "ClustersClient.BeginStop": - resp, err = c.dispatchBeginStop(req) - case "ClustersClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return c.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (c *ClustersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if clustersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = clustersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ClustersClient.BeginAddCalloutPolicies": + res.resp, res.err = c.dispatchBeginAddCalloutPolicies(req) + case "ClustersClient.BeginAddLanguageExtensions": + res.resp, res.err = c.dispatchBeginAddLanguageExtensions(req) + case "ClustersClient.CheckNameAvailability": + res.resp, res.err = c.dispatchCheckNameAvailability(req) + case "ClustersClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "ClustersClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "ClustersClient.BeginDetachFollowerDatabases": + res.resp, res.err = c.dispatchBeginDetachFollowerDatabases(req) + case "ClustersClient.BeginDiagnoseVirtualNetwork": + res.resp, res.err = c.dispatchBeginDiagnoseVirtualNetwork(req) + case "ClustersClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ClustersClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + case "ClustersClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "ClustersClient.NewListCalloutPoliciesPager": + res.resp, res.err = c.dispatchNewListCalloutPoliciesPager(req) + case "ClustersClient.NewListFollowerDatabasesPager": + res.resp, res.err = c.dispatchNewListFollowerDatabasesPager(req) + case "ClustersClient.NewListFollowerDatabasesGetPager": + res.resp, res.err = c.dispatchNewListFollowerDatabasesGetPager(req) + case "ClustersClient.NewListLanguageExtensionsPager": + res.resp, res.err = c.dispatchNewListLanguageExtensionsPager(req) + case "ClustersClient.NewListOutboundNetworkDependenciesEndpointsPager": + res.resp, res.err = c.dispatchNewListOutboundNetworkDependenciesEndpointsPager(req) + case "ClustersClient.NewListSKUsPager": + res.resp, res.err = c.dispatchNewListSKUsPager(req) + case "ClustersClient.NewListSKUsByResourcePager": + res.resp, res.err = c.dispatchNewListSKUsByResourcePager(req) + case "ClustersClient.BeginMigrate": + res.resp, res.err = c.dispatchBeginMigrate(req) + case "ClustersClient.BeginRemoveCalloutPolicy": + res.resp, res.err = c.dispatchBeginRemoveCalloutPolicy(req) + case "ClustersClient.BeginRemoveLanguageExtensions": + res.resp, res.err = c.dispatchBeginRemoveLanguageExtensions(req) + case "ClustersClient.BeginStart": + res.resp, res.err = c.dispatchBeginStart(req) + case "ClustersClient.BeginStop": + res.resp, res.err = c.dispatchBeginStop(req) + case "ClustersClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ClustersServerTransport) dispatchBeginAddCalloutPolicies(req *http.Request) (*http.Response, error) { @@ -249,7 +263,7 @@ func (c *ClustersServerTransport) dispatchBeginAddCalloutPolicies(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/addCalloutPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.CalloutPoliciesList](req) @@ -277,9 +291,9 @@ func (c *ClustersServerTransport) dispatchBeginAddCalloutPolicies(req *http.Requ return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginAddCalloutPolicies.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginAddCalloutPolicies) { c.beginAddCalloutPolicies.remove(req) @@ -297,7 +311,7 @@ func (c *ClustersServerTransport) dispatchBeginAddLanguageExtensions(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/addLanguageExtensions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.LanguageExtensionsList](req) @@ -325,9 +339,9 @@ func (c *ClustersServerTransport) dispatchBeginAddLanguageExtensions(req *http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginAddLanguageExtensions.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginAddLanguageExtensions) { c.beginAddLanguageExtensions.remove(req) @@ -343,7 +357,7 @@ func (c *ClustersServerTransport) dispatchCheckNameAvailability(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ClusterCheckNameRequest](req) @@ -359,7 +373,7 @@ func (c *ClustersServerTransport) dispatchCheckNameAvailability(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -378,7 +392,7 @@ func (c *ClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.Cluster](req) @@ -415,7 +429,7 @@ func (c *ClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { c.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -435,7 +449,7 @@ func (c *ClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -459,7 +473,7 @@ func (c *ClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -479,7 +493,7 @@ func (c *ClustersServerTransport) dispatchBeginDetachFollowerDatabases(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/detachFollowerDatabases` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.FollowerDatabaseDefinition](req) @@ -507,9 +521,9 @@ func (c *ClustersServerTransport) dispatchBeginDetachFollowerDatabases(req *http return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDetachFollowerDatabases.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDetachFollowerDatabases) { c.beginDetachFollowerDatabases.remove(req) @@ -527,7 +541,7 @@ func (c *ClustersServerTransport) dispatchBeginDiagnoseVirtualNetwork(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/diagnoseVirtualNetwork` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -551,7 +565,7 @@ func (c *ClustersServerTransport) dispatchBeginDiagnoseVirtualNetwork(req *http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { c.beginDiagnoseVirtualNetwork.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -569,7 +583,7 @@ func (c *ClustersServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -585,7 +599,7 @@ func (c *ClustersServerTransport) dispatchGet(req *http.Request) (*http.Response return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Cluster, req) @@ -604,18 +618,21 @@ func (c *ClustersServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListPager(nil) newListPager = &resp c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armkusto.ClustersClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -634,7 +651,7 @@ func (c *ClustersServerTransport) dispatchNewListByResourceGroupPager(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -644,12 +661,15 @@ func (c *ClustersServerTransport) dispatchNewListByResourceGroupPager(req *http. resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armkusto.ClustersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -668,7 +688,7 @@ func (c *ClustersServerTransport) dispatchNewListCalloutPoliciesPager(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listCalloutPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -682,12 +702,15 @@ func (c *ClustersServerTransport) dispatchNewListCalloutPoliciesPager(req *http. resp := c.srv.NewListCalloutPoliciesPager(resourceGroupNameParam, clusterNameParam, nil) newListCalloutPoliciesPager = &resp c.newListCalloutPoliciesPager.add(req, newListCalloutPoliciesPager) + server.PagerResponderInjectNextLinks(newListCalloutPoliciesPager, req, func(page *armkusto.ClustersClientListCalloutPoliciesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListCalloutPoliciesPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListCalloutPoliciesPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -706,7 +729,7 @@ func (c *ClustersServerTransport) dispatchNewListFollowerDatabasesPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listFollowerDatabases` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -720,12 +743,15 @@ func (c *ClustersServerTransport) dispatchNewListFollowerDatabasesPager(req *htt resp := c.srv.NewListFollowerDatabasesPager(resourceGroupNameParam, clusterNameParam, nil) newListFollowerDatabasesPager = &resp c.newListFollowerDatabasesPager.add(req, newListFollowerDatabasesPager) + server.PagerResponderInjectNextLinks(newListFollowerDatabasesPager, req, func(page *armkusto.ClustersClientListFollowerDatabasesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListFollowerDatabasesPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListFollowerDatabasesPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -744,7 +770,7 @@ func (c *ClustersServerTransport) dispatchNewListFollowerDatabasesGetPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listFollowerDatabases` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -758,12 +784,15 @@ func (c *ClustersServerTransport) dispatchNewListFollowerDatabasesGetPager(req * resp := c.srv.NewListFollowerDatabasesGetPager(resourceGroupNameParam, clusterNameParam, nil) newListFollowerDatabasesGetPager = &resp c.newListFollowerDatabasesGetPager.add(req, newListFollowerDatabasesGetPager) + server.PagerResponderInjectNextLinks(newListFollowerDatabasesGetPager, req, func(page *armkusto.ClustersClientListFollowerDatabasesGetResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListFollowerDatabasesGetPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListFollowerDatabasesGetPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -782,7 +811,7 @@ func (c *ClustersServerTransport) dispatchNewListLanguageExtensionsPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listLanguageExtensions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -796,12 +825,15 @@ func (c *ClustersServerTransport) dispatchNewListLanguageExtensionsPager(req *ht resp := c.srv.NewListLanguageExtensionsPager(resourceGroupNameParam, clusterNameParam, nil) newListLanguageExtensionsPager = &resp c.newListLanguageExtensionsPager.add(req, newListLanguageExtensionsPager) + server.PagerResponderInjectNextLinks(newListLanguageExtensionsPager, req, func(page *armkusto.ClustersClientListLanguageExtensionsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListLanguageExtensionsPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListLanguageExtensionsPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -820,7 +852,7 @@ func (c *ClustersServerTransport) dispatchNewListOutboundNetworkDependenciesEndp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/outboundNetworkDependenciesEndpoints` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -842,7 +874,7 @@ func (c *ClustersServerTransport) dispatchNewListOutboundNetworkDependenciesEndp if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListOutboundNetworkDependenciesEndpointsPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -861,18 +893,21 @@ func (c *ClustersServerTransport) dispatchNewListSKUsPager(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/skus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListSKUsPager(nil) newListSKUsPager = &resp c.newListSKUsPager.add(req, newListSKUsPager) + server.PagerResponderInjectNextLinks(newListSKUsPager, req, func(page *armkusto.ClustersClientListSKUsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListSKUsPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListSKUsPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -891,7 +926,7 @@ func (c *ClustersServerTransport) dispatchNewListSKUsByResourcePager(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -905,12 +940,15 @@ func (c *ClustersServerTransport) dispatchNewListSKUsByResourcePager(req *http.R resp := c.srv.NewListSKUsByResourcePager(resourceGroupNameParam, clusterNameParam, nil) newListSKUsByResourcePager = &resp c.newListSKUsByResourcePager.add(req, newListSKUsByResourcePager) + server.PagerResponderInjectNextLinks(newListSKUsByResourcePager, req, func(page *armkusto.ClustersClientListSKUsByResourceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListSKUsByResourcePager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListSKUsByResourcePager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -929,7 +967,7 @@ func (c *ClustersServerTransport) dispatchBeginMigrate(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/migrate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ClusterMigrateRequest](req) @@ -957,9 +995,9 @@ func (c *ClustersServerTransport) dispatchBeginMigrate(req *http.Request) (*http return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginMigrate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginMigrate) { c.beginMigrate.remove(req) @@ -977,7 +1015,7 @@ func (c *ClustersServerTransport) dispatchBeginRemoveCalloutPolicy(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/removeCalloutPolicy` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.CalloutPolicyToRemove](req) @@ -1005,9 +1043,9 @@ func (c *ClustersServerTransport) dispatchBeginRemoveCalloutPolicy(req *http.Req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginRemoveCalloutPolicy.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRemoveCalloutPolicy) { c.beginRemoveCalloutPolicy.remove(req) @@ -1025,7 +1063,7 @@ func (c *ClustersServerTransport) dispatchBeginRemoveLanguageExtensions(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/removeLanguageExtensions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.LanguageExtensionsList](req) @@ -1053,9 +1091,9 @@ func (c *ClustersServerTransport) dispatchBeginRemoveLanguageExtensions(req *htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginRemoveLanguageExtensions.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRemoveLanguageExtensions) { c.beginRemoveLanguageExtensions.remove(req) @@ -1073,7 +1111,7 @@ func (c *ClustersServerTransport) dispatchBeginStart(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -1097,9 +1135,9 @@ func (c *ClustersServerTransport) dispatchBeginStart(req *http.Request) (*http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginStart.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginStart) { c.beginStart.remove(req) @@ -1117,7 +1155,7 @@ func (c *ClustersServerTransport) dispatchBeginStop(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -1141,9 +1179,9 @@ func (c *ClustersServerTransport) dispatchBeginStop(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginStop.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginStop) { c.beginStop.remove(req) @@ -1161,7 +1199,7 @@ func (c *ClustersServerTransport) dispatchBeginUpdate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ClusterUpdate](req) @@ -1196,7 +1234,7 @@ func (c *ClustersServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { c.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -1206,3 +1244,9 @@ func (c *ClustersServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return resp, nil } + +// set this to conditionally intercept incoming requests to ClustersServerTransport +var clustersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/database_server.go b/sdk/resourcemanager/kusto/armkusto/fake/database_server.go index 7fc7861f1271..97367857f7c3 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/database_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/database_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // DatabaseServer is a fake server for instances of the armkusto.DatabaseClient type. @@ -46,21 +46,35 @@ func (d *DatabaseServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DatabaseClient.InviteFollower": - resp, err = d.dispatchInviteFollower(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DatabaseServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if databaseServerTransportInterceptor != nil { + res.resp, res.err, intercepted = databaseServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DatabaseClient.InviteFollower": + res.resp, res.err = d.dispatchInviteFollower(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DatabaseServerTransport) dispatchInviteFollower(req *http.Request) (*http.Response, error) { @@ -70,7 +84,7 @@ func (d *DatabaseServerTransport) dispatchInviteFollower(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inviteFollower` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.DatabaseInviteFollowerRequest](req) @@ -94,7 +108,7 @@ func (d *DatabaseServerTransport) dispatchInviteFollower(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DatabaseInviteFollowerResult, req) @@ -103,3 +117,9 @@ func (d *DatabaseServerTransport) dispatchInviteFollower(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to DatabaseServerTransport +var databaseServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/databaseprincipalassignments_server.go b/sdk/resourcemanager/kusto/armkusto/fake/databaseprincipalassignments_server.go index d7335fcaddfb..19bb8e898a7a 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/databaseprincipalassignments_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/databaseprincipalassignments_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // DatabasePrincipalAssignmentsServer is a fake server for instances of the armkusto.DatabasePrincipalAssignmentsClient type. @@ -70,29 +71,43 @@ func (d *DatabasePrincipalAssignmentsServerTransport) Do(req *http.Request) (*ht return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DatabasePrincipalAssignmentsClient.CheckNameAvailability": - resp, err = d.dispatchCheckNameAvailability(req) - case "DatabasePrincipalAssignmentsClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DatabasePrincipalAssignmentsClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DatabasePrincipalAssignmentsClient.Get": - resp, err = d.dispatchGet(req) - case "DatabasePrincipalAssignmentsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DatabasePrincipalAssignmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if databasePrincipalAssignmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = databasePrincipalAssignmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DatabasePrincipalAssignmentsClient.CheckNameAvailability": + res.resp, res.err = d.dispatchCheckNameAvailability(req) + case "DatabasePrincipalAssignmentsClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DatabasePrincipalAssignmentsClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DatabasePrincipalAssignmentsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DatabasePrincipalAssignmentsClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DatabasePrincipalAssignmentsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -102,7 +117,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchCheckNameAvailabil const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkPrincipalAssignmentNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.DatabasePrincipalAssignmentCheckNameRequest](req) @@ -126,7 +141,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchCheckNameAvailabil return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -145,7 +160,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchBeginCreateOrUpdat const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/principalAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.DatabasePrincipalAssignment](req) @@ -181,7 +196,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchBeginCreateOrUpdat return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { d.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -201,7 +216,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchBeginDelete(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/principalAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -233,7 +248,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchBeginDelete(req *h return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -251,7 +266,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchGet(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/principalAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -275,7 +290,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchGet(req *http.Requ return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DatabasePrincipalAssignment, req) @@ -294,7 +309,7 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchNewListPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/principalAssignments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -312,12 +327,15 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchNewListPager(req * resp := d.srv.NewListPager(resourceGroupNameParam, clusterNameParam, databaseNameParam, nil) newListPager = &resp d.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armkusto.DatabasePrincipalAssignmentsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -326,3 +344,9 @@ func (d *DatabasePrincipalAssignmentsServerTransport) dispatchNewListPager(req * } return resp, nil } + +// set this to conditionally intercept incoming requests to DatabasePrincipalAssignmentsServerTransport +var databasePrincipalAssignmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/databases_server.go b/sdk/resourcemanager/kusto/armkusto/fake/databases_server.go index f0c2c9226c25..26409b430791 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/databases_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/databases_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" "strconv" ) @@ -92,37 +92,51 @@ func (d *DatabasesServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "DatabasesClient.AddPrincipals": - resp, err = d.dispatchAddPrincipals(req) - case "DatabasesClient.CheckNameAvailability": - resp, err = d.dispatchCheckNameAvailability(req) - case "DatabasesClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DatabasesClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DatabasesClient.Get": - resp, err = d.dispatchGet(req) - case "DatabasesClient.NewListByClusterPager": - resp, err = d.dispatchNewListByClusterPager(req) - case "DatabasesClient.NewListPrincipalsPager": - resp, err = d.dispatchNewListPrincipalsPager(req) - case "DatabasesClient.RemovePrincipals": - resp, err = d.dispatchRemovePrincipals(req) - case "DatabasesClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return d.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (d *DatabasesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if databasesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = databasesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DatabasesClient.AddPrincipals": + res.resp, res.err = d.dispatchAddPrincipals(req) + case "DatabasesClient.CheckNameAvailability": + res.resp, res.err = d.dispatchCheckNameAvailability(req) + case "DatabasesClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DatabasesClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DatabasesClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DatabasesClient.NewListByClusterPager": + res.resp, res.err = d.dispatchNewListByClusterPager(req) + case "DatabasesClient.NewListPrincipalsPager": + res.resp, res.err = d.dispatchNewListPrincipalsPager(req) + case "DatabasesClient.RemovePrincipals": + res.resp, res.err = d.dispatchRemovePrincipals(req) + case "DatabasesClient.BeginUpdate": + res.resp, res.err = d.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DatabasesServerTransport) dispatchAddPrincipals(req *http.Request) (*http.Response, error) { @@ -132,7 +146,7 @@ func (d *DatabasesServerTransport) dispatchAddPrincipals(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/addPrincipals` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.DatabasePrincipalListRequest](req) @@ -156,7 +170,7 @@ func (d *DatabasesServerTransport) dispatchAddPrincipals(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DatabasePrincipalListResult, req) @@ -173,7 +187,7 @@ func (d *DatabasesServerTransport) dispatchCheckNameAvailability(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.CheckNameRequest](req) @@ -193,7 +207,7 @@ func (d *DatabasesServerTransport) dispatchCheckNameAvailability(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -212,7 +226,7 @@ func (d *DatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -236,11 +250,7 @@ func (d *DatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request if err != nil { return nil, err } - callerRoleUnescaped, err := url.QueryUnescape(qp.Get("callerRole")) - if err != nil { - return nil, err - } - callerRoleParam := getOptional(armkusto.CallerRole(callerRoleUnescaped)) + callerRoleParam := getOptional(armkusto.CallerRole(qp.Get("callerRole"))) var options *armkusto.DatabasesClientBeginCreateOrUpdateOptions if callerRoleParam != nil { options = &armkusto.DatabasesClientBeginCreateOrUpdateOptions{ @@ -260,7 +270,7 @@ func (d *DatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { d.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -280,7 +290,7 @@ func (d *DatabasesServerTransport) dispatchBeginDelete(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -308,7 +318,7 @@ func (d *DatabasesServerTransport) dispatchBeginDelete(req *http.Request) (*http return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -326,7 +336,7 @@ func (d *DatabasesServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -346,7 +356,7 @@ func (d *DatabasesServerTransport) dispatchGet(req *http.Request) (*http.Respons return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DatabaseClassification, req) @@ -365,7 +375,7 @@ func (d *DatabasesServerTransport) dispatchNewListByClusterPager(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -377,11 +387,7 @@ func (d *DatabasesServerTransport) dispatchNewListByClusterPager(req *http.Reque if err != nil { return nil, err } - topUnescaped, err := url.QueryUnescape(qp.Get("$top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + topParam, err := parseOptional(qp.Get("$top"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -391,11 +397,7 @@ func (d *DatabasesServerTransport) dispatchNewListByClusterPager(req *http.Reque if err != nil { return nil, err } - skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) - if err != nil { - return nil, err - } - skiptokenParam := getOptional(skiptokenUnescaped) + skiptokenParam := getOptional(qp.Get("$skiptoken")) var options *armkusto.DatabasesClientListByClusterOptions if topParam != nil || skiptokenParam != nil { options = &armkusto.DatabasesClientListByClusterOptions{ @@ -414,7 +416,7 @@ func (d *DatabasesServerTransport) dispatchNewListByClusterPager(req *http.Reque if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListByClusterPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -433,7 +435,7 @@ func (d *DatabasesServerTransport) dispatchNewListPrincipalsPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listPrincipals` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -451,12 +453,15 @@ func (d *DatabasesServerTransport) dispatchNewListPrincipalsPager(req *http.Requ resp := d.srv.NewListPrincipalsPager(resourceGroupNameParam, clusterNameParam, databaseNameParam, nil) newListPrincipalsPager = &resp d.newListPrincipalsPager.add(req, newListPrincipalsPager) + server.PagerResponderInjectNextLinks(newListPrincipalsPager, req, func(page *armkusto.DatabasesClientListPrincipalsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPrincipalsPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListPrincipalsPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -473,7 +478,7 @@ func (d *DatabasesServerTransport) dispatchRemovePrincipals(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/removePrincipals` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.DatabasePrincipalListRequest](req) @@ -497,7 +502,7 @@ func (d *DatabasesServerTransport) dispatchRemovePrincipals(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DatabasePrincipalListResult, req) @@ -516,7 +521,7 @@ func (d *DatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -540,11 +545,7 @@ func (d *DatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http if err != nil { return nil, err } - callerRoleUnescaped, err := url.QueryUnescape(qp.Get("callerRole")) - if err != nil { - return nil, err - } - callerRoleParam := getOptional(armkusto.CallerRole(callerRoleUnescaped)) + callerRoleParam := getOptional(armkusto.CallerRole(qp.Get("callerRole"))) var options *armkusto.DatabasesClientBeginUpdateOptions if callerRoleParam != nil { options = &armkusto.DatabasesClientBeginUpdateOptions{ @@ -564,7 +565,7 @@ func (d *DatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { d.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -574,3 +575,9 @@ func (d *DatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http return resp, nil } + +// set this to conditionally intercept incoming requests to DatabasesServerTransport +var databasesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/dataconnections_server.go b/sdk/resourcemanager/kusto/armkusto/fake/dataconnections_server.go index c1f5f7da1d74..d3d37dd20c18 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/dataconnections_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/dataconnections_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // DataConnectionsServer is a fake server for instances of the armkusto.DataConnectionsClient type. @@ -82,33 +83,47 @@ func (d *DataConnectionsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "DataConnectionsClient.CheckNameAvailability": - resp, err = d.dispatchCheckNameAvailability(req) - case "DataConnectionsClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DataConnectionsClient.BeginDataConnectionValidation": - resp, err = d.dispatchBeginDataConnectionValidation(req) - case "DataConnectionsClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DataConnectionsClient.Get": - resp, err = d.dispatchGet(req) - case "DataConnectionsClient.NewListByDatabasePager": - resp, err = d.dispatchNewListByDatabasePager(req) - case "DataConnectionsClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return d.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err +func (d *DataConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if dataConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dataConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DataConnectionsClient.CheckNameAvailability": + res.resp, res.err = d.dispatchCheckNameAvailability(req) + case "DataConnectionsClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DataConnectionsClient.BeginDataConnectionValidation": + res.resp, res.err = d.dispatchBeginDataConnectionValidation(req) + case "DataConnectionsClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DataConnectionsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DataConnectionsClient.NewListByDatabasePager": + res.resp, res.err = d.dispatchNewListByDatabasePager(req) + case "DataConnectionsClient.BeginUpdate": + res.resp, res.err = d.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err } - - return resp, nil } func (d *DataConnectionsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -118,7 +133,7 @@ func (d *DataConnectionsServerTransport) dispatchCheckNameAvailability(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.DataConnectionCheckNameRequest](req) @@ -142,7 +157,7 @@ func (d *DataConnectionsServerTransport) dispatchCheckNameAvailability(req *http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -161,7 +176,7 @@ func (d *DataConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } raw, err := readRequestBody(req) @@ -201,7 +216,7 @@ func (d *DataConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { d.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -221,7 +236,7 @@ func (d *DataConnectionsServerTransport) dispatchBeginDataConnectionValidation(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataConnectionValidation` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.DataConnectionValidation](req) @@ -253,7 +268,7 @@ func (d *DataConnectionsServerTransport) dispatchBeginDataConnectionValidation(r return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { d.beginDataConnectionValidation.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -273,7 +288,7 @@ func (d *DataConnectionsServerTransport) dispatchBeginDelete(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -305,7 +320,7 @@ func (d *DataConnectionsServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -323,7 +338,7 @@ func (d *DataConnectionsServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -347,7 +362,7 @@ func (d *DataConnectionsServerTransport) dispatchGet(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataConnectionClassification, req) @@ -366,7 +381,7 @@ func (d *DataConnectionsServerTransport) dispatchNewListByDatabasePager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataConnections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -384,12 +399,15 @@ func (d *DataConnectionsServerTransport) dispatchNewListByDatabasePager(req *htt resp := d.srv.NewListByDatabasePager(resourceGroupNameParam, clusterNameParam, databaseNameParam, nil) newListByDatabasePager = &resp d.newListByDatabasePager.add(req, newListByDatabasePager) + server.PagerResponderInjectNextLinks(newListByDatabasePager, req, func(page *armkusto.DataConnectionsClientListByDatabaseResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByDatabasePager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListByDatabasePager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -408,7 +426,7 @@ func (d *DataConnectionsServerTransport) dispatchBeginUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } raw, err := readRequestBody(req) @@ -448,7 +466,7 @@ func (d *DataConnectionsServerTransport) dispatchBeginUpdate(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { d.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -458,3 +476,9 @@ func (d *DataConnectionsServerTransport) dispatchBeginUpdate(req *http.Request) return resp, nil } + +// set this to conditionally intercept incoming requests to DataConnectionsServerTransport +var dataConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/internal.go b/sdk/resourcemanager/kusto/armkusto/fake/internal.go index 0b16b54c9d56..f09fd1b96bd8 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/internal.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/internal.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -21,15 +25,6 @@ func (nonRetriableError) NonRetriable() { // marker method } -func contains[T comparable](s []T, v T) bool { - for _, vv := range s { - if vv == v { - return true - } - } - return false -} - func getHeaderValue(h http.Header, k string) string { v := h[k] if len(v) == 0 { @@ -45,6 +40,14 @@ func getOptional[T any](v T) *T { return &v } +func initServer[T any](mu *sync.Mutex, dst **T, src func() *T) { + mu.Lock() + if *dst == nil { + *dst = src() + } + mu.Unlock() +} + func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { if v == "" { return nil, nil @@ -53,7 +56,7 @@ func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) if err != nil { return nil, err } - return &t, err + return &t, nil } func readRequestBody(req *http.Request) ([]byte, error) { diff --git a/sdk/resourcemanager/kusto/armkusto/fake/managedprivateendpoints_server.go b/sdk/resourcemanager/kusto/armkusto/fake/managedprivateendpoints_server.go index 732c105c09ea..e0ffedd08df8 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/managedprivateendpoints_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/managedprivateendpoints_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // ManagedPrivateEndpointsServer is a fake server for instances of the armkusto.ManagedPrivateEndpointsClient type. @@ -76,31 +77,45 @@ func (m *ManagedPrivateEndpointsServerTransport) Do(req *http.Request) (*http.Re return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - switch method { - case "ManagedPrivateEndpointsClient.CheckNameAvailability": - resp, err = m.dispatchCheckNameAvailability(req) - case "ManagedPrivateEndpointsClient.BeginCreateOrUpdate": - resp, err = m.dispatchBeginCreateOrUpdate(req) - case "ManagedPrivateEndpointsClient.BeginDelete": - resp, err = m.dispatchBeginDelete(req) - case "ManagedPrivateEndpointsClient.Get": - resp, err = m.dispatchGet(req) - case "ManagedPrivateEndpointsClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - case "ManagedPrivateEndpointsClient.BeginUpdate": - resp, err = m.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (m *ManagedPrivateEndpointsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if managedPrivateEndpointsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = managedPrivateEndpointsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ManagedPrivateEndpointsClient.CheckNameAvailability": + res.resp, res.err = m.dispatchCheckNameAvailability(req) + case "ManagedPrivateEndpointsClient.BeginCreateOrUpdate": + res.resp, res.err = m.dispatchBeginCreateOrUpdate(req) + case "ManagedPrivateEndpointsClient.BeginDelete": + res.resp, res.err = m.dispatchBeginDelete(req) + case "ManagedPrivateEndpointsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "ManagedPrivateEndpointsClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + case "ManagedPrivateEndpointsClient.BeginUpdate": + res.resp, res.err = m.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *ManagedPrivateEndpointsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -110,7 +125,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchCheckNameAvailability(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpointsCheckNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ManagedPrivateEndpointsCheckNameRequest](req) @@ -130,7 +145,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchCheckNameAvailability(r return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -149,7 +164,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginCreateOrUpdate(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ManagedPrivateEndpoint](req) @@ -181,7 +196,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginCreateOrUpdate(req return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { m.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -201,7 +216,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginDelete(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -229,7 +244,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginDelete(req *http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { m.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -247,7 +262,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchGet(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -267,7 +282,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchGet(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ManagedPrivateEndpoint, req) @@ -286,7 +301,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchNewListPager(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -300,12 +315,15 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchNewListPager(req *http. resp := m.srv.NewListPager(resourceGroupNameParam, clusterNameParam, nil) newListPager = &resp m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armkusto.ManagedPrivateEndpointsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { m.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -324,7 +342,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginUpdate(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/managedPrivateEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ManagedPrivateEndpoint](req) @@ -356,7 +374,7 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginUpdate(req *http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { m.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -366,3 +384,9 @@ func (m *ManagedPrivateEndpointsServerTransport) dispatchBeginUpdate(req *http.R return resp, nil } + +// set this to conditionally intercept incoming requests to ManagedPrivateEndpointsServerTransport +var managedPrivateEndpointsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/operations_server.go b/sdk/resourcemanager/kusto/armkusto/fake/operations_server.go index 3a6903fe1c8a..cc5d5e3005c7 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/operations_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/operations_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" + "slices" ) // OperationsServer is a fake server for instances of the armkusto.OperationsClient type. @@ -48,21 +48,35 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -82,7 +96,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { o.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -91,3 +105,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/operationsresults_server.go b/sdk/resourcemanager/kusto/armkusto/fake/operationsresults_server.go index 885a5157e669..57e3bc534c90 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/operationsresults_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/operationsresults_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // OperationsResultsServer is a fake server for instances of the armkusto.OperationsResultsClient type. @@ -46,21 +46,35 @@ func (o *OperationsResultsServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsResultsClient.Get": - resp, err = o.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsResultsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if operationsResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsResultsClient.Get": + res.resp, res.err = o.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -70,7 +84,7 @@ func (o *OperationsResultsServerTransport) dispatchGet(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -86,7 +100,7 @@ func (o *OperationsResultsServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationResult, req) @@ -95,3 +109,9 @@ func (o *OperationsResultsServerTransport) dispatchGet(req *http.Request) (*http } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsResultsServerTransport +var operationsResultsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/operationsresultslocation_server.go b/sdk/resourcemanager/kusto/armkusto/fake/operationsresultslocation_server.go index 85745bb92ba6..862641007e28 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/operationsresultslocation_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/operationsresultslocation_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // OperationsResultsLocationServer is a fake server for instances of the armkusto.OperationsResultsLocationClient type. @@ -46,31 +46,45 @@ func (o *OperationsResultsLocationServerTransport) Do(req *http.Request) (*http. return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsResultsLocationClient.Get": - resp, err = o.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsResultsLocationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if operationsResultsLocationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsResultsLocationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsResultsLocationClient.Get": + res.resp, res.err = o.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsResultsLocationServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if o.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)?operationResultResponseType=Location` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -86,7 +100,7 @@ func (o *OperationsResultsLocationServerTransport) dispatchGet(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -98,3 +112,9 @@ func (o *OperationsResultsLocationServerTransport) dispatchGet(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsResultsLocationServerTransport +var operationsResultsLocationServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/polymorphic_helpers.go b/sdk/resourcemanager/kusto/armkusto/fake/polymorphic_helpers.go index fecf592ca7bd..ffa309583d9e 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/polymorphic_helpers.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/polymorphic_helpers.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -24,8 +23,12 @@ func unmarshalDataConnectionClassification(rawMsg json.RawMessage) (armkusto.Dat b = &armkusto.CosmosDbDataConnection{} case string(armkusto.DataConnectionKindEventGrid): b = &armkusto.EventGridDataConnection{} + case string(armkusto.DataConnectionKindEventGridWithManagedIdentity): + b = &armkusto.EventGridDataConnectionWithManagedIdentity{} case string(armkusto.DataConnectionKindEventHub): b = &armkusto.EventHubDataConnection{} + case string(armkusto.DataConnectionKindEventHubWithManagedIdentity): + b = &armkusto.EventHubDataConnectionWithManagedIdentity{} case string(armkusto.DataConnectionKindIotHub): b = &armkusto.IotHubDataConnection{} default: diff --git a/sdk/resourcemanager/kusto/armkusto/fake/privateendpointconnections_server.go b/sdk/resourcemanager/kusto/armkusto/fake/privateendpointconnections_server.go index e18981764a64..002926a51469 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/privateendpointconnections_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // PrivateEndpointConnectionsServer is a fake server for instances of the armkusto.PrivateEndpointConnectionsClient type. @@ -66,27 +67,41 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -98,7 +113,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.PrivateEndpointConnection](req) @@ -130,7 +145,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate( return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { p.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -150,7 +165,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -178,7 +193,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -196,7 +211,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -216,7 +231,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) @@ -235,7 +250,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -249,12 +264,15 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *ht resp := p.srv.NewListPager(resourceGroupNameParam, clusterNameParam, nil) newListPager = &resp p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armkusto.PrivateEndpointConnectionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { p.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -263,3 +281,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *ht } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/privatelinkresources_server.go b/sdk/resourcemanager/kusto/armkusto/fake/privatelinkresources_server.go index 011ae8363240..601debc618ae 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/privatelinkresources_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // PrivateLinkResourcesServer is a fake server for instances of the armkusto.PrivateLinkResourcesClient type. @@ -54,23 +55,37 @@ func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateLinkResourcesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkResourcesClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkResourcesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -80,7 +95,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -100,7 +115,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) @@ -119,7 +134,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -133,12 +148,15 @@ func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Req resp := p.srv.NewListPager(resourceGroupNameParam, clusterNameParam, nil) newListPager = &resp p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armkusto.PrivateLinkResourcesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { p.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -147,3 +165,9 @@ func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/sandboxcustomimages_server.go b/sdk/resourcemanager/kusto/armkusto/fake/sandboxcustomimages_server.go index 5aa5bf0d991e..65ee1360e181 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/sandboxcustomimages_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/sandboxcustomimages_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // SandboxCustomImagesServer is a fake server for instances of the armkusto.SandboxCustomImagesClient type. @@ -76,31 +77,45 @@ func (s *SandboxCustomImagesServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SandboxCustomImagesClient.CheckNameAvailability": - resp, err = s.dispatchCheckNameAvailability(req) - case "SandboxCustomImagesClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "SandboxCustomImagesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SandboxCustomImagesClient.Get": - resp, err = s.dispatchGet(req) - case "SandboxCustomImagesClient.NewListByClusterPager": - resp, err = s.dispatchNewListByClusterPager(req) - case "SandboxCustomImagesClient.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SandboxCustomImagesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if sandboxCustomImagesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sandboxCustomImagesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SandboxCustomImagesClient.CheckNameAvailability": + res.resp, res.err = s.dispatchCheckNameAvailability(req) + case "SandboxCustomImagesClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SandboxCustomImagesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SandboxCustomImagesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SandboxCustomImagesClient.NewListByClusterPager": + res.resp, res.err = s.dispatchNewListByClusterPager(req) + case "SandboxCustomImagesClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SandboxCustomImagesServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -110,7 +125,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchCheckNameAvailability(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sandboxCustomImagesCheckNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.SandboxCustomImagesCheckNameRequest](req) @@ -130,7 +145,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchCheckNameAvailability(req * return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -149,7 +164,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchBeginCreateOrUpdate(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sandboxCustomImages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.SandboxCustomImage](req) @@ -181,7 +196,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchBeginCreateOrUpdate(req *ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { s.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -201,7 +216,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchBeginDelete(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sandboxCustomImages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -229,7 +244,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -247,7 +262,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sandboxCustomImages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -267,7 +282,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchGet(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SandboxCustomImage, req) @@ -286,7 +301,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchNewListByClusterPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sandboxCustomImages` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -300,12 +315,15 @@ func (s *SandboxCustomImagesServerTransport) dispatchNewListByClusterPager(req * resp := s.srv.NewListByClusterPager(resourceGroupNameParam, clusterNameParam, nil) newListByClusterPager = &resp s.newListByClusterPager.add(req, newListByClusterPager) + server.PagerResponderInjectNextLinks(newListByClusterPager, req, func(page *armkusto.SandboxCustomImagesClientListByClusterResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByClusterPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListByClusterPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -324,7 +342,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchBeginUpdate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sandboxCustomImages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.SandboxCustomImage](req) @@ -356,7 +374,7 @@ func (s *SandboxCustomImagesServerTransport) dispatchBeginUpdate(req *http.Reque return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { s.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -366,3 +384,9 @@ func (s *SandboxCustomImagesServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to SandboxCustomImagesServerTransport +var sandboxCustomImagesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/scripts_server.go b/sdk/resourcemanager/kusto/armkusto/fake/scripts_server.go index 808deafa4ec4..1834d3ad02a2 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/scripts_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/scripts_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,10 +11,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // ScriptsServer is a fake server for instances of the armkusto.ScriptsClient type. @@ -76,31 +77,45 @@ func (s *ScriptsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScriptsClient.CheckNameAvailability": - resp, err = s.dispatchCheckNameAvailability(req) - case "ScriptsClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "ScriptsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "ScriptsClient.Get": - resp, err = s.dispatchGet(req) - case "ScriptsClient.NewListByDatabasePager": - resp, err = s.dispatchNewListByDatabasePager(req) - case "ScriptsClient.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScriptsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if scriptsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scriptsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScriptsClient.CheckNameAvailability": + res.resp, res.err = s.dispatchCheckNameAvailability(req) + case "ScriptsClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "ScriptsClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "ScriptsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ScriptsClient.NewListByDatabasePager": + res.resp, res.err = s.dispatchNewListByDatabasePager(req) + case "ScriptsClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ScriptsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -110,7 +125,7 @@ func (s *ScriptsServerTransport) dispatchCheckNameAvailability(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scriptsCheckNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.ScriptCheckNameRequest](req) @@ -134,7 +149,7 @@ func (s *ScriptsServerTransport) dispatchCheckNameAvailability(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameResult, req) @@ -153,7 +168,7 @@ func (s *ScriptsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scripts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.Script](req) @@ -189,7 +204,7 @@ func (s *ScriptsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { s.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -209,7 +224,7 @@ func (s *ScriptsServerTransport) dispatchBeginDelete(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scripts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -241,7 +256,7 @@ func (s *ScriptsServerTransport) dispatchBeginDelete(req *http.Request) (*http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -259,7 +274,7 @@ func (s *ScriptsServerTransport) dispatchGet(req *http.Request) (*http.Response, const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scripts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -283,7 +298,7 @@ func (s *ScriptsServerTransport) dispatchGet(req *http.Request) (*http.Response, return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Script, req) @@ -302,7 +317,7 @@ func (s *ScriptsServerTransport) dispatchNewListByDatabasePager(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scripts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -320,12 +335,15 @@ func (s *ScriptsServerTransport) dispatchNewListByDatabasePager(req *http.Reques resp := s.srv.NewListByDatabasePager(resourceGroupNameParam, clusterNameParam, databaseNameParam, nil) newListByDatabasePager = &resp s.newListByDatabasePager.add(req, newListByDatabasePager) + server.PagerResponderInjectNextLinks(newListByDatabasePager, req, func(page *armkusto.ScriptsClientListByDatabaseResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListByDatabasePager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListByDatabasePager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -344,7 +362,7 @@ func (s *ScriptsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/clusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scripts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armkusto.Script](req) @@ -380,7 +398,7 @@ func (s *ScriptsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { s.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -390,3 +408,9 @@ func (s *ScriptsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.R return resp, nil } + +// set this to conditionally intercept incoming requests to ScriptsServerTransport +var scriptsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/server_factory.go b/sdk/resourcemanager/kusto/armkusto/fake/server_factory.go index abbd79fe6d3b..8fffba22b41c 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/server_factory.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/server_factory.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,22 +15,53 @@ import ( // ServerFactory is a fake server for instances of the armkusto.ClientFactory type. type ServerFactory struct { + // AttachedDatabaseConfigurationsServer contains the fakes for client AttachedDatabaseConfigurationsClient AttachedDatabaseConfigurationsServer AttachedDatabaseConfigurationsServer - ClusterPrincipalAssignmentsServer ClusterPrincipalAssignmentsServer - ClustersServer ClustersServer - DataConnectionsServer DataConnectionsServer - DatabaseServer DatabaseServer - DatabasePrincipalAssignmentsServer DatabasePrincipalAssignmentsServer - DatabasesServer DatabasesServer - ManagedPrivateEndpointsServer ManagedPrivateEndpointsServer - OperationsServer OperationsServer - OperationsResultsServer OperationsResultsServer - OperationsResultsLocationServer OperationsResultsLocationServer - PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer - SKUsServer SKUsServer - SandboxCustomImagesServer SandboxCustomImagesServer - ScriptsServer ScriptsServer + + // ClusterPrincipalAssignmentsServer contains the fakes for client ClusterPrincipalAssignmentsClient + ClusterPrincipalAssignmentsServer ClusterPrincipalAssignmentsServer + + // ClustersServer contains the fakes for client ClustersClient + ClustersServer ClustersServer + + // DataConnectionsServer contains the fakes for client DataConnectionsClient + DataConnectionsServer DataConnectionsServer + + // DatabaseServer contains the fakes for client DatabaseClient + DatabaseServer DatabaseServer + + // DatabasePrincipalAssignmentsServer contains the fakes for client DatabasePrincipalAssignmentsClient + DatabasePrincipalAssignmentsServer DatabasePrincipalAssignmentsServer + + // DatabasesServer contains the fakes for client DatabasesClient + DatabasesServer DatabasesServer + + // ManagedPrivateEndpointsServer contains the fakes for client ManagedPrivateEndpointsClient + ManagedPrivateEndpointsServer ManagedPrivateEndpointsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // OperationsResultsServer contains the fakes for client OperationsResultsClient + OperationsResultsServer OperationsResultsServer + + // OperationsResultsLocationServer contains the fakes for client OperationsResultsLocationClient + OperationsResultsLocationServer OperationsResultsLocationServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // SKUsServer contains the fakes for client SKUsClient + SKUsServer SKUsServer + + // SandboxCustomImagesServer contains the fakes for client SandboxCustomImagesClient + SandboxCustomImagesServer SandboxCustomImagesServer + + // ScriptsServer contains the fakes for client ScriptsClient + ScriptsServer ScriptsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -80,72 +110,72 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { switch client { case "AttachedDatabaseConfigurationsClient": - initServer(s, &s.trAttachedDatabaseConfigurationsServer, func() *AttachedDatabaseConfigurationsServerTransport { + initServer(&s.trMu, &s.trAttachedDatabaseConfigurationsServer, func() *AttachedDatabaseConfigurationsServerTransport { return NewAttachedDatabaseConfigurationsServerTransport(&s.srv.AttachedDatabaseConfigurationsServer) }) resp, err = s.trAttachedDatabaseConfigurationsServer.Do(req) case "ClusterPrincipalAssignmentsClient": - initServer(s, &s.trClusterPrincipalAssignmentsServer, func() *ClusterPrincipalAssignmentsServerTransport { + initServer(&s.trMu, &s.trClusterPrincipalAssignmentsServer, func() *ClusterPrincipalAssignmentsServerTransport { return NewClusterPrincipalAssignmentsServerTransport(&s.srv.ClusterPrincipalAssignmentsServer) }) resp, err = s.trClusterPrincipalAssignmentsServer.Do(req) case "ClustersClient": - initServer(s, &s.trClustersServer, func() *ClustersServerTransport { return NewClustersServerTransport(&s.srv.ClustersServer) }) + initServer(&s.trMu, &s.trClustersServer, func() *ClustersServerTransport { return NewClustersServerTransport(&s.srv.ClustersServer) }) resp, err = s.trClustersServer.Do(req) case "DataConnectionsClient": - initServer(s, &s.trDataConnectionsServer, func() *DataConnectionsServerTransport { + initServer(&s.trMu, &s.trDataConnectionsServer, func() *DataConnectionsServerTransport { return NewDataConnectionsServerTransport(&s.srv.DataConnectionsServer) }) resp, err = s.trDataConnectionsServer.Do(req) case "DatabaseClient": - initServer(s, &s.trDatabaseServer, func() *DatabaseServerTransport { return NewDatabaseServerTransport(&s.srv.DatabaseServer) }) + initServer(&s.trMu, &s.trDatabaseServer, func() *DatabaseServerTransport { return NewDatabaseServerTransport(&s.srv.DatabaseServer) }) resp, err = s.trDatabaseServer.Do(req) case "DatabasePrincipalAssignmentsClient": - initServer(s, &s.trDatabasePrincipalAssignmentsServer, func() *DatabasePrincipalAssignmentsServerTransport { + initServer(&s.trMu, &s.trDatabasePrincipalAssignmentsServer, func() *DatabasePrincipalAssignmentsServerTransport { return NewDatabasePrincipalAssignmentsServerTransport(&s.srv.DatabasePrincipalAssignmentsServer) }) resp, err = s.trDatabasePrincipalAssignmentsServer.Do(req) case "DatabasesClient": - initServer(s, &s.trDatabasesServer, func() *DatabasesServerTransport { return NewDatabasesServerTransport(&s.srv.DatabasesServer) }) + initServer(&s.trMu, &s.trDatabasesServer, func() *DatabasesServerTransport { return NewDatabasesServerTransport(&s.srv.DatabasesServer) }) resp, err = s.trDatabasesServer.Do(req) case "ManagedPrivateEndpointsClient": - initServer(s, &s.trManagedPrivateEndpointsServer, func() *ManagedPrivateEndpointsServerTransport { + initServer(&s.trMu, &s.trManagedPrivateEndpointsServer, func() *ManagedPrivateEndpointsServerTransport { return NewManagedPrivateEndpointsServerTransport(&s.srv.ManagedPrivateEndpointsServer) }) resp, err = s.trManagedPrivateEndpointsServer.Do(req) case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + initServer(&s.trMu, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) case "OperationsResultsClient": - initServer(s, &s.trOperationsResultsServer, func() *OperationsResultsServerTransport { + initServer(&s.trMu, &s.trOperationsResultsServer, func() *OperationsResultsServerTransport { return NewOperationsResultsServerTransport(&s.srv.OperationsResultsServer) }) resp, err = s.trOperationsResultsServer.Do(req) case "OperationsResultsLocationClient": - initServer(s, &s.trOperationsResultsLocationServer, func() *OperationsResultsLocationServerTransport { + initServer(&s.trMu, &s.trOperationsResultsLocationServer, func() *OperationsResultsLocationServerTransport { return NewOperationsResultsLocationServerTransport(&s.srv.OperationsResultsLocationServer) }) resp, err = s.trOperationsResultsLocationServer.Do(req) case "PrivateEndpointConnectionsClient": - initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + initServer(&s.trMu, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) }) resp, err = s.trPrivateEndpointConnectionsServer.Do(req) case "PrivateLinkResourcesClient": - initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + initServer(&s.trMu, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) case "SKUsClient": - initServer(s, &s.trSKUsServer, func() *SKUsServerTransport { return NewSKUsServerTransport(&s.srv.SKUsServer) }) + initServer(&s.trMu, &s.trSKUsServer, func() *SKUsServerTransport { return NewSKUsServerTransport(&s.srv.SKUsServer) }) resp, err = s.trSKUsServer.Do(req) case "SandboxCustomImagesClient": - initServer(s, &s.trSandboxCustomImagesServer, func() *SandboxCustomImagesServerTransport { + initServer(&s.trMu, &s.trSandboxCustomImagesServer, func() *SandboxCustomImagesServerTransport { return NewSandboxCustomImagesServerTransport(&s.srv.SandboxCustomImagesServer) }) resp, err = s.trSandboxCustomImagesServer.Do(req) case "ScriptsClient": - initServer(s, &s.trScriptsServer, func() *ScriptsServerTransport { return NewScriptsServerTransport(&s.srv.ScriptsServer) }) + initServer(&s.trMu, &s.trScriptsServer, func() *ScriptsServerTransport { return NewScriptsServerTransport(&s.srv.ScriptsServer) }) resp, err = s.trScriptsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) @@ -157,11 +187,3 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return resp, nil } - -func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { - s.trMu.Lock() - if *dst == nil { - *dst = src() - } - s.trMu.Unlock() -} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/skus_server.go b/sdk/resourcemanager/kusto/armkusto/fake/skus_server.go index 61959284ce92..88ff62856c2b 100644 --- a/sdk/resourcemanager/kusto/armkusto/fake/skus_server.go +++ b/sdk/resourcemanager/kusto/armkusto/fake/skus_server.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -11,10 +10,12 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2" "net/http" "net/url" "regexp" + "slices" ) // SKUsServer is a fake server for instances of the armkusto.SKUsClient type. @@ -49,21 +50,35 @@ func (s *SKUsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SKUsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SKUsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if skUsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = skUsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SKUsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SKUsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -75,7 +90,7 @@ func (s *SKUsServerTransport) dispatchNewListPager(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Kusto/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -85,12 +100,15 @@ func (s *SKUsServerTransport) dispatchNewListPager(req *http.Request) (*http.Res resp := s.srv.NewListPager(locationParam, nil) newListPager = &resp s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armkusto.SKUsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) } resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -99,3 +117,9 @@ func (s *SKUsServerTransport) dispatchNewListPager(req *http.Request) (*http.Res } return resp, nil } + +// set this to conditionally intercept incoming requests to SKUsServerTransport +var skUsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/kusto/armkusto/fake/time_rfc3339.go b/sdk/resourcemanager/kusto/armkusto/fake/time_rfc3339.go deleted file mode 100644 index 48727835bf70..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/fake/time_rfc3339.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/kusto/armkusto/go.mod b/sdk/resourcemanager/kusto/armkusto/go.mod index a6b55645a267..24517d1b5e77 100644 --- a/sdk/resourcemanager/kusto/armkusto/go.mod +++ b/sdk/resourcemanager/kusto/armkusto/go.mod @@ -3,7 +3,7 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto/v2 go 1.25.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.2.0 @@ -20,9 +20,9 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.52.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.35.0 // indirect + golang.org/x/crypto v0.50.0 // indirect + golang.org/x/net v0.53.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/text v0.36.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 441132f4be57..5bc0609e8582 100644 --- a/sdk/resourcemanager/kusto/armkusto/go.sum +++ b/sdk/resourcemanager/kusto/armkusto/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 h1:jHb/wfvRikGdxMXYV3QG/SzUOPYN9KEUUuC0Yd0/vC0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1/go.mod h1:pzBXCYn05zvYIrwLgtK8Ap8QcjRg+0i76tMQdWN6wOk= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= @@ -38,15 +38,15 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= -golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= -golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= -golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/sdk/resourcemanager/kusto/armkusto/interfaces.go b/sdk/resourcemanager/kusto/armkusto/interfaces.go index 2cd7873d6c24..cfcc2a6f4054 100644 --- a/sdk/resourcemanager/kusto/armkusto/interfaces.go +++ b/sdk/resourcemanager/kusto/armkusto/interfaces.go @@ -1,14 +1,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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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 +// - *CosmosDbDataConnection, *DataConnection, *EventGridDataConnection, *EventGridDataConnectionWithManagedIdentity, *EventHubDataConnection, +// - *EventHubDataConnectionWithManagedIdentity, *IotHubDataConnection type DataConnectionClassification interface { // GetDataConnection returns the DataConnection content of the underlying type. GetDataConnection() *DataConnection diff --git a/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go index 516edee1e526..cc6d11524320 100644 --- a/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go +++ b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // ManagedPrivateEndpointsClient contains the methods for the ManagedPrivateEndpoints group. // Don't use this type directly, use NewManagedPrivateEndpointsClient() instead. +// +// Generated from API version 2025-02-14 type ManagedPrivateEndpointsClient struct { internal *arm.Client subscriptionID string } // NewManagedPrivateEndpointsClient creates a new instance of ManagedPrivateEndpointsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewManagedPrivateEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ManagedPrivateEndpointsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewManagedPrivateEndpointsClient(subscriptionID string, credential azcore.T // CheckNameAvailability - Checks that the managed private endpoints resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - resourceName - The name of the resource. @@ -72,8 +71,12 @@ func (client *ManagedPrivateEndpointsClient) CheckNameAvailability(ctx context.C } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *ManagedPrivateEndpointsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, resourceName ManagedPrivateEndpointsCheckNameRequest, options *ManagedPrivateEndpointsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, resourceName ManagedPrivateEndpointsCheckNameRequest, _ *ManagedPrivateEndpointsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpointsCheckNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -82,18 +85,15 @@ func (client *ManagedPrivateEndpointsClient) checkNameAvailabilityCreateRequest( return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resourceName); err != nil { return nil, err } @@ -111,8 +111,6 @@ func (client *ManagedPrivateEndpointsClient) checkNameAvailabilityHandleResponse // BeginCreateOrUpdate - Creates a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - managedPrivateEndpointName - The name of the managed private endpoint. @@ -138,8 +136,6 @@ func (client *ManagedPrivateEndpointsClient) BeginCreateOrUpdate(ctx context.Con // CreateOrUpdate - Creates a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ManagedPrivateEndpointsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, options *ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedPrivateEndpointsClient.BeginCreateOrUpdate" @@ -162,7 +158,7 @@ func (client *ManagedPrivateEndpointsClient) createOrUpdate(ctx context.Context, } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ManagedPrivateEndpointsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, options *ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, _ *ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -185,9 +181,10 @@ func (client *ManagedPrivateEndpointsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -196,8 +193,6 @@ func (client *ManagedPrivateEndpointsClient) createOrUpdateCreateRequest(ctx con // BeginDelete - Deletes a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - managedPrivateEndpointName - The name of the managed private endpoint. @@ -222,8 +217,6 @@ func (client *ManagedPrivateEndpointsClient) BeginDelete(ctx context.Context, re // Delete - Deletes a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ManagedPrivateEndpointsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ManagedPrivateEndpointsClient.BeginDelete" @@ -246,7 +239,7 @@ func (client *ManagedPrivateEndpointsClient) deleteOperation(ctx context.Context } // deleteCreateRequest creates the Delete request. -func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, _ *ManagedPrivateEndpointsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,16 +262,13 @@ func (client *ManagedPrivateEndpointsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - managedPrivateEndpointName - The name of the managed private endpoint. @@ -307,7 +297,7 @@ func (client *ManagedPrivateEndpointsClient) Get(ctx context.Context, resourceGr } // getCreateRequest creates the Get request. -func (client *ManagedPrivateEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, options *ManagedPrivateEndpointsClientGetOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, _ *ManagedPrivateEndpointsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -330,8 +320,8 @@ func (client *ManagedPrivateEndpointsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -346,8 +336,6 @@ func (client *ManagedPrivateEndpointsClient) getHandleResponse(resp *http.Respon } // NewListPager - Returns the list of managed private endpoints. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - ManagedPrivateEndpointsClientListOptions contains the optional parameters for the ManagedPrivateEndpointsClient.NewListPager @@ -355,21 +343,20 @@ func (client *ManagedPrivateEndpointsClient) getHandleResponse(resp *http.Respon func (client *ManagedPrivateEndpointsClient) NewListPager(resourceGroupName string, clusterName string, options *ManagedPrivateEndpointsClientListOptions) *runtime.Pager[ManagedPrivateEndpointsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ManagedPrivateEndpointsClientListResponse]{ More: func(page ManagedPrivateEndpointsClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ManagedPrivateEndpointsClientListResponse) (ManagedPrivateEndpointsClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ManagedPrivateEndpointsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return ManagedPrivateEndpointsClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return ManagedPrivateEndpointsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagedPrivateEndpointsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -377,7 +364,7 @@ func (client *ManagedPrivateEndpointsClient) NewListPager(resourceGroupName stri } // listCreateRequest creates the List request. -func (client *ManagedPrivateEndpointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ManagedPrivateEndpointsClientListOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ManagedPrivateEndpointsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -396,8 +383,8 @@ func (client *ManagedPrivateEndpointsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -413,8 +400,6 @@ func (client *ManagedPrivateEndpointsClient) listHandleResponse(resp *http.Respo // BeginUpdate - Updates a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - managedPrivateEndpointName - The name of the managed private endpoint. @@ -440,8 +425,6 @@ func (client *ManagedPrivateEndpointsClient) BeginUpdate(ctx context.Context, re // Update - Updates a managed private endpoint. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ManagedPrivateEndpointsClient) update(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, options *ManagedPrivateEndpointsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ManagedPrivateEndpointsClient.BeginUpdate" @@ -464,7 +447,7 @@ func (client *ManagedPrivateEndpointsClient) update(ctx context.Context, resourc } // updateCreateRequest creates the Update request. -func (client *ManagedPrivateEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, options *ManagedPrivateEndpointsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ManagedPrivateEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, managedPrivateEndpointName string, parameters ManagedPrivateEndpoint, _ *ManagedPrivateEndpointsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -487,9 +470,10 @@ func (client *ManagedPrivateEndpointsClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go index 9964f3170d79..ba107af22ec1 100644 --- a/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/managedprivateendpoints_client_example_test.go @@ -1,28 +1,25 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoManagedPrivateEndpointsCheckNameAvailability.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,139 +33,174 @@ func ExampleManagedPrivateEndpointsClient_CheckNameAvailability() { // 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), + // res = armkusto.ManagedPrivateEndpointsClientCheckNameAvailabilityResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoManagedPrivateEndpointsList.json -func ExampleManagedPrivateEndpointsClient_NewListPager() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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."), - // }, - // }}, - // } + 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 poll 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.ManagedPrivateEndpointsClientCreateOrUpdateResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoManagedPrivateEndpointsGet.json -func ExampleManagedPrivateEndpointsClient_Get() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewManagedPrivateEndpointsClient().Get(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", nil) + poller, err := clientFactory.NewManagedPrivateEndpointsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", 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 poll 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."), - // }, + // res = armkusto.ManagedPrivateEndpointsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoManagedPrivateEndpointsCreateOrUpdate.json -func ExampleManagedPrivateEndpointsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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) + res, err := clientFactory.NewManagedPrivateEndpointsClient().Get(ctx, "kustorptest", "kustoCluster", "managedPrivateEndpointTest", 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."), + // res = armkusto.ManagedPrivateEndpointsClientGetResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoManagedPrivateEndpointsUpdate.json +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 = armkusto.ManagedPrivateEndpointsClientListResponse{ + // 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: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -184,40 +216,21 @@ func ExampleManagedPrivateEndpointsClient_BeginUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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."), + // res = armkusto.ManagedPrivateEndpointsClientUpdateResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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 3fdd5132d8cf..fed78bd9b658 100644 --- a/sdk/resourcemanager/kusto/armkusto/models.go +++ b/sdk/resourcemanager/kusto/armkusto/models.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -27,12 +26,18 @@ type AttachedDatabaseConfiguration struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AttachedDatabaseConfigurationListResult - The list attached database configurations operation response. type AttachedDatabaseConfigurationListResult struct { + // Link to the next page of results. + NextLink *string + // The list of attached database configurations. Value []*AttachedDatabaseConfiguration } @@ -118,11 +123,13 @@ type AzureSKU struct { // CalloutPoliciesList - A list of the service's callout policy objects. type CalloutPoliciesList struct { + // REQUIRED; The CalloutPolicy items on this page + Value []*CalloutPolicy + // The URL to get the next set of callout policies list results if there are any. + // + // The link to the next page of items NextLink *string - - // A list of the service's callout policies. - Value []*CalloutPolicy } // CalloutPolicy - Configuration for external callout policies, including URI patterns, access types, and service types. @@ -187,10 +194,13 @@ type Cluster struct { // Resource tags. Tags map[string]*string - // The availability zones of the cluster. + // The availability zones. Zones []*string - // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + // READ-ONLY; "If etag is provided in the response body, it may also be provided as a header per the normal etag convention. + // Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + // the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header + // fields.") Etag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -199,7 +209,7 @@ type Cluster struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -218,6 +228,9 @@ type ClusterCheckNameRequest struct { // ClusterListResult - The list Kusto clusters operation response. type ClusterListResult struct { + // Link to the next page of results. + NextLink *string + // The list of Kusto clusters. Value []*Cluster } @@ -239,6 +252,9 @@ type ClusterPrincipalAssignment struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -255,6 +271,9 @@ type ClusterPrincipalAssignmentCheckNameRequest struct { // ClusterPrincipalAssignmentListResult - The list Kusto cluster principal assignments operation response. type ClusterPrincipalAssignmentListResult struct { + // Link to the next page of results. + NextLink *string + // The list of Kusto cluster principal assignments. Value []*ClusterPrincipalAssignment } @@ -399,6 +418,9 @@ type ClusterUpdate struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -413,7 +435,8 @@ type ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalpr // CosmosDbDataConnection - Class representing a CosmosDb data connection. type CosmosDbDataConnection struct { - // REQUIRED; Kind of the endpoint for the data connection + // CONSTANT; Kind of the endpoint for the data connection + // Field has constant value DataConnectionKindCosmosDb, any specified value is ignored. Kind *DataConnectionKind // Resource location. @@ -428,6 +451,9 @@ type CosmosDbDataConnection struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -435,11 +461,12 @@ type CosmosDbDataConnection struct { // GetDataConnection implements the DataConnectionClassification interface for type CosmosDbDataConnection. func (c *CosmosDbDataConnection) GetDataConnection() *DataConnection { return &DataConnection{ - ID: c.ID, - Kind: c.Kind, - Location: c.Location, - Name: c.Name, - Type: c.Type, + ID: c.ID, + Kind: c.Kind, + Location: c.Location, + Name: c.Name, + SystemData: c.SystemData, + Type: c.Type, } } @@ -489,6 +516,9 @@ type DataConnection struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -508,6 +538,9 @@ type DataConnectionCheckNameRequest struct { // DataConnectionListResult - The list Kusto data connections operation response. type DataConnectionListResult struct { + // Link to the next page of results. + NextLink *string + // The list of Kusto data connections. Value []DataConnectionClassification } @@ -547,6 +580,9 @@ type Database struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -569,13 +605,13 @@ type DatabaseInviteFollowerResult struct { GeneratedInvitation *string } -// DatabaseListResult - The list Kusto databases operation response. +// DatabaseListResult - The response of a Database list operation. type DatabaseListResult struct { - // Link to the next page of results - NextLink *string - - // The list of Kusto databases. + // REQUIRED; The Database items on this page Value []DatabaseClassification + + // The link to the next page of items + NextLink *string } // DatabasePrincipal - A class representing database principal entity. @@ -613,6 +649,9 @@ type DatabasePrincipalAssignment struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -629,6 +668,9 @@ type DatabasePrincipalAssignmentCheckNameRequest struct { // DatabasePrincipalAssignmentListResult - The list Kusto database principal assignments operation response. type DatabasePrincipalAssignmentListResult struct { + // Link to the next page of results. + NextLink *string + // The list of Kusto database principal assignments. Value []*DatabasePrincipalAssignment } @@ -641,6 +683,9 @@ type DatabasePrincipalListRequest struct { // DatabasePrincipalListResult - The list Kusto database principals operation response. type DatabasePrincipalListResult struct { + // Link to the next page of results. + NextLink *string + // The list of Kusto database principals. Value []*DatabasePrincipal } @@ -744,9 +789,54 @@ type EventGridConnectionProperties struct { ProvisioningState *ProvisioningState } +// EventGridConnectionWithManagedIdentityProperties - Class representing the Kusto event grid connection with mandatory managed +// identity properties. +type EventGridConnectionWithManagedIdentityProperties struct { + // REQUIRED; The event hub consumer group. + ConsumerGroup *string + + // REQUIRED; The resource ID of the event hub that is subscribed to the storage account events. + EventHubResourceIDForManagedIdentity *string + + // REQUIRED; The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub and + // storage account. + ManagedIdentityResourceID *string + + // REQUIRED; The resource ID of the storage account where the data resides. + StorageAccountResourceIDForManagedIdentity *string + + // The name of blob storage event type to process. + BlobStorageEventType *BlobStorageEventType + + // The data format of the message. Optionally the data format can be added to each message. + DataFormat *EventGridDataFormat + + // Indication for database routing information from the data connection, by default only database routing information is allowed + DatabaseRouting *DatabaseRouting + + // The resource ID where the event grid is configured to send events. + EventGridResourceID *string + + // A Boolean value that, if set to true, indicates that ingestion should ignore the first record of every file + IgnoreFirstRecord *bool + + // The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + MappingRuleName *string + + // The table where the data should be ingested. Optionally the table information can be added to each message. + TableName *string + + // READ-ONLY; The object ID of managedIdentityResourceId + ManagedIdentityObjectID *string + + // READ-ONLY; The provisioned state of the resource. + ProvisioningState *ProvisioningState +} + // EventGridDataConnection - Class representing an Event Grid data connection. type EventGridDataConnection struct { - // REQUIRED; Kind of the endpoint for the data connection + // CONSTANT; Kind of the endpoint for the data connection + // Field has constant value DataConnectionKindEventGrid, any specified value is ignored. Kind *DataConnectionKind // Resource location. @@ -761,6 +851,9 @@ type EventGridDataConnection struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -768,11 +861,49 @@ type EventGridDataConnection struct { // GetDataConnection implements the DataConnectionClassification interface for type EventGridDataConnection. func (e *EventGridDataConnection) GetDataConnection() *DataConnection { return &DataConnection{ - ID: e.ID, - Kind: e.Kind, - Location: e.Location, - Name: e.Name, - Type: e.Type, + ID: e.ID, + Kind: e.Kind, + Location: e.Location, + Name: e.Name, + SystemData: e.SystemData, + Type: e.Type, + } +} + +// EventGridDataConnectionWithManagedIdentity - Class representing an Event Grid data connection with mandatory managed identity. +type EventGridDataConnectionWithManagedIdentity struct { + // CONSTANT; Kind of the endpoint for the data connection + // Field has constant value DataConnectionKindEventGridWithManagedIdentity, any specified value is ignored. + Kind *DataConnectionKind + + // Resource location. + Location *string + + // The properties of the Event Grid data connection with mandatory managed identity. + Properties *EventGridConnectionWithManagedIdentityProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GetDataConnection implements the DataConnectionClassification interface for type EventGridDataConnectionWithManagedIdentity. +func (e *EventGridDataConnectionWithManagedIdentity) GetDataConnection() *DataConnection { + return &DataConnection{ + ID: e.ID, + Kind: e.Kind, + Location: e.Location, + Name: e.Name, + SystemData: e.SystemData, + Type: e.Type, } } @@ -784,7 +915,7 @@ type EventHubConnectionProperties struct { // REQUIRED; The resource ID of the event hub to be used to create a data connection. EventHubResourceID *string - // The event hub messages compression type + // The compression type Compression *Compression // The data format of the message. Optionally the data format can be added to each message. @@ -816,9 +947,51 @@ type EventHubConnectionProperties struct { ProvisioningState *ProvisioningState } +// EventHubConnectionWithManagedIdentityProperties - Class representing the Kusto event hub connection with required managed +// identity properties. +type EventHubConnectionWithManagedIdentityProperties struct { + // REQUIRED; The event hub consumer group. + ConsumerGroup *string + + // REQUIRED; The resource ID of the event hub to be used to create a data connection. + EventHubResourceIDForManagedIdentity *string + + // REQUIRED; The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub. + ManagedIdentityResourceID *string + + // The compression type + Compression *Compression + + // The data format of the message. Optionally the data format can be added to each message. + DataFormat *EventHubDataFormat + + // Indication for database routing information from the data connection, by default only database routing information is allowed + DatabaseRouting *DatabaseRouting + + // System properties of the event hub + EventSystemProperties []*string + + // The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. + MappingRuleName *string + + // When defined, the data connection retrieves existing Event hub events created since the Retrieval start date. It can only + // retrieve events retained by the Event hub, based on its retention period. + RetrievalStartDate *time.Time + + // The table where the data should be ingested. Optionally the table information can be added to each message. + TableName *string + + // READ-ONLY; The object ID of the managedIdentityResourceId + ManagedIdentityObjectID *string + + // READ-ONLY; The provisioned state of the resource. + ProvisioningState *ProvisioningState +} + // EventHubDataConnection - Class representing an event hub data connection. type EventHubDataConnection struct { - // REQUIRED; Kind of the endpoint for the data connection + // CONSTANT; Kind of the endpoint for the data connection + // Field has constant value DataConnectionKindEventHub, any specified value is ignored. Kind *DataConnectionKind // Resource location. @@ -833,6 +1006,9 @@ type EventHubDataConnection struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -840,11 +1016,49 @@ type EventHubDataConnection struct { // GetDataConnection implements the DataConnectionClassification interface for type EventHubDataConnection. func (e *EventHubDataConnection) GetDataConnection() *DataConnection { return &DataConnection{ - ID: e.ID, - Kind: e.Kind, - Location: e.Location, - Name: e.Name, - Type: e.Type, + ID: e.ID, + Kind: e.Kind, + Location: e.Location, + Name: e.Name, + SystemData: e.SystemData, + Type: e.Type, + } +} + +// EventHubDataConnectionWithManagedIdentity - Class representing an event hub data connection with required managed identity. +type EventHubDataConnectionWithManagedIdentity struct { + // CONSTANT; Kind of the endpoint for the data connection + // Field has constant value DataConnectionKindEventHubWithManagedIdentity, any specified value is ignored. + Kind *DataConnectionKind + + // Resource location. + Location *string + + // The Event Hub data connection properties to validate. + Properties *EventHubConnectionWithManagedIdentityProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GetDataConnection implements the DataConnectionClassification interface for type EventHubDataConnectionWithManagedIdentity. +func (e *EventHubDataConnectionWithManagedIdentity) GetDataConnection() *DataConnection { + return &DataConnection{ + ID: e.ID, + Kind: e.Kind, + Location: e.Location, + Name: e.Name, + SystemData: e.SystemData, + Type: e.Type, } } @@ -874,17 +1088,20 @@ type FollowerDatabaseDefinitionGet struct { // FollowerDatabaseListResult - The list Kusto database principals operation response. type FollowerDatabaseListResult struct { + // Link to the next page of results. + NextLink *string + // The list of follower database result. Value []*FollowerDatabaseDefinition } // FollowerDatabaseListResultGet - The list Kusto database principals operation response. type FollowerDatabaseListResultGet struct { - // The URL to get the next set of follower databases list results if there are any. - NextLink *string - - // The list of follower database result. + // REQUIRED; The FollowerDatabaseDefinitionGet items on this page Value []*FollowerDatabaseDefinitionGet + + // The link to the next page of items + NextLink *string } // FollowerDatabaseProperties - A class representing the properties of a follower database object. @@ -908,13 +1125,11 @@ type FollowerDatabaseProperties struct { // Identity for the resource. type Identity struct { // REQUIRED; The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created - // identity and a set of user-assigned identities. The type 'None' will remove all - // identities. + // identity and a set of user-assigned identities. The type 'None' will remove all identities. Type *IdentityType // The list of user identities associated with the Kusto cluster. The user identity dictionary key references will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + // resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. UserAssignedIdentities map[string]*ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties // READ-ONLY; The principal ID of resource identity. @@ -960,7 +1175,8 @@ type IotHubConnectionProperties struct { // IotHubDataConnection - Class representing an iot hub data connection. type IotHubDataConnection struct { - // REQUIRED; Kind of the endpoint for the data connection + // CONSTANT; Kind of the endpoint for the data connection + // Field has constant value DataConnectionKindIotHub, any specified value is ignored. Kind *DataConnectionKind // Resource location. @@ -975,6 +1191,9 @@ type IotHubDataConnection struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -982,16 +1201,22 @@ type IotHubDataConnection struct { // GetDataConnection implements the DataConnectionClassification interface for type IotHubDataConnection. func (i *IotHubDataConnection) GetDataConnection() *DataConnection { return &DataConnection{ - ID: i.ID, - Kind: i.Kind, - Location: i.Location, - Name: i.Name, - Type: i.Type, + ID: i.ID, + Kind: i.Kind, + Location: i.Location, + Name: i.Name, + SystemData: i.SystemData, + Type: i.Type, } } // KeyVaultProperties - Properties of the key vault. type KeyVaultProperties struct { + // The application (client) ID of the multi-tenant Microsoft Entra application. Used for cross-tenant customer-managed key + // scenarios where the encryption key is stored in a different tenant than the cluster. The application must be configured + // with the user-assigned managed identity as a federated identity credential. + FederatedIdentityClientID *string + // The name of the key vault key. KeyName *string @@ -1001,13 +1226,15 @@ type KeyVaultProperties struct { // The version of the key vault key. KeyVersion *string - // The user assigned identity (ARM resource id) that has access to the key. + // The user assigned identity (ARM resource id) that has access to the key. The identity must have 'Get', 'Wrap Key', and + // 'Unwrap Key' permissions on the Key Vault key, or be assigned the 'Key Vault Crypto Service Encryption User' role. UserIdentity *string } // LanguageExtension - The language extension object. type LanguageExtension struct { - // The language extension custom image name. + // The sandbox custom image name that should be enabled as the active language extension. Sandbox custom image is a cluster + // sub resource. When this property is set, LanguageExtensionImageName should be set to 'PythonCustomImage'. LanguageExtensionCustomImageName *string // The language extension image name. @@ -1019,12 +1246,18 @@ type LanguageExtension struct { // LanguageExtensionsList - The list of language extension objects. type LanguageExtensionsList struct { + // The link to the next page of resources. + NextLink *string + // The list of language extensions. Value []*LanguageExtension } // ListResourceSKUsResult - List of available SKUs for a Kusto Cluster. type ListResourceSKUsResult struct { + // Link to the next page of results. + NextLink *string + // The collection of available SKUs for an existing resource. Value []*AzureResourceSKU } @@ -1040,7 +1273,7 @@ type ManagedPrivateEndpoint struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -1049,6 +1282,9 @@ type ManagedPrivateEndpoint struct { // ManagedPrivateEndpointListResult - The list managed private endpoints operation response. type ManagedPrivateEndpointListResult struct { + // Link to the next page of results. + NextLink *string + // The list of managed private endpoints. Value []*ManagedPrivateEndpoint } @@ -1097,41 +1333,66 @@ type MigrationClusterProperties struct { } // Operation - A REST API operation +// +// A REST API operation type Operation struct { + // The object that describes the operation. + // // The object that describes the operation. Display *OperationDisplay + // The operation name. + // // This is of the format {provider}/{resource}/{operation}. Name *string + // The intended executor of the operation. + // // The intended executor of the operation. Origin *string + // Properties of the operation. + // // Properties of the operation. Properties any } // OperationDisplay - The object that describes the operation. type OperationDisplay struct { + // The friendly name of the operation. + // // The friendly name of the operation. Description *string + // The operation type. + // // For example: read, write, delete. Operation *string + // Friendly name of the resource provider. + // // Friendly name of the resource provider. Provider *string + // The resource type on which the operation is performed. + // // The resource type on which the operation is performed. Resource *string } // OperationListResult - 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. +// +// 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. type OperationListResult struct { // The URL to get the next set of operation list results if there are any. + // + // Link to the next page of results. NextLink *string + // The list of operations supported by the resource provider. + // // The list of operations supported by the resource provider. Value []*Operation } @@ -1214,16 +1475,19 @@ type OutboundNetworkDependenciesEndpoint struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// OutboundNetworkDependenciesEndpointListResult - Collection of Outbound Environment Endpoints +// OutboundNetworkDependenciesEndpointListResult - The response of a OutboundNetworkDependenciesEndpoint list operation. type OutboundNetworkDependenciesEndpointListResult struct { - // REQUIRED; Collection of resources. + // REQUIRED; The OutboundNetworkDependenciesEndpoint items on this page Value []*OutboundNetworkDependenciesEndpoint - // READ-ONLY; Link to next page of resources. + // The link to the next page of items NextLink *string } @@ -1252,7 +1516,7 @@ type PrivateEndpointConnection struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -1261,6 +1525,9 @@ type PrivateEndpointConnection struct { // PrivateEndpointConnectionListResult - A list of private endpoint connections type PrivateEndpointConnectionListResult struct { + // Link to the next page of results. + NextLink *string + // Array of private endpoint connections Value []*PrivateEndpointConnection } @@ -1297,7 +1564,7 @@ type PrivateLinkResource struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -1306,6 +1573,9 @@ type PrivateLinkResource struct { // PrivateLinkResourceListResult - A list of private link resources type PrivateLinkResourceListResult struct { + // Link to the next page of results. + NextLink *string + // Array of private link resources Value []*PrivateLinkResource } @@ -1336,7 +1606,8 @@ type PrivateLinkServiceConnectionStateProperty struct { // ReadOnlyFollowingDatabase - Class representing a read only following database. type ReadOnlyFollowingDatabase struct { - // REQUIRED; Kind of the database + // CONSTANT; Kind of the database + // Field has constant value KindReadOnlyFollowing, any specified value is ignored. Kind *Kind // Resource location. @@ -1351,6 +1622,9 @@ type ReadOnlyFollowingDatabase struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -1358,11 +1632,12 @@ type ReadOnlyFollowingDatabase struct { // GetDatabase implements the DatabaseClassification interface for type ReadOnlyFollowingDatabase. func (r *ReadOnlyFollowingDatabase) GetDatabase() *Database { return &Database{ - ID: r.ID, - Kind: r.Kind, - Location: r.Location, - Name: r.Name, - Type: r.Type, + ID: r.ID, + Kind: r.Kind, + Location: r.Location, + Name: r.Name, + SystemData: r.SystemData, + Type: r.Type, } } @@ -1405,7 +1680,8 @@ type ReadOnlyFollowingDatabaseProperties struct { // ReadWriteDatabase - Class representing a read write database. type ReadWriteDatabase struct { - // REQUIRED; Kind of the database + // CONSTANT; Kind of the database + // Field has constant value KindReadWrite, any specified value is ignored. Kind *Kind // Resource location. @@ -1420,6 +1696,9 @@ type ReadWriteDatabase struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -1427,11 +1706,12 @@ type ReadWriteDatabase struct { // GetDatabase implements the DatabaseClassification interface for type ReadWriteDatabase. func (r *ReadWriteDatabase) GetDatabase() *Database { return &Database{ - ID: r.ID, - Kind: r.Kind, - Location: r.Location, - Name: r.Name, - Type: r.Type, + ID: r.ID, + Kind: r.Kind, + Location: r.Location, + Name: r.Name, + SystemData: r.SystemData, + Type: r.Type, } } @@ -1501,6 +1781,9 @@ type SKUDescription struct { // SKUDescriptionList - The list of the EngagementFabric SKU descriptions type SKUDescriptionList struct { + // Link to the next page of results. + NextLink *string + // READ-ONLY; SKU descriptions Value []*SKUDescription } @@ -1528,6 +1811,9 @@ type SandboxCustomImage struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -1538,8 +1824,8 @@ type SandboxCustomImageProperties struct { Language *Language // The base image name on which the custom image is built on top of. It can be one of the LanguageExtensionImageName (e.g.: - // 'Python3108', 'Python3108_DL') or the name of an existing custom image. Either - // this property or languageVersion should be specified. + // 'Python3_10_8', 'Python3_10_8_DL') or the name of an existing custom image. Either this property or languageVersion should + // be specified. BaseImageName *string // The version of the language. Either this property or baseImageName should be specified. @@ -1564,11 +1850,11 @@ type SandboxCustomImagesCheckNameRequest struct { // SandboxCustomImagesListResult - The list Kusto sandbox custom images operation response. type SandboxCustomImagesListResult struct { - // Link to the next page of results - NextLink *string - - // The list of Kusto sandbox custom images. + // REQUIRED; The SandboxCustomImage items on this page Value []*SandboxCustomImage + + // The link to the next page of items + NextLink *string } // Script - Class representing a database script. @@ -1582,7 +1868,7 @@ type Script struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -1601,6 +1887,9 @@ type ScriptCheckNameRequest struct { // ScriptListResult - The list Kusto database script operation response. type ScriptListResult struct { + // Link to the next page of results. + NextLink *string + // The list of Kusto scripts. Value []*Script } @@ -1613,6 +1902,10 @@ type ScriptProperties struct { // A unique string. If changed the script will be applied again. ForceUpdateTag *string + // The resource identifier of the managed identity to be used. When provided, the managed identity will be used to read the + // script content from the scriptUrl. + ManagedIdentityResourceID *string + // Indicates if the permissions for the script caller are kept following completion of the script. PrincipalPermissionsAction *PrincipalPermissionsAction diff --git a/sdk/resourcemanager/kusto/armkusto/models_serde.go b/sdk/resourcemanager/kusto/armkusto/models_serde.go index be2de0db44e9..5f20caa8f683 100644 --- a/sdk/resourcemanager/kusto/armkusto/models_serde.go +++ b/sdk/resourcemanager/kusto/armkusto/models_serde.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -9,7 +8,9 @@ import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/datetime" "reflect" + "time" ) // MarshalJSON implements the json.Marshaller interface for type AcceptedAudiences. @@ -46,6 +47,7 @@ func (a AttachedDatabaseConfiguration) MarshalJSON() ([]byte, error) { populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -71,6 +73,9 @@ func (a *AttachedDatabaseConfiguration) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -85,6 +90,7 @@ func (a *AttachedDatabaseConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AttachedDatabaseConfigurationListResult. func (a AttachedDatabaseConfigurationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } @@ -98,6 +104,9 @@ func (a *AttachedDatabaseConfigurationListResult) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) @@ -572,6 +581,7 @@ func (c *ClusterCheckNameRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ClusterListResult. func (c ClusterListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } @@ -585,6 +595,9 @@ func (c *ClusterListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) @@ -629,6 +642,7 @@ func (c ClusterPrincipalAssignment) MarshalJSON() ([]byte, error) { populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } @@ -651,6 +665,9 @@ func (c *ClusterPrincipalAssignment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) @@ -696,6 +713,7 @@ func (c *ClusterPrincipalAssignmentCheckNameRequest) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type ClusterPrincipalAssignmentListResult. func (c ClusterPrincipalAssignmentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } @@ -709,6 +727,9 @@ func (c *ClusterPrincipalAssignmentListResult) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) @@ -915,6 +936,7 @@ func (c ClusterUpdate) MarshalJSON() ([]byte, error) { populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "sku", c.SKU) + populate(objectMap, "systemData", c.SystemData) populate(objectMap, "tags", c.Tags) populate(objectMap, "type", c.Type) populate(objectMap, "zones", c.Zones) @@ -948,6 +970,9 @@ func (c *ClusterUpdate) UnmarshalJSON(data []byte) error { case "sku": err = unpopulate(val, "SKU", &c.SKU) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &c.Tags) delete(rawMsg, key) @@ -1004,6 +1029,7 @@ func (c CosmosDbDataConnection) MarshalJSON() ([]byte, error) { populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } @@ -1032,6 +1058,9 @@ func (c *CosmosDbDataConnection) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &c.Type) delete(rawMsg, key) @@ -1053,7 +1082,7 @@ func (c CosmosDbDataConnectionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "managedIdentityResourceId", c.ManagedIdentityResourceID) populate(objectMap, "mappingRuleName", c.MappingRuleName) populate(objectMap, "provisioningState", c.ProvisioningState) - populateDateTimeRFC3339(objectMap, "retrievalStartDate", c.RetrievalStartDate) + populateTime[datetime.RFC3339](objectMap, "retrievalStartDate", c.RetrievalStartDate) populate(objectMap, "tableName", c.TableName) return json.Marshal(objectMap) } @@ -1089,7 +1118,7 @@ func (c *CosmosDbDataConnectionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) delete(rawMsg, key) case "retrievalStartDate": - err = unpopulateDateTimeRFC3339(val, "RetrievalStartDate", &c.RetrievalStartDate) + err = unpopulateTime[datetime.RFC3339](val, "RetrievalStartDate", &c.RetrievalStartDate) delete(rawMsg, key) case "tableName": err = unpopulate(val, "TableName", &c.TableName) @@ -1106,9 +1135,10 @@ func (c *CosmosDbDataConnectionProperties) UnmarshalJSON(data []byte) error { func (d DataConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) - objectMap["kind"] = d.Kind + populate(objectMap, "kind", d.Kind) populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -1134,6 +1164,9 @@ func (d *DataConnection) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -1179,6 +1212,7 @@ func (d *DataConnectionCheckNameRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DataConnectionListResult. func (d DataConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } @@ -1192,6 +1226,9 @@ func (d *DataConnectionListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) case "value": d.Value, err = unmarshalDataConnectionClassificationArray(val) delete(rawMsg, key) @@ -1292,9 +1329,10 @@ func (d *DataConnectionValidationResult) UnmarshalJSON(data []byte) error { func (d Database) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", d.ID) - objectMap["kind"] = d.Kind + populate(objectMap, "kind", d.Kind) populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -1320,6 +1358,9 @@ func (d *Database) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -1477,6 +1518,7 @@ func (d DatabasePrincipalAssignment) MarshalJSON() ([]byte, error) { populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -1499,6 +1541,9 @@ func (d *DatabasePrincipalAssignment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -1544,6 +1589,7 @@ func (d *DatabasePrincipalAssignmentCheckNameRequest) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalAssignmentListResult. func (d DatabasePrincipalAssignmentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } @@ -1557,6 +1603,9 @@ func (d *DatabasePrincipalAssignmentListResult) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) @@ -1598,6 +1647,7 @@ func (d *DatabasePrincipalListRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DatabasePrincipalListResult. func (d DatabasePrincipalListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } @@ -1611,6 +1661,9 @@ func (d *DatabasePrincipalListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) @@ -1868,6 +1921,81 @@ func (e *EventGridConnectionProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EventGridConnectionWithManagedIdentityProperties. +func (e EventGridConnectionWithManagedIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "blobStorageEventType", e.BlobStorageEventType) + populate(objectMap, "consumerGroup", e.ConsumerGroup) + populate(objectMap, "dataFormat", e.DataFormat) + populate(objectMap, "databaseRouting", e.DatabaseRouting) + populate(objectMap, "eventGridResourceId", e.EventGridResourceID) + populate(objectMap, "eventHubResourceIdForManagedIdentity", e.EventHubResourceIDForManagedIdentity) + populate(objectMap, "ignoreFirstRecord", e.IgnoreFirstRecord) + populate(objectMap, "managedIdentityObjectId", e.ManagedIdentityObjectID) + populate(objectMap, "managedIdentityResourceId", e.ManagedIdentityResourceID) + populate(objectMap, "mappingRuleName", e.MappingRuleName) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "storageAccountResourceIdForManagedIdentity", e.StorageAccountResourceIDForManagedIdentity) + populate(objectMap, "tableName", e.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventGridConnectionWithManagedIdentityProperties. +func (e *EventGridConnectionWithManagedIdentityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "blobStorageEventType": + err = unpopulate(val, "BlobStorageEventType", &e.BlobStorageEventType) + delete(rawMsg, key) + case "consumerGroup": + err = unpopulate(val, "ConsumerGroup", &e.ConsumerGroup) + delete(rawMsg, key) + case "dataFormat": + err = unpopulate(val, "DataFormat", &e.DataFormat) + delete(rawMsg, key) + case "databaseRouting": + err = unpopulate(val, "DatabaseRouting", &e.DatabaseRouting) + delete(rawMsg, key) + case "eventGridResourceId": + err = unpopulate(val, "EventGridResourceID", &e.EventGridResourceID) + delete(rawMsg, key) + case "eventHubResourceIdForManagedIdentity": + err = unpopulate(val, "EventHubResourceIDForManagedIdentity", &e.EventHubResourceIDForManagedIdentity) + delete(rawMsg, key) + case "ignoreFirstRecord": + err = unpopulate(val, "IgnoreFirstRecord", &e.IgnoreFirstRecord) + delete(rawMsg, key) + case "managedIdentityObjectId": + err = unpopulate(val, "ManagedIdentityObjectID", &e.ManagedIdentityObjectID) + delete(rawMsg, key) + case "managedIdentityResourceId": + err = unpopulate(val, "ManagedIdentityResourceID", &e.ManagedIdentityResourceID) + delete(rawMsg, key) + case "mappingRuleName": + err = unpopulate(val, "MappingRuleName", &e.MappingRuleName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "storageAccountResourceIdForManagedIdentity": + err = unpopulate(val, "StorageAccountResourceIDForManagedIdentity", &e.StorageAccountResourceIDForManagedIdentity) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &e.TableName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type EventGridDataConnection. func (e EventGridDataConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1876,6 +2004,7 @@ func (e EventGridDataConnection) MarshalJSON() ([]byte, error) { populate(objectMap, "location", e.Location) populate(objectMap, "name", e.Name) populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -1904,6 +2033,60 @@ func (e *EventGridDataConnection) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventGridDataConnectionWithManagedIdentity. +func (e EventGridDataConnectionWithManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + objectMap["kind"] = DataConnectionKindEventGridWithManagedIdentity + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventGridDataConnectionWithManagedIdentity. +func (e *EventGridDataConnectionWithManagedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) @@ -1928,7 +2111,7 @@ func (e EventHubConnectionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "managedIdentityResourceId", e.ManagedIdentityResourceID) populate(objectMap, "mappingRuleName", e.MappingRuleName) populate(objectMap, "provisioningState", e.ProvisioningState) - populateDateTimeRFC3339(objectMap, "retrievalStartDate", e.RetrievalStartDate) + populateTime[datetime.RFC3339](objectMap, "retrievalStartDate", e.RetrievalStartDate) populate(objectMap, "tableName", e.TableName) return json.Marshal(objectMap) } @@ -1973,7 +2156,78 @@ func (e *EventHubConnectionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) delete(rawMsg, key) case "retrievalStartDate": - err = unpopulateDateTimeRFC3339(val, "RetrievalStartDate", &e.RetrievalStartDate) + err = unpopulateTime[datetime.RFC3339](val, "RetrievalStartDate", &e.RetrievalStartDate) + delete(rawMsg, key) + case "tableName": + err = unpopulate(val, "TableName", &e.TableName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubConnectionWithManagedIdentityProperties. +func (e EventHubConnectionWithManagedIdentityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "compression", e.Compression) + populate(objectMap, "consumerGroup", e.ConsumerGroup) + populate(objectMap, "dataFormat", e.DataFormat) + populate(objectMap, "databaseRouting", e.DatabaseRouting) + populate(objectMap, "eventHubResourceIdForManagedIdentity", e.EventHubResourceIDForManagedIdentity) + populate(objectMap, "eventSystemProperties", e.EventSystemProperties) + populate(objectMap, "managedIdentityObjectId", e.ManagedIdentityObjectID) + populate(objectMap, "managedIdentityResourceId", e.ManagedIdentityResourceID) + populate(objectMap, "mappingRuleName", e.MappingRuleName) + populate(objectMap, "provisioningState", e.ProvisioningState) + populateTime[datetime.RFC3339](objectMap, "retrievalStartDate", e.RetrievalStartDate) + populate(objectMap, "tableName", e.TableName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubConnectionWithManagedIdentityProperties. +func (e *EventHubConnectionWithManagedIdentityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "compression": + err = unpopulate(val, "Compression", &e.Compression) + delete(rawMsg, key) + case "consumerGroup": + err = unpopulate(val, "ConsumerGroup", &e.ConsumerGroup) + delete(rawMsg, key) + case "dataFormat": + err = unpopulate(val, "DataFormat", &e.DataFormat) + delete(rawMsg, key) + case "databaseRouting": + err = unpopulate(val, "DatabaseRouting", &e.DatabaseRouting) + delete(rawMsg, key) + case "eventHubResourceIdForManagedIdentity": + err = unpopulate(val, "EventHubResourceIDForManagedIdentity", &e.EventHubResourceIDForManagedIdentity) + delete(rawMsg, key) + case "eventSystemProperties": + err = unpopulate(val, "EventSystemProperties", &e.EventSystemProperties) + delete(rawMsg, key) + case "managedIdentityObjectId": + err = unpopulate(val, "ManagedIdentityObjectID", &e.ManagedIdentityObjectID) + delete(rawMsg, key) + case "managedIdentityResourceId": + err = unpopulate(val, "ManagedIdentityResourceID", &e.ManagedIdentityResourceID) + delete(rawMsg, key) + case "mappingRuleName": + err = unpopulate(val, "MappingRuleName", &e.MappingRuleName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "retrievalStartDate": + err = unpopulateTime[datetime.RFC3339](val, "RetrievalStartDate", &e.RetrievalStartDate) delete(rawMsg, key) case "tableName": err = unpopulate(val, "TableName", &e.TableName) @@ -1994,6 +2248,7 @@ func (e EventHubDataConnection) MarshalJSON() ([]byte, error) { populate(objectMap, "location", e.Location) populate(objectMap, "name", e.Name) populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -2022,6 +2277,60 @@ func (e *EventHubDataConnection) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventHubDataConnectionWithManagedIdentity. +func (e EventHubDataConnectionWithManagedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + objectMap["kind"] = DataConnectionKindEventHubWithManagedIdentity + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDataConnectionWithManagedIdentity. +func (e *EventHubDataConnectionWithManagedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) @@ -2106,6 +2415,7 @@ func (f *FollowerDatabaseDefinitionGet) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FollowerDatabaseListResult. func (f FollowerDatabaseListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) populate(objectMap, "value", f.Value) return json.Marshal(objectMap) } @@ -2119,6 +2429,9 @@ func (f *FollowerDatabaseListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &f.Value) delete(rawMsg, key) @@ -2253,7 +2566,7 @@ func (i IotHubConnectionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "iotHubResourceId", i.IotHubResourceID) populate(objectMap, "mappingRuleName", i.MappingRuleName) populate(objectMap, "provisioningState", i.ProvisioningState) - populateDateTimeRFC3339(objectMap, "retrievalStartDate", i.RetrievalStartDate) + populateTime[datetime.RFC3339](objectMap, "retrievalStartDate", i.RetrievalStartDate) populate(objectMap, "sharedAccessPolicyName", i.SharedAccessPolicyName) populate(objectMap, "tableName", i.TableName) return json.Marshal(objectMap) @@ -2290,7 +2603,7 @@ func (i *IotHubConnectionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) delete(rawMsg, key) case "retrievalStartDate": - err = unpopulateDateTimeRFC3339(val, "RetrievalStartDate", &i.RetrievalStartDate) + err = unpopulateTime[datetime.RFC3339](val, "RetrievalStartDate", &i.RetrievalStartDate) delete(rawMsg, key) case "sharedAccessPolicyName": err = unpopulate(val, "SharedAccessPolicyName", &i.SharedAccessPolicyName) @@ -2314,6 +2627,7 @@ func (i IotHubDataConnection) MarshalJSON() ([]byte, error) { populate(objectMap, "location", i.Location) populate(objectMap, "name", i.Name) populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } @@ -2342,6 +2656,9 @@ func (i *IotHubDataConnection) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) @@ -2356,6 +2673,7 @@ func (i *IotHubDataConnection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type KeyVaultProperties. func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "federatedIdentityClientId", k.FederatedIdentityClientID) populate(objectMap, "keyName", k.KeyName) populate(objectMap, "keyVaultUri", k.KeyVaultURI) populate(objectMap, "keyVersion", k.KeyVersion) @@ -2372,6 +2690,9 @@ func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "federatedIdentityClientId": + err = unpopulate(val, "FederatedIdentityClientID", &k.FederatedIdentityClientID) + delete(rawMsg, key) case "keyName": err = unpopulate(val, "KeyName", &k.KeyName) delete(rawMsg, key) @@ -2430,6 +2751,7 @@ func (l *LanguageExtension) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LanguageExtensionsList. func (l LanguageExtensionsList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } @@ -2443,6 +2765,9 @@ func (l *LanguageExtensionsList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) @@ -2457,6 +2782,7 @@ func (l *LanguageExtensionsList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ListResourceSKUsResult. func (l ListResourceSKUsResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } @@ -2470,6 +2796,9 @@ func (l *ListResourceSKUsResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) @@ -2527,6 +2856,7 @@ func (m *ManagedPrivateEndpoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManagedPrivateEndpointListResult. func (m ManagedPrivateEndpointListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } @@ -2540,6 +2870,9 @@ func (m *ManagedPrivateEndpointListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) @@ -2776,13 +3109,13 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationResult. func (o OperationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populateTime[datetime.RFC3339](objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) populate(objectMap, "name", o.Name) populate(objectMap, "percentComplete", o.PercentComplete) populate(objectMap, "properties", o.Properties) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populateTime[datetime.RFC3339](objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } @@ -2797,7 +3130,7 @@ func (o *OperationResult) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) + err = unpopulateTime[datetime.RFC3339](val, "EndTime", &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &o.Error) @@ -2815,7 +3148,7 @@ func (o *OperationResult) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + err = unpopulateTime[datetime.RFC3339](val, "StartTime", &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &o.Status) @@ -2940,6 +3273,7 @@ func (o OutboundNetworkDependenciesEndpoint) MarshalJSON() ([]byte, error) { populate(objectMap, "id", o.ID) populate(objectMap, "name", o.Name) populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) populate(objectMap, "type", o.Type) return json.Marshal(objectMap) } @@ -2965,6 +3299,9 @@ func (o *OutboundNetworkDependenciesEndpoint) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &o.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &o.Type) delete(rawMsg, key) @@ -3088,6 +3425,7 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } @@ -3101,6 +3439,9 @@ func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) @@ -3224,6 +3565,7 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } @@ -3237,6 +3579,9 @@ func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) @@ -3326,6 +3671,7 @@ func (r ReadOnlyFollowingDatabase) MarshalJSON() ([]byte, error) { populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -3354,6 +3700,9 @@ func (r *ReadOnlyFollowingDatabase) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -3440,6 +3789,7 @@ func (r ReadWriteDatabase) MarshalJSON() ([]byte, error) { populate(objectMap, "location", r.Location) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -3468,6 +3818,9 @@ func (r *ReadWriteDatabase) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -3642,6 +3995,7 @@ func (s *SKUDescription) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SKUDescriptionList. func (s SKUDescriptionList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -3655,6 +4009,9 @@ func (s *SKUDescriptionList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -3707,6 +4064,7 @@ func (s SandboxCustomImage) MarshalJSON() ([]byte, error) { populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -3729,6 +4087,9 @@ func (s *SandboxCustomImage) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -3922,6 +4283,7 @@ func (s *ScriptCheckNameRequest) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScriptListResult. func (s ScriptListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -3935,6 +4297,9 @@ func (s *ScriptListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -3951,6 +4316,7 @@ func (s ScriptProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "continueOnErrors", s.ContinueOnErrors) populate(objectMap, "forceUpdateTag", s.ForceUpdateTag) + populate(objectMap, "managedIdentityResourceId", s.ManagedIdentityResourceID) populate(objectMap, "principalPermissionsAction", s.PrincipalPermissionsAction) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "scriptContent", s.ScriptContent) @@ -3975,6 +4341,9 @@ func (s *ScriptProperties) UnmarshalJSON(data []byte) error { case "forceUpdateTag": err = unpopulate(val, "ForceUpdateTag", &s.ForceUpdateTag) delete(rawMsg, key) + case "managedIdentityResourceId": + err = unpopulate(val, "ManagedIdentityResourceID", &s.ManagedIdentityResourceID) + delete(rawMsg, key) case "principalPermissionsAction": err = unpopulate(val, "PrincipalPermissionsAction", &s.PrincipalPermissionsAction) delete(rawMsg, key) @@ -4004,7 +4373,7 @@ func (s *ScriptProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SuspensionDetails. func (s SuspensionDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "suspensionStartDate", s.SuspensionStartDate) + populateTime[datetime.RFC3339](objectMap, "suspensionStartDate", s.SuspensionStartDate) return json.Marshal(objectMap) } @@ -4018,7 +4387,7 @@ func (s *SuspensionDetails) UnmarshalJSON(data []byte) error { var err error switch key { case "suspensionStartDate": - err = unpopulateDateTimeRFC3339(val, "SuspensionStartDate", &s.SuspensionStartDate) + err = unpopulateTime[datetime.RFC3339](val, "SuspensionStartDate", &s.SuspensionStartDate) delete(rawMsg, key) } if err != nil { @@ -4031,10 +4400,10 @@ func (s *SuspensionDetails) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateTime[datetime.RFC3339](objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateTime[datetime.RFC3339](objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -4050,7 +4419,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateTime[datetime.RFC3339](val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -4059,7 +4428,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateTime[datetime.RFC3339](val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -4206,6 +4575,17 @@ func populate(m map[string]any, k string, v any) { } } +func populateTime[T dateTimeConstraints](m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + } else if !reflect.ValueOf(t).IsNil() { + newTime := T(*t) + m[k] = (*T)(&newTime) + } +} + func populateAny(m map[string]any, k string, v any) { if v == nil { return @@ -4225,3 +4605,20 @@ func unpopulate(data json.RawMessage, fn string, v any) error { } return nil } + +func unpopulateTime[T dateTimeConstraints](data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux T + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + newTime := time.Time(aux) + *t = &newTime + return nil +} + +type dateTimeConstraints interface { + datetime.PlainDate | datetime.PlainTime | datetime.RFC1123 | datetime.RFC3339 | datetime.Unix +} diff --git a/sdk/resourcemanager/kusto/armkusto/operations_client.go b/sdk/resourcemanager/kusto/armkusto/operations_client.go index 610dd7f4c118..730645c00d74 100644 --- a/sdk/resourcemanager/kusto/armkusto/operations_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operations_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -12,17 +11,20 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" + "strings" ) // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. +// +// Generated from API version 2025-02-14 type OperationsClient struct { internal *arm.Client } // NewOperationsClient creates a new instance of OperationsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -34,9 +36,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Lists available operations for the Microsoft.Kusto provider. -// -// Generated from API version 2024-04-13 +// NewListPager - List the operations for the provider // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -62,15 +62,15 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Kusto/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go index 0e1c75ad5f78..f5246a311e15 100644 --- a/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/operations_client_example_test.go @@ -1,27 +1,24 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoOperationsList.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,17 +33,20 @@ func ExampleOperationsClient_NewListPager() { _ = 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"), + // page = armkusto.OperationsClientListResponse{ + // 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 b94a3696aabf..fbaef1e3062d 100644 --- a/sdk/resourcemanager/kusto/armkusto/operationsresults_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresults_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // OperationsResultsClient contains the methods for the OperationsResults group. // Don't use this type directly, use NewOperationsResultsClient() instead. +// +// Generated from API version 2025-02-14 type OperationsResultsClient struct { internal *arm.Client subscriptionID string } // NewOperationsResultsClient creates a new instance of OperationsResultsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperationsResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,9 +43,7 @@ func NewOperationsResultsClient(subscriptionID string, credential azcore.TokenCr // Get - Returns operation results. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 -// - location - The name of Azure region. +// - location - The name of the Azure region. // - 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) { @@ -70,7 +69,7 @@ func (client *OperationsResultsClient) Get(ctx context.Context, location string, } // getCreateRequest creates the Get request. -func (client *OperationsResultsClient) getCreateRequest(ctx context.Context, location string, operationID string, options *OperationsResultsClientGetOptions) (*policy.Request, error) { +func (client *OperationsResultsClient) getCreateRequest(ctx context.Context, location string, operationID string, _ *OperationsResultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationResults/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -89,8 +88,8 @@ func (client *OperationsResultsClient) getCreateRequest(ctx context.Context, loc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go index 1db1ce424ba1..a0ef5f488afb 100644 --- a/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresults_client_example_test.go @@ -1,27 +1,24 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoOperationResultsGet.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -32,20 +29,22 @@ func ExampleOperationsResultsClient_Get() { // 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.702Z"); 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"), + // res = armkusto.OperationsResultsClientGetResponse{ + // 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), // }, - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-10-26T13:45:39.655Z"); 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 fa0e8b447218..4a0451cf188f 100644 --- a/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // OperationsResultsLocationClient contains the methods for the OperationsResultsLocation group. // Don't use this type directly, use NewOperationsResultsLocationClient() instead. +// +// Generated from API version 2025-02-14 type OperationsResultsLocationClient struct { internal *arm.Client subscriptionID string } // NewOperationsResultsLocationClient creates a new instance of OperationsResultsLocationClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperationsResultsLocationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsResultsLocationClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,9 +43,7 @@ func NewOperationsResultsLocationClient(subscriptionID string, credential azcore // Get - Returns operation results. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 -// - location - The name of Azure region. +// - location - The name of the Azure region. // - operationID - The ID of an ongoing async operation. // - options - OperationsResultsLocationClientGetOptions contains the optional parameters for the OperationsResultsLocationClient.Get // method. @@ -71,8 +70,8 @@ func (client *OperationsResultsLocationClient) Get(ctx context.Context, location } // getCreateRequest creates the Get request. -func (client *OperationsResultsLocationClient) getCreateRequest(ctx context.Context, location string, operationID string, options *OperationsResultsLocationClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationResults/{operationId}" +func (client *OperationsResultsLocationClient) getCreateRequest(ctx context.Context, location string, operationID string, _ *OperationsResultsLocationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationResults/{operationId}?operationResultResponseType=Location" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -90,8 +89,9 @@ func (client *OperationsResultsLocationClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + reqQP.Set("operationResultResponseType", "Location") + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go index 2e754b010375..3a1ec8bb3386 100644 --- a/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/operationsresultslocation_client_example_test.go @@ -1,32 +1,34 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoOperationResultsOperationResultResponseTypeGet.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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) + res, err := clientFactory.NewOperationsResultsLocationClient().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 = armkusto.OperationsResultsLocationClientGetResponse{ + // } } diff --git a/sdk/resourcemanager/kusto/armkusto/options.go b/sdk/resourcemanager/kusto/armkusto/options.go index b271425f0515..d72445ed59ff 100644 --- a/sdk/resourcemanager/kusto/armkusto/options.go +++ b/sdk/resourcemanager/kusto/armkusto/options.go @@ -1,21 +1,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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto // AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the AttachedDatabaseConfigurationsClient.BeginCreateOrUpdate // method. type AttachedDatabaseConfigurationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -40,14 +39,14 @@ type AttachedDatabaseConfigurationsClientListByClusterOptions struct { // ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ClusterPrincipalAssignmentsClient.BeginCreateOrUpdate // method. type ClusterPrincipalAssignmentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -72,14 +71,14 @@ type ClusterPrincipalAssignmentsClientListOptions struct { // ClustersClientBeginAddCalloutPoliciesOptions contains the optional parameters for the ClustersClient.BeginAddCalloutPolicies // method. type ClustersClientBeginAddCalloutPoliciesOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginAddLanguageExtensionsOptions contains the optional parameters for the ClustersClient.BeginAddLanguageExtensions // method. type ClustersClientBeginAddLanguageExtensionsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -93,59 +92,59 @@ type ClustersClientBeginCreateOrUpdateOptions struct { // in a 412 Pre-condition Failed response. IfNoneMatch *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginRemoveCalloutPolicyOptions contains the optional parameters for the ClustersClient.BeginRemoveCalloutPolicy // method. type ClustersClientBeginRemoveCalloutPolicyOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -155,7 +154,7 @@ type ClustersClientBeginUpdateOptions struct { // accidentally overwriting concurrent changes. IfMatch *string - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -225,26 +224,26 @@ type ClustersClientListSKUsOptions struct { // DataConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the DataConnectionsClient.BeginCreateOrUpdate // method. type DataConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -273,14 +272,14 @@ type DatabaseClientInviteFollowerOptions struct { // DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasePrincipalAssignmentsClient.BeginCreateOrUpdate // method. type DatabasePrincipalAssignmentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -314,13 +313,13 @@ type DatabasesClientBeginCreateOrUpdateOptions struct { // the caller from Admins list. CallerRole *CallerRole - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -330,7 +329,7 @@ type DatabasesClientBeginUpdateOptions struct { // the caller from Admins list. CallerRole *CallerRole - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -348,8 +347,8 @@ type DatabasesClientGetOptions struct { // 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. + // 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 @@ -369,21 +368,21 @@ type DatabasesClientRemovePrincipalsOptions struct { // ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the ManagedPrivateEndpointsClient.BeginCreateOrUpdate // method. type ManagedPrivateEndpointsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -423,14 +422,14 @@ type OperationsResultsLocationClientGetOptions struct { // PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate // method. type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -465,21 +464,21 @@ type SKUsClientListOptions struct { // SandboxCustomImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the SandboxCustomImagesClient.BeginCreateOrUpdate // method. type SandboxCustomImagesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SandboxCustomImagesClientBeginDeleteOptions contains the optional parameters for the SandboxCustomImagesClient.BeginDelete // method. type SandboxCustomImagesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SandboxCustomImagesClientBeginUpdateOptions contains the optional parameters for the SandboxCustomImagesClient.BeginUpdate // method. type SandboxCustomImagesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -502,19 +501,19 @@ type SandboxCustomImagesClientListByClusterOptions struct { // ScriptsClientBeginCreateOrUpdateOptions contains the optional parameters for the ScriptsClient.BeginCreateOrUpdate method. type ScriptsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go b/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go index c909e00fe911..5ab478aa843f 100644 --- a/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go +++ b/sdk/resourcemanager/kusto/armkusto/polymorphic_helpers.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -21,8 +20,12 @@ func unmarshalDataConnectionClassification(rawMsg json.RawMessage) (DataConnecti b = &CosmosDbDataConnection{} case string(DataConnectionKindEventGrid): b = &EventGridDataConnection{} + case string(DataConnectionKindEventGridWithManagedIdentity): + b = &EventGridDataConnectionWithManagedIdentity{} case string(DataConnectionKindEventHub): b = &EventHubDataConnection{} + case string(DataConnectionKindEventHubWithManagedIdentity): + b = &EventHubDataConnectionWithManagedIdentity{} case string(DataConnectionKindIotHub): b = &IotHubDataConnection{} default: diff --git a/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go index fedbae99bedc..38b501cb36c7 100644 --- a/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go +++ b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. // Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +// +// Generated from API version 2025-02-14 type PrivateEndpointConnectionsClient struct { internal *arm.Client subscriptionID string } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -68,8 +67,6 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" @@ -92,7 +89,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Conte } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, _ *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +112,10 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -126,8 +124,6 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -152,8 +148,6 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes a private endpoint connection with a given name. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -176,7 +170,7 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -199,16 +193,13 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets a private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -237,7 +228,7 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourc } // getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -260,8 +251,8 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -276,8 +267,6 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListPager - Returns the list of private endpoint connections. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -285,21 +274,20 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, clusterName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{ More: func(page PrivateEndpointConnectionsClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return PrivateEndpointConnectionsClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return PrivateEndpointConnectionsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -307,7 +295,7 @@ func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName s } // listCreateRequest creates the List request. -func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -326,8 +314,8 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go index a19a8a68c33d..d4576ab21410 100644 --- a/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/privateendpointconnections_client_example_test.go @@ -1,179 +1,188 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoPrivateEndpointConnectionsList.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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"), - // }, - // }}, - // } + 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 poll 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.PrivateEndpointConnectionsClientCreateOrUpdateResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoPrivateEndpointConnectionsGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "kustorptest", "kustoCluster", "privateEndpointTest", nil) + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "privateEndpointTest", 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 poll 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/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"), - // }, + // res = armkusto.PrivateEndpointConnectionsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoPrivateEndpointConnectionsCreateOrUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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) + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "kustorptest", "kustoCluster", "privateEndpointTest", 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"), + // res = armkusto.PrivateEndpointConnectionsClientGetResponse{ + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoPrivateEndpointConnectionsDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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) + 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 = armkusto.PrivateEndpointConnectionsClientListResponse{ + // 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"), + // }, + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go index 9a2875a47656..253860175c50 100644 --- a/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go +++ b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. // Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +// +// Generated from API version 2025-02-14 type PrivateLinkResourcesClient struct { internal *arm.Client subscriptionID string } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets a private link resource. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - privateLinkResourceName - The name of the private link resource. @@ -72,7 +71,7 @@ func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string, _ *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -95,8 +94,8 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -111,8 +110,6 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) } // NewListPager - Returns the list of private link resources. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager @@ -120,21 +117,20 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, clusterName string, options *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListResponse]{ More: func(page PrivateLinkResourcesClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListResponse) (PrivateLinkResourcesClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkResourcesClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return PrivateLinkResourcesClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return PrivateLinkResourcesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -142,7 +138,7 @@ func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,8 +157,8 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go index 672814440afe..805aae134df2 100644 --- a/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/privatelinkresources_client_example_test.go @@ -1,27 +1,70 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoPrivateLinkResourcesList.json +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 = armkusto.PrivateLinkResourcesClientGetResponse{ + // 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"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,72 +79,35 @@ func ExamplePrivateLinkResourcesClient_NewListPager() { _ = 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")}, + // page = armkusto.PrivateLinkResourcesClientListResponse{ + // 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")}, + // to.Ptr("privatelink.table.core.windows.net"), // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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/responses.go b/sdk/resourcemanager/kusto/armkusto/responses.go index 2b2792240531..94f32bdcafbe 100644 --- a/sdk/resourcemanager/kusto/armkusto/responses.go +++ b/sdk/resourcemanager/kusto/armkusto/responses.go @@ -1,12 +1,9 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto -import "encoding/json" - // AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse contains the response from method AttachedDatabaseConfigurationsClient.CheckNameAvailability. type AttachedDatabaseConfigurationsClientCheckNameAvailabilityResponse struct { // The result returned from a check name availability request. @@ -140,7 +137,7 @@ type ClustersClientListLanguageExtensionsResponse struct { // ClustersClientListOutboundNetworkDependenciesEndpointsResponse contains the response from method ClustersClient.NewListOutboundNetworkDependenciesEndpointsPager. type ClustersClientListOutboundNetworkDependenciesEndpointsResponse struct { - // Collection of Outbound Environment Endpoints + // The response of a OutboundNetworkDependenciesEndpoint list operation. OutboundNetworkDependenciesEndpointListResult } @@ -205,21 +202,6 @@ type DataConnectionsClientCreateOrUpdateResponse struct { DataConnectionClassification } -// MarshalJSON implements the json.Marshaller interface for type DataConnectionsClientCreateOrUpdateResponse. -func (d DataConnectionsClientCreateOrUpdateResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(d.DataConnectionClassification) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionsClientCreateOrUpdateResponse. -func (d *DataConnectionsClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalDataConnectionClassification(data) - if err != nil { - return err - } - d.DataConnectionClassification = res - return nil -} - // DataConnectionsClientDataConnectionValidationResponse contains the response from method DataConnectionsClient.BeginDataConnectionValidation. type DataConnectionsClientDataConnectionValidationResponse struct { // The list Kusto data connection validation result. @@ -237,16 +219,6 @@ type DataConnectionsClientGetResponse struct { DataConnectionClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionsClientGetResponse. -func (d *DataConnectionsClientGetResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalDataConnectionClassification(data) - if err != nil { - return err - } - d.DataConnectionClassification = res - return nil -} - // DataConnectionsClientListByDatabaseResponse contains the response from method DataConnectionsClient.NewListByDatabasePager. type DataConnectionsClientListByDatabaseResponse struct { // The list Kusto data connections operation response. @@ -259,21 +231,6 @@ type DataConnectionsClientUpdateResponse struct { DataConnectionClassification } -// MarshalJSON implements the json.Marshaller interface for type DataConnectionsClientUpdateResponse. -func (d DataConnectionsClientUpdateResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(d.DataConnectionClassification) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionsClientUpdateResponse. -func (d *DataConnectionsClientUpdateResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalDataConnectionClassification(data) - if err != nil { - return err - } - d.DataConnectionClassification = res - return nil -} - // DatabaseClientInviteFollowerResponse contains the response from method DatabaseClient.InviteFollower. type DatabaseClientInviteFollowerResponse struct { // The result returned from a follower invitation generation request. @@ -327,21 +284,6 @@ type DatabasesClientCreateOrUpdateResponse struct { DatabaseClassification } -// MarshalJSON implements the json.Marshaller interface for type DatabasesClientCreateOrUpdateResponse. -func (d DatabasesClientCreateOrUpdateResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(d.DatabaseClassification) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasesClientCreateOrUpdateResponse. -func (d *DatabasesClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalDatabaseClassification(data) - if err != nil { - return err - } - d.DatabaseClassification = res - return nil -} - // DatabasesClientDeleteResponse contains the response from method DatabasesClient.BeginDelete. type DatabasesClientDeleteResponse struct { // placeholder for future response values @@ -353,19 +295,9 @@ type DatabasesClientGetResponse struct { DatabaseClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasesClientGetResponse. -func (d *DatabasesClientGetResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalDatabaseClassification(data) - if err != nil { - return err - } - d.DatabaseClassification = res - return nil -} - // DatabasesClientListByClusterResponse contains the response from method DatabasesClient.NewListByClusterPager. type DatabasesClientListByClusterResponse struct { - // The list Kusto databases operation response. + // The response of a Database list operation. DatabaseListResult } @@ -387,21 +319,6 @@ type DatabasesClientUpdateResponse struct { DatabaseClassification } -// MarshalJSON implements the json.Marshaller interface for type DatabasesClientUpdateResponse. -func (d DatabasesClientUpdateResponse) MarshalJSON() ([]byte, error) { - return json.Marshal(d.DatabaseClassification) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasesClientUpdateResponse. -func (d *DatabasesClientUpdateResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalDatabaseClassification(data) - if err != nil { - return err - } - d.DatabaseClassification = res - return nil -} - // ManagedPrivateEndpointsClientCheckNameAvailabilityResponse contains the response from method ManagedPrivateEndpointsClient.CheckNameAvailability. type ManagedPrivateEndpointsClientCheckNameAvailabilityResponse struct { // The result returned from a check name availability request. @@ -439,6 +356,9 @@ type ManagedPrivateEndpointsClientUpdateResponse struct { // 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. + // // 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 @@ -452,7 +372,7 @@ type OperationsResultsClientGetResponse struct { // OperationsResultsLocationClientGetResponse contains the response from method OperationsResultsLocationClient.Get. type OperationsResultsLocationClientGetResponse struct { - // AzureAsyncOperation contains the information returned from the Azure-AsyncOperation header response. + // URL to query the status of the operation. AzureAsyncOperation *string } diff --git a/sdk/resourcemanager/kusto/armkusto/responses_serde.go b/sdk/resourcemanager/kusto/armkusto/responses_serde.go new file mode 100644 index 000000000000..1044e62c546d --- /dev/null +++ b/sdk/resourcemanager/kusto/armkusto/responses_serde.go @@ -0,0 +1,87 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armkusto + +import "encoding/json" + +// MarshalJSON implements the json.Marshaller interface for type DataConnectionsClientCreateOrUpdateResponse. +func (d DataConnectionsClientCreateOrUpdateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(d.DataConnectionClassification) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionsClientCreateOrUpdateResponse. +func (d *DataConnectionsClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalDataConnectionClassification(data) + if err != nil { + return err + } + d.DataConnectionClassification = res + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionsClientGetResponse. +func (d *DataConnectionsClientGetResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalDataConnectionClassification(data) + if err != nil { + return err + } + d.DataConnectionClassification = res + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataConnectionsClientUpdateResponse. +func (d DataConnectionsClientUpdateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(d.DataConnectionClassification) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectionsClientUpdateResponse. +func (d *DataConnectionsClientUpdateResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalDataConnectionClassification(data) + if err != nil { + return err + } + d.DataConnectionClassification = res + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasesClientCreateOrUpdateResponse. +func (d DatabasesClientCreateOrUpdateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(d.DatabaseClassification) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasesClientCreateOrUpdateResponse. +func (d *DatabasesClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalDatabaseClassification(data) + if err != nil { + return err + } + d.DatabaseClassification = res + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasesClientGetResponse. +func (d *DatabasesClientGetResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalDatabaseClassification(data) + if err != nil { + return err + } + d.DatabaseClassification = res + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabasesClientUpdateResponse. +func (d DatabasesClientUpdateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(d.DatabaseClassification) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabasesClientUpdateResponse. +func (d *DatabasesClientUpdateResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalDatabaseClassification(data) + if err != nil { + return err + } + d.DatabaseClassification = res + return nil +} diff --git a/sdk/resourcemanager/kusto/armkusto/sandboxcustomimages_client.go b/sdk/resourcemanager/kusto/armkusto/sandboxcustomimages_client.go index e49d3b9cbbbb..99812ad3fa3e 100644 --- a/sdk/resourcemanager/kusto/armkusto/sandboxcustomimages_client.go +++ b/sdk/resourcemanager/kusto/armkusto/sandboxcustomimages_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // SandboxCustomImagesClient contains the methods for the SandboxCustomImages group. // Don't use this type directly, use NewSandboxCustomImagesClient() instead. +// +// Generated from API version 2025-02-14 type SandboxCustomImagesClient struct { internal *arm.Client subscriptionID string } // NewSandboxCustomImagesClient creates a new instance of SandboxCustomImagesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSandboxCustomImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SandboxCustomImagesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewSandboxCustomImagesClient(subscriptionID string, credential azcore.Token // CheckNameAvailability - Checks that the sandbox custom image resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - resourceName - The name of the resource. @@ -72,8 +71,12 @@ func (client *SandboxCustomImagesClient) CheckNameAvailability(ctx context.Conte } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *SandboxCustomImagesClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, resourceName SandboxCustomImagesCheckNameRequest, options *SandboxCustomImagesClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *SandboxCustomImagesClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, resourceName SandboxCustomImagesCheckNameRequest, _ *SandboxCustomImagesClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/sandboxCustomImagesCheckNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -82,18 +85,15 @@ func (client *SandboxCustomImagesClient) checkNameAvailabilityCreateRequest(ctx return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resourceName); err != nil { return nil, err } @@ -111,8 +111,6 @@ func (client *SandboxCustomImagesClient) checkNameAvailabilityHandleResponse(res // BeginCreateOrUpdate - Creates or updates a sandbox custom image. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - sandboxCustomImageName - The name of the sandbox custom image. @@ -138,8 +136,6 @@ func (client *SandboxCustomImagesClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Creates or updates a sandbox custom image. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *SandboxCustomImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, parameters SandboxCustomImage, options *SandboxCustomImagesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "SandboxCustomImagesClient.BeginCreateOrUpdate" @@ -162,7 +158,7 @@ func (client *SandboxCustomImagesClient) createOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SandboxCustomImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, parameters SandboxCustomImage, options *SandboxCustomImagesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SandboxCustomImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, parameters SandboxCustomImage, _ *SandboxCustomImagesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/sandboxCustomImages/{sandboxCustomImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -185,9 +181,10 @@ func (client *SandboxCustomImagesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -196,8 +193,6 @@ func (client *SandboxCustomImagesClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Deletes a sandbox custom image. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - sandboxCustomImageName - The name of the sandbox custom image. @@ -222,8 +217,6 @@ func (client *SandboxCustomImagesClient) BeginDelete(ctx context.Context, resour // Delete - Deletes a sandbox custom image. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *SandboxCustomImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, options *SandboxCustomImagesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SandboxCustomImagesClient.BeginDelete" @@ -246,7 +239,7 @@ func (client *SandboxCustomImagesClient) deleteOperation(ctx context.Context, re } // deleteCreateRequest creates the Delete request. -func (client *SandboxCustomImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, options *SandboxCustomImagesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SandboxCustomImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, _ *SandboxCustomImagesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/sandboxCustomImages/{sandboxCustomImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,16 +262,13 @@ func (client *SandboxCustomImagesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Returns a sandbox custom image // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - sandboxCustomImageName - The name of the sandbox custom image. @@ -306,7 +296,7 @@ func (client *SandboxCustomImagesClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *SandboxCustomImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, options *SandboxCustomImagesClientGetOptions) (*policy.Request, error) { +func (client *SandboxCustomImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, _ *SandboxCustomImagesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/sandboxCustomImages/{sandboxCustomImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -329,8 +319,8 @@ func (client *SandboxCustomImagesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -345,8 +335,6 @@ func (client *SandboxCustomImagesClient) getHandleResponse(resp *http.Response) } // NewListByClusterPager - Returns the list of the existing sandbox custom images of the given Kusto cluster. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - options - SandboxCustomImagesClientListByClusterOptions contains the optional parameters for the SandboxCustomImagesClient.NewListByClusterPager @@ -354,21 +342,20 @@ func (client *SandboxCustomImagesClient) getHandleResponse(resp *http.Response) func (client *SandboxCustomImagesClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *SandboxCustomImagesClientListByClusterOptions) *runtime.Pager[SandboxCustomImagesClientListByClusterResponse] { return runtime.NewPager(runtime.PagingHandler[SandboxCustomImagesClientListByClusterResponse]{ More: func(page SandboxCustomImagesClientListByClusterResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SandboxCustomImagesClientListByClusterResponse) (SandboxCustomImagesClientListByClusterResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SandboxCustomImagesClient.NewListByClusterPager") - req, err := client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) - if err != nil { - return SandboxCustomImagesClientListByClusterResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + }, nil) if err != nil { return SandboxCustomImagesClientListByClusterResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SandboxCustomImagesClientListByClusterResponse{}, runtime.NewResponseError(resp) - } return client.listByClusterHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -376,8 +363,12 @@ func (client *SandboxCustomImagesClient) NewListByClusterPager(resourceGroupName } // listByClusterCreateRequest creates the ListByCluster request. -func (client *SandboxCustomImagesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *SandboxCustomImagesClientListByClusterOptions) (*policy.Request, error) { +func (client *SandboxCustomImagesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *SandboxCustomImagesClientListByClusterOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/sandboxCustomImages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -386,17 +377,13 @@ func (client *SandboxCustomImagesClient) listByClusterCreateRequest(ctx context. return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -412,8 +399,6 @@ func (client *SandboxCustomImagesClient) listByClusterHandleResponse(resp *http. // BeginUpdate - Updates a sandbox custom image. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - sandboxCustomImageName - The name of the sandbox custom image. @@ -439,8 +424,6 @@ func (client *SandboxCustomImagesClient) BeginUpdate(ctx context.Context, resour // Update - Updates a sandbox custom image. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *SandboxCustomImagesClient) update(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, parameters SandboxCustomImage, options *SandboxCustomImagesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "SandboxCustomImagesClient.BeginUpdate" @@ -463,7 +446,7 @@ func (client *SandboxCustomImagesClient) update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *SandboxCustomImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, parameters SandboxCustomImage, options *SandboxCustomImagesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *SandboxCustomImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, sandboxCustomImageName string, parameters SandboxCustomImage, _ *SandboxCustomImagesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/sandboxCustomImages/{sandboxCustomImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -486,9 +469,10 @@ func (client *SandboxCustomImagesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/kusto/armkusto/sandboxcustomimages_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/sandboxcustomimages_client_example_test.go index c0729dd18143..fdc14c052dfd 100644 --- a/sdk/resourcemanager/kusto/armkusto/sandboxcustomimages_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/sandboxcustomimages_client_example_test.go @@ -1,109 +1,55 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSandboxCustomImagesList.json -func ExampleSandboxCustomImagesClient_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.NewSandboxCustomImagesClient().NewListByClusterPager("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.SandboxCustomImagesListResult = armkusto.SandboxCustomImagesListResult{ - // Value: []*armkusto.SandboxCustomImage{ - // { - // Name: to.Ptr("kustoCluster/customImage7"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), - // ID: to.Ptr("/subscriptions/f12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage7"), - // Properties: &armkusto.SandboxCustomImageProperties{ - // LanguageVersion: to.Ptr("3.10.8"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RequirementsFileContent: to.Ptr("Requests"), - // Language: to.Ptr(armkusto.LanguagePython), - // }, - // }, - // { - // Name: to.Ptr("kustoCluster/customImage8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), - // ID: to.Ptr("/subscriptions/f12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage8"), - // Properties: &armkusto.SandboxCustomImageProperties{ - // LanguageVersion: to.Ptr("3.9.7"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RequirementsFileContent: to.Ptr("PyTorch"), - // Language: to.Ptr(armkusto.LanguagePython), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSandboxCustomImagesGet.json -func ExampleSandboxCustomImagesClient_Get() { +// Generated from example definition: 2025-02-14/KustoSandboxCustomImagesCheckNameAvailability.json +func ExampleSandboxCustomImagesClient_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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSandboxCustomImagesClient().Get(ctx, "kustorptest", "kustoCluster", "customImage8", nil) + res, err := clientFactory.NewSandboxCustomImagesClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.SandboxCustomImagesCheckNameRequest{ + Name: to.Ptr("sandboxCustomImage1"), + Type: to.Ptr("Microsoft.Kusto/clusters/sandboxCustomImages"), + }, 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.SandboxCustomImage = armkusto.SandboxCustomImage{ - // Name: to.Ptr("kustoCluster/customImage8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), - // ID: to.Ptr("/subscriptions/f12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage8"), - // Properties: &armkusto.SandboxCustomImageProperties{ - // LanguageVersion: to.Ptr("3.10.8"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RequirementsFileContent: to.Ptr("Requests"), - // Language: to.Ptr(armkusto.LanguagePython), + // res = armkusto.SandboxCustomImagesClientCheckNameAvailabilityResponse{ + // CheckNameResult: armkusto.CheckNameResult{ + // Name: to.Ptr("sandboxCustomImage1"), + // Message: to.Ptr("Name 'sandboxCustomImage1' 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSandboxCustomImagesCreateOrUpdate.json +// Generated from example definition: 2025-02-14/KustoSandboxCustomImagesCreateOrUpdate.json func ExampleSandboxCustomImagesClient_BeginCreateOrUpdate_kustoSandboxCustomImagesCreateOrUpdate() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -119,32 +65,34 @@ func ExampleSandboxCustomImagesClient_BeginCreateOrUpdate_kustoSandboxCustomImag } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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.SandboxCustomImage = armkusto.SandboxCustomImage{ - // Name: to.Ptr("kustoCluster/customImage8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage8"), - // Properties: &armkusto.SandboxCustomImageProperties{ - // LanguageVersion: to.Ptr("3.10.8"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RequirementsFileContent: to.Ptr("Requests"), - // Language: to.Ptr(armkusto.LanguagePython), + // res = armkusto.SandboxCustomImagesClientCreateOrUpdateResponse{ + // SandboxCustomImage: armkusto.SandboxCustomImage{ + // Name: to.Ptr("kustoCluster/customImage8"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage8"), + // Properties: &armkusto.SandboxCustomImageProperties{ + // LanguageVersion: to.Ptr("3.10.8"), + // ProvisioningState: to.Ptr(armkusto.ProvisioningState("Accepted")), + // RequirementsFileContent: to.Ptr("Requests"), + // Language: to.Ptr(armkusto.LanguagePython), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSandboxCustomImagesCreateOrUpdateWithCustomBaseImage.json +// Generated from example definition: 2025-02-14/KustoSandboxCustomImagesCreateOrUpdateWithCustomBaseImage.json func ExampleSandboxCustomImagesClient_BeginCreateOrUpdate_kustoSandboxCustomImagesCreateOrUpdateWithCustomBaseImage() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -160,32 +108,34 @@ func ExampleSandboxCustomImagesClient_BeginCreateOrUpdate_kustoSandboxCustomImag } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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.SandboxCustomImage = armkusto.SandboxCustomImage{ - // Name: to.Ptr("kustoCluster/customImage2"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage2"), - // Properties: &armkusto.SandboxCustomImageProperties{ - // BaseImageName: to.Ptr("customImage1"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RequirementsFileContent: to.Ptr("Requests"), - // Language: to.Ptr(armkusto.LanguagePython), + // res = armkusto.SandboxCustomImagesClientCreateOrUpdateResponse{ + // SandboxCustomImage: armkusto.SandboxCustomImage{ + // Name: to.Ptr("kustoCluster/customImage2"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage2"), + // Properties: &armkusto.SandboxCustomImageProperties{ + // BaseImageName: to.Ptr("customImage1"), + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // RequirementsFileContent: to.Ptr("Requests"), + // Language: to.Ptr(armkusto.LanguagePython), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSandboxCustomImagesCreateOrUpdateWithManagedBaseImage.json +// Generated from example definition: 2025-02-14/KustoSandboxCustomImagesCreateOrUpdateWithManagedBaseImage.json func ExampleSandboxCustomImagesClient_BeginCreateOrUpdate_kustoSandboxCustomImagesCreateOrUpdateWithManagedBaseImage() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -201,110 +151,177 @@ func ExampleSandboxCustomImagesClient_BeginCreateOrUpdate_kustoSandboxCustomImag } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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.SandboxCustomImage = armkusto.SandboxCustomImage{ - // Name: to.Ptr("kustoCluster/customImage2"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage2"), - // Properties: &armkusto.SandboxCustomImageProperties{ - // BaseImageName: to.Ptr("Python3_10_8"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RequirementsFileContent: to.Ptr("Requests"), - // Language: to.Ptr(armkusto.LanguagePython), + // res = armkusto.SandboxCustomImagesClientCreateOrUpdateResponse{ + // SandboxCustomImage: armkusto.SandboxCustomImage{ + // Name: to.Ptr("kustoCluster/customImage2"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage2"), + // Properties: &armkusto.SandboxCustomImageProperties{ + // BaseImageName: to.Ptr("Python3_10_8"), + // ProvisioningState: to.Ptr(armkusto.ProvisioningState("Accepted")), + // RequirementsFileContent: to.Ptr("Requests"), + // Language: to.Ptr(armkusto.LanguagePython), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSandboxCustomImageUpdate.json -func ExampleSandboxCustomImagesClient_BeginUpdate() { +// Generated from example definition: 2025-02-14/KustoSandboxCustomImageDelete.json +func ExampleSandboxCustomImagesClient_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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSandboxCustomImagesClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "customImage8", armkusto.SandboxCustomImage{ - Properties: &armkusto.SandboxCustomImageProperties{ - LanguageVersion: to.Ptr("3.10.8"), - RequirementsFileContent: to.Ptr("Requests"), - Language: to.Ptr(armkusto.LanguagePython), - }, - }, nil) + poller, err := clientFactory.NewSandboxCustomImagesClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "customImage8", 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) + log.Fatalf("failed to poll 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.SandboxCustomImage = armkusto.SandboxCustomImage{ - // Name: to.Ptr("kustoCluster/customImage8"), - // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage8"), - // Properties: &armkusto.SandboxCustomImageProperties{ - // LanguageVersion: to.Ptr("3.10.8"), - // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), - // RequirementsFileContent: to.Ptr("Requests"), - // Language: to.Ptr(armkusto.LanguagePython), - // }, + // res = armkusto.SandboxCustomImagesClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSandboxCustomImageDelete.json -func ExampleSandboxCustomImagesClient_BeginDelete() { +// Generated from example definition: 2025-02-14/KustoSandboxCustomImagesGet.json +func ExampleSandboxCustomImagesClient_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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSandboxCustomImagesClient().BeginDelete(ctx, "kustorptest", "kustoCluster", "customImage8", nil) + res, err := clientFactory.NewSandboxCustomImagesClient().Get(ctx, "kustorptest", "kustoCluster", "customImage8", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + // 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.SandboxCustomImagesClientGetResponse{ + // SandboxCustomImage: armkusto.SandboxCustomImage{ + // Name: to.Ptr("kustoCluster/customImage8"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), + // ID: to.Ptr("/subscriptions/f12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage8"), + // Properties: &armkusto.SandboxCustomImageProperties{ + // LanguageVersion: to.Ptr("3.10.8"), + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // RequirementsFileContent: to.Ptr("Requests"), + // Language: to.Ptr(armkusto.LanguagePython), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-14/KustoSandboxCustomImagesList.json +func ExampleSandboxCustomImagesClient_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("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSandboxCustomImagesClient().NewListByClusterPager("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 = armkusto.SandboxCustomImagesClientListByClusterResponse{ + // SandboxCustomImagesListResult: armkusto.SandboxCustomImagesListResult{ + // Value: []*armkusto.SandboxCustomImage{ + // { + // Name: to.Ptr("kustoCluster/customImage7"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), + // ID: to.Ptr("/subscriptions/f12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage7"), + // Properties: &armkusto.SandboxCustomImageProperties{ + // LanguageVersion: to.Ptr("3.10.8"), + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // RequirementsFileContent: to.Ptr("Requests"), + // Language: to.Ptr(armkusto.LanguagePython), + // }, + // }, + // { + // Name: to.Ptr("kustoCluster/customImage8"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), + // ID: to.Ptr("/subscriptions/f12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage8"), + // Properties: &armkusto.SandboxCustomImageProperties{ + // LanguageVersion: to.Ptr("3.9.7"), + // ProvisioningState: to.Ptr(armkusto.ProvisioningStateSucceeded), + // RequirementsFileContent: to.Ptr("PyTorch"), + // Language: to.Ptr(armkusto.LanguagePython), + // }, + // }, + // }, + // }, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSandboxCustomImagesCheckNameAvailability.json -func ExampleSandboxCustomImagesClient_CheckNameAvailability() { +// Generated from example definition: 2025-02-14/KustoSandboxCustomImageUpdate.json +func ExampleSandboxCustomImagesClient_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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSandboxCustomImagesClient().CheckNameAvailability(ctx, "kustorptest", "kustoCluster", armkusto.SandboxCustomImagesCheckNameRequest{ - Name: to.Ptr("sandboxCustomImage1"), - Type: to.Ptr("Microsoft.Kusto/clusters/sandboxCustomImages"), + poller, err := clientFactory.NewSandboxCustomImagesClient().BeginUpdate(ctx, "kustorptest", "kustoCluster", "customImage8", armkusto.SandboxCustomImage{ + Properties: &armkusto.SandboxCustomImageProperties{ + LanguageVersion: to.Ptr("3.10.8"), + RequirementsFileContent: to.Ptr("Requests"), + Language: to.Ptr(armkusto.LanguagePython), + }, }, 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 poll 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.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("sandboxCustomImage1"), - // Message: to.Ptr("Name 'sandboxCustomImage1' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), + // res = armkusto.SandboxCustomImagesClientUpdateResponse{ + // SandboxCustomImage: armkusto.SandboxCustomImage{ + // Name: to.Ptr("kustoCluster/customImage8"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/SandboxCustomImages"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/SandboxCustomImages/customImage8"), + // Properties: &armkusto.SandboxCustomImageProperties{ + // LanguageVersion: to.Ptr("3.10.8"), + // ProvisioningState: to.Ptr(armkusto.ProvisioningState("Accepted")), + // RequirementsFileContent: to.Ptr("Requests"), + // Language: to.Ptr(armkusto.LanguagePython), + // }, + // }, // } } diff --git a/sdk/resourcemanager/kusto/armkusto/scripts_client.go b/sdk/resourcemanager/kusto/armkusto/scripts_client.go index f0d9d2f9e79a..8d2987921cb0 100644 --- a/sdk/resourcemanager/kusto/armkusto/scripts_client.go +++ b/sdk/resourcemanager/kusto/armkusto/scripts_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // ScriptsClient contains the methods for the Scripts group. // Don't use this type directly, use NewScriptsClient() instead. +// +// Generated from API version 2025-02-14 type ScriptsClient struct { internal *arm.Client subscriptionID string } // NewScriptsClient creates a new instance of ScriptsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewScriptsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ScriptsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +43,6 @@ func NewScriptsClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Checks that the script name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -73,8 +72,12 @@ func (client *ScriptsClient) CheckNameAvailability(ctx context.Context, resource } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *ScriptsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName ScriptCheckNameRequest, options *ScriptsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *ScriptsClient) checkNameAvailabilityCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName ScriptCheckNameRequest, _ *ScriptsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scriptsCheckNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } @@ -87,18 +90,15 @@ func (client *ScriptsClient) checkNameAvailabilityCreateRequest(ctx context.Cont return nil, errors.New("parameter databaseName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, scriptName); err != nil { return nil, err } @@ -116,8 +116,6 @@ func (client *ScriptsClient) checkNameAvailabilityHandleResponse(resp *http.Resp // BeginCreateOrUpdate - Creates a Kusto database script. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -144,8 +142,6 @@ func (client *ScriptsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // CreateOrUpdate - Creates a Kusto database script. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 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 const operationName = "ScriptsClient.BeginCreateOrUpdate" @@ -168,7 +164,7 @@ func (client *ScriptsClient) createOrUpdate(ctx context.Context, resourceGroupNa } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ScriptsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script, options *ScriptsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ScriptsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script, _ *ScriptsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,9 +191,10 @@ func (client *ScriptsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -206,8 +203,6 @@ func (client *ScriptsClient) createOrUpdateCreateRequest(ctx context.Context, re // BeginDelete - Deletes a Kusto database script. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -232,8 +227,6 @@ func (client *ScriptsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes a Kusto database script. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 func (client *ScriptsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, options *ScriptsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ScriptsClient.BeginDelete" @@ -256,7 +249,7 @@ func (client *ScriptsClient) deleteOperation(ctx context.Context, resourceGroupN } // deleteCreateRequest creates the Delete request. -func (client *ScriptsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, options *ScriptsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ScriptsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, _ *ScriptsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -283,16 +276,13 @@ func (client *ScriptsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") return req, nil } // Get - Gets a Kusto cluster database script. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -321,7 +311,7 @@ func (client *ScriptsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *ScriptsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, options *ScriptsClientGetOptions) (*policy.Request, error) { +func (client *ScriptsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, _ *ScriptsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -348,8 +338,8 @@ func (client *ScriptsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -364,8 +354,6 @@ func (client *ScriptsClient) getHandleResponse(resp *http.Response) (ScriptsClie } // NewListByDatabasePager - Returns the list of database scripts for given database. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -374,21 +362,20 @@ func (client *ScriptsClient) getHandleResponse(resp *http.Response) (ScriptsClie func (client *ScriptsClient) NewListByDatabasePager(resourceGroupName string, clusterName string, databaseName string, options *ScriptsClientListByDatabaseOptions) *runtime.Pager[ScriptsClientListByDatabaseResponse] { return runtime.NewPager(runtime.PagingHandler[ScriptsClientListByDatabaseResponse]{ More: func(page ScriptsClientListByDatabaseResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ScriptsClientListByDatabaseResponse) (ScriptsClientListByDatabaseResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ScriptsClient.NewListByDatabasePager") - req, err := client.listByDatabaseCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) - if err != nil { - return ScriptsClientListByDatabaseResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByDatabaseCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) + }, nil) if err != nil { return ScriptsClientListByDatabaseResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ScriptsClientListByDatabaseResponse{}, runtime.NewResponseError(resp) - } return client.listByDatabaseHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -396,7 +383,7 @@ func (client *ScriptsClient) NewListByDatabasePager(resourceGroupName string, cl } // listByDatabaseCreateRequest creates the ListByDatabase request. -func (client *ScriptsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *ScriptsClientListByDatabaseOptions) (*policy.Request, error) { +func (client *ScriptsClient) listByDatabaseCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, _ *ScriptsClientListByDatabaseOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -419,8 +406,8 @@ func (client *ScriptsClient) listByDatabaseCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -436,8 +423,6 @@ func (client *ScriptsClient) listByDatabaseHandleResponse(resp *http.Response) ( // BeginUpdate - Updates a database script. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the Kusto cluster. // - databaseName - The name of the database in the Kusto cluster. @@ -463,8 +448,6 @@ func (client *ScriptsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Updates a database script. // If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-04-13 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 const operationName = "ScriptsClient.BeginUpdate" @@ -487,7 +470,7 @@ func (client *ScriptsClient) update(ctx context.Context, resourceGroupName strin } // updateCreateRequest creates the Update request. -func (client *ScriptsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script, options *ScriptsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ScriptsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, scriptName string, parameters Script, _ *ScriptsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -514,9 +497,10 @@ func (client *ScriptsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go index f828fb8bf4d6..7f3eaa36c9ea 100644 --- a/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/scripts_client_example_test.go @@ -1,136 +1,55 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/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"), - // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), - // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), - // 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.275Z"); 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.275Z"); 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"), - // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRetainPermissionOnScriptCompletion), - // ScriptLevel: to.Ptr(armkusto.ScriptLevelCluster), - // 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.275Z"); 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.283Z"); 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoScriptsGet.json -func ExampleScriptsClient_Get() { +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScriptsClient().Get(ctx, "kustorptest", "kustoCluster", "Kustodatabase8", "kustoScript", nil) + 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.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"), - // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), - // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), - // 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.275Z"); 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.275Z"); return t}()), - // LastModifiedBy: to.Ptr("user@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), + // res = armkusto.ScriptsClientCheckNameAvailabilityResponse{ + // CheckNameResult: armkusto.CheckNameResult{ + // Name: to.Ptr("kustoScriptName1"), + // Message: to.Ptr("Name 'kustoScriptName1' 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoScriptsCreateOrUpdate.json -func ExampleScriptsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-02-14/KustoScriptsCreateOrUpdate.json +func ExampleScriptsClient_BeginCreateOrUpdate_kustoScriptsCreateOrUpdate() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -149,52 +68,54 @@ func ExampleScriptsClient_BeginCreateOrUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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"), - // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), - // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), - // 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.275Z"); 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.364Z"); return t}()), - // LastModifiedBy: to.Ptr("user2@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), + // res = armkusto.ScriptsClientCreateOrUpdateResponse{ + // 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"), + // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), + // 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/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoScriptsUpdate.json -func ExampleScriptsClient_BeginUpdate() { +// Generated from example definition: 2025-02-14/KustoScriptsCreateOrUpdateWithManagedIdentity.json +func ExampleScriptsClient_BeginCreateOrUpdate_kustoScriptsCreateOrUpdateWithManagedIdentity() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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{ + poller, err := clientFactory.NewScriptsClient().BeginCreateOrUpdate(ctx, "kustorptest", "kustoCluster", "KustoDatabase8", "kustoScript", armkusto.Script{ Properties: &armkusto.ScriptProperties{ - ContinueOnErrors: to.Ptr(true), + ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), - PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + ContinueOnErrors: to.Ptr(true), ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), - 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=********************************"), + PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoprtest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoMi1"), }, }, nil) if err != nil { @@ -202,41 +123,44 @@ func ExampleScriptsClient_BeginUpdate() { } res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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"), - // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), - // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), - // 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.275Z"); 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.364Z"); return t}()), - // LastModifiedBy: to.Ptr("user2@microsoft.com"), - // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), + // res = armkusto.ScriptsClientCreateOrUpdateResponse{ + // Script: armkusto.Script{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/KustoDatabase8/Scripts/kustoScript"), + // Name: to.Ptr("kustoCluster/KustoDatabase8/kustoScript"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/Scripts"), + // Properties: &armkusto.ScriptProperties{ + // ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), + // ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), + // ContinueOnErrors: to.Ptr(true), + // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), + // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustoprtest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoMi1"), + // }, + // SystemData: &armkusto.SystemData{ + // CreatedBy: to.Ptr("user@microsoft.com"), + // CreatedByType: to.Ptr(armkusto.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), + // LastModifiedBy: to.Ptr("user2@microsoft.com"), + // LastModifiedByType: to.Ptr(armkusto.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T17:16:24.3644126Z"); return t}()), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoScriptsDelete.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -244,36 +168,224 @@ func ExampleScriptsClient_BeginDelete() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to poll 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.ScriptsClientDeleteResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoScriptsCheckNameAvailability.json -func ExampleScriptsClient_CheckNameAvailability() { +// Generated from example definition: 2025-02-14/KustoScriptsGet.json +func ExampleScriptsClient_Get_kustoScriptsGet() { 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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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"), + 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 = armkusto.ScriptsClientGetResponse{ + // 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"), + // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), + // 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: 2025-02-14/KustoScriptsGetWithManagedIdentity.json +func ExampleScriptsClient_Get_kustoScriptsGetWithManagedIdentity() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", 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 = armkusto.ScriptsClientGetResponse{ + // Script: armkusto.Script{ + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/kustoCluster/Databases/Kustodatabase8/Scripts/kustoScript"), + // Name: to.Ptr("kustoCluster/Kustodatabase8/kustoScript"), + // Type: to.Ptr("Microsoft.Kusto/Clusters/Databases/Scripts"), + // Properties: &armkusto.ScriptProperties{ + // ScriptURL: to.Ptr("https://mysa.blob.core.windows.net/container/script.txt"), + // ForceUpdateTag: to.Ptr("2bcf3c21-ffd1-4444-b9dd-e52e00ee53fe"), + // ContinueOnErrors: to.Ptr(true), + // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), + // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + // ManagedIdentityResourceID: to.Ptr("/subscriptions/12345666-1234-1277-1234-123456789098/resourceGroups/kustomis/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kustoMi1"), + // }, + // SystemData: &armkusto.SystemData{ + // CreatedBy: to.Ptr("user@microsoft.com"), + // CreatedByType: to.Ptr(armkusto.CreatedByTypeUser), + // CreatedAt: 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), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-29T15:06:54.2757906Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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 = armkusto.ScriptsClientListByDatabaseResponse{ + // 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"), + // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), + // 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"), + // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRetainPermissionOnScriptCompletion), + // ScriptLevel: to.Ptr(armkusto.ScriptLevelCluster), + // 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: 2025-02-14/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("12345678-1234-1234-1234-123456789098", 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"), + PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), + 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 poll 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.CheckNameResult = armkusto.CheckNameResult{ - // Name: to.Ptr("kustoScriptName1"), - // Message: to.Ptr("Name 'kustoScriptName1' is already taken. Please specify a different name"), - // NameAvailable: to.Ptr(false), + // res = armkusto.ScriptsClientUpdateResponse{ + // 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"), + // PrincipalPermissionsAction: to.Ptr(armkusto.PrincipalPermissionsActionRemovePermissionOnScriptCompletion), + // ScriptLevel: to.Ptr(armkusto.ScriptLevelDatabase), + // 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), + // }, + // }, // } } diff --git a/sdk/resourcemanager/kusto/armkusto/skus_client.go b/sdk/resourcemanager/kusto/armkusto/skus_client.go index 7bfbe6d1790e..6a2f3f2db3b0 100644 --- a/sdk/resourcemanager/kusto/armkusto/skus_client.go +++ b/sdk/resourcemanager/kusto/armkusto/skus_client.go @@ -1,7 +1,6 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armkusto @@ -19,15 +18,17 @@ import ( // SKUsClient contains the methods for the SKUs group. // Don't use this type directly, use NewSKUsClient() instead. +// +// Generated from API version 2025-02-14 type SKUsClient struct { internal *arm.Client subscriptionID string } // NewSKUsClient creates a new instance of SKUsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,28 +42,25 @@ func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, opt } // NewListPager - Lists eligible region SKUs for Kusto resource provider by Azure region. -// -// Generated from API version 2024-04-13 -// - location - The name of Azure region. +// - location - The location name. // - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. func (client *SKUsClient) NewListPager(location string, options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ More: func(page SKUsClientListResponse) bool { - return false + return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SKUsClientListResponse) (SKUsClientListResponse, error) { ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SKUsClient.NewListPager") - req, err := client.listCreateRequest(ctx, location, options) - if err != nil { - return SKUsClientListResponse{}, err + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, location, options) + }, nil) if err != nil { return SKUsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SKUsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), @@ -70,7 +68,7 @@ func (client *SKUsClient) NewListPager(location string, options *SKUsClientListO } // listCreateRequest creates the List request. -func (client *SKUsClient) listCreateRequest(ctx context.Context, location string, options *SKUsClientListOptions) (*policy.Request, error) { +func (client *SKUsClient) listCreateRequest(ctx context.Context, location string, _ *SKUsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/skus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -85,8 +83,8 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, location string return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-04-13") - req.Raw().URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", version20250214) + req.Raw().URL.RawQuery = strings.ReplaceAll(reqQP.Encode(), "+", "%20") req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } diff --git a/sdk/resourcemanager/kusto/armkusto/skus_client_example_test.go b/sdk/resourcemanager/kusto/armkusto/skus_client_example_test.go index 86bb14331bd1..5fd2c2eb4f84 100644 --- a/sdk/resourcemanager/kusto/armkusto/skus_client_example_test.go +++ b/sdk/resourcemanager/kusto/armkusto/skus_client_example_test.go @@ -1,27 +1,24 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. 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" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b8adce17dc500f338f86f18af30aac61dcb71c5f/specification/azure-kusto/resource-manager/Microsoft.Kusto/stable/2024-04-13/examples/KustoSkus.json +// Generated from example definition: 2025-02-14/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) + clientFactory, err := armkusto.NewClientFactory("12345678-1234-1234-1234-123456789098", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,86 +33,101 @@ func ExampleSKUsClient_NewListPager() { _ = 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")}, + // page = armkusto.SKUsClientListResponse{ + // 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"), + // to.Ptr("West US"), // }, - // { - // 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"), + // 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"), // }, - // { - // 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"), - // }}, - // } + // }, + // { + // 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/testdata/_metadata.json b/sdk/resourcemanager/kusto/armkusto/testdata/_metadata.json new file mode 100644 index 000000000000..eabcaa69e310 --- /dev/null +++ b/sdk/resourcemanager/kusto/armkusto/testdata/_metadata.json @@ -0,0 +1,6 @@ +{ + "apiVersions": { + "Microsoft.Kusto": "2025-02-14" + }, + "emitterVersion": "0.14.0" +} diff --git a/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go b/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go deleted file mode 100644 index 00bd5b7e140d..000000000000 --- a/sdk/resourcemanager/kusto/armkusto/time_rfc3339.go +++ /dev/null @@ -1,107 +0,0 @@ -// 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 - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/kusto/armkusto/tsp-location.yaml b/sdk/resourcemanager/kusto/armkusto/tsp-location.yaml new file mode 100644 index 000000000000..db65e372823c --- /dev/null +++ b/sdk/resourcemanager/kusto/armkusto/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/azure-kusto/resource-manager/Microsoft.Kusto/Kusto +commit: b26c3c253cff26dd05361e882dbcf1b324f27dfd +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/kusto/armkusto/version.go b/sdk/resourcemanager/kusto/armkusto/version.go new file mode 100644 index 000000000000..63dce00e9702 --- /dev/null +++ b/sdk/resourcemanager/kusto/armkusto/version.go @@ -0,0 +1,10 @@ +// 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) Go Code Generator. + +package armkusto + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/kusto/armkusto" + moduleVersion = "v2.4.0-beta.1" +)