diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/CHANGELOG.md b/sdk/resourcemanager/hdinsight/armhdinsight/CHANGELOG.md index 7a124f81a4b2..dafa3c5280ae 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/CHANGELOG.md +++ b/sdk/resourcemanager/hdinsight/armhdinsight/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 1.3.0-beta.3 (2025-05-12) +### Features Added + +- New struct `EntraUserInfo` +- New field `RestAuthEntraUsers` in struct `GatewaySettings` +- New field `RestAuthEntraUsers` in struct `UpdateGatewaySettingsParameters` + + ## 1.3.0-beta.2 (2024-08-22) ### Features Added diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/applications_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/applications_client.go index beb34a677b7e..cfc7b30268d8 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/applications_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/applications_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Creates applications for the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - applicationName - The constant value for the application name. @@ -75,7 +72,7 @@ func (client *ApplicationsClient) BeginCreate(ctx context.Context, resourceGroup // Create - Creates applications for the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ApplicationsClient) create(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters Application, options *ApplicationsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ApplicationsClient.BeginCreate" @@ -98,7 +95,7 @@ func (client *ApplicationsClient) create(ctx context.Context, resourceGroupName } // createCreateRequest creates the Create request. -func (client *ApplicationsClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters Application, options *ApplicationsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ApplicationsClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, parameters Application, _ *ApplicationsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -121,7 +118,7 @@ func (client *ApplicationsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -133,7 +130,7 @@ func (client *ApplicationsClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Deletes the specified application on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - applicationName - The constant value for the application name. @@ -160,7 +157,7 @@ func (client *ApplicationsClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Deletes the specified application on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, options *ApplicationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ApplicationsClient.BeginDelete" @@ -183,7 +180,7 @@ func (client *ApplicationsClient) deleteOperation(ctx context.Context, resourceG } // deleteCreateRequest creates the Delete request. -func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, options *ApplicationsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, _ *ApplicationsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -206,7 +203,7 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +212,7 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, resou // Get - Gets properties of the specified application. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - applicationName - The constant value for the application name. @@ -243,7 +240,7 @@ func (client *ApplicationsClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *ApplicationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, options *ApplicationsClientGetOptions) (*policy.Request, error) { +func (client *ApplicationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, _ *ApplicationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -266,7 +263,7 @@ func (client *ApplicationsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,7 +281,7 @@ func (client *ApplicationsClient) getHandleResponse(resp *http.Response) (Applic // GetAzureAsyncOperationStatus - Gets the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - applicationName - The constant value for the application name. @@ -314,7 +311,7 @@ func (client *ApplicationsClient) GetAzureAsyncOperationStatus(ctx context.Conte } // getAzureAsyncOperationStatusCreateRequest creates the GetAzureAsyncOperationStatus request. -func (client *ApplicationsClient) getAzureAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, operationID string, options *ApplicationsClientGetAzureAsyncOperationStatusOptions) (*policy.Request, error) { +func (client *ApplicationsClient) getAzureAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, applicationName string, operationID string, _ *ApplicationsClientGetAzureAsyncOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}/azureasyncoperations/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -341,7 +338,7 @@ func (client *ApplicationsClient) getAzureAsyncOperationStatusCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -358,7 +355,7 @@ func (client *ApplicationsClient) getAzureAsyncOperationStatusHandleResponse(res // NewListByClusterPager - Lists all of the applications for the HDInsight cluster. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ApplicationsClientListByClusterOptions contains the optional parameters for the ApplicationsClient.NewListByClusterPager @@ -387,7 +384,7 @@ func (client *ApplicationsClient) NewListByClusterPager(resourceGroupName string } // listByClusterCreateRequest creates the ListByCluster request. -func (client *ApplicationsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ApplicationsClientListByClusterOptions) (*policy.Request, error) { +func (client *ApplicationsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ApplicationsClientListByClusterOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -406,7 +403,7 @@ func (client *ApplicationsClient) listByClusterCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/applications_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/applications_client_example_test.go deleted file mode 100644 index 453bdaaf896b..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/applications_client_example_test.go +++ /dev/null @@ -1,417 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_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/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetAllApplications.json -func ExampleApplicationsClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewApplicationsClient().NewListByClusterPager("rg1", "cluster1", 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.ApplicationListResult = armhdinsight.ApplicationListResult{ - // Value: []*armhdinsight.Application{ - // { - // Name: to.Ptr("app"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/applications"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/applications/app"), - // Etag: to.Ptr("CF938302-6B4D-44A0-A6D2-C0D67E847AEC"), - // Properties: &armhdinsight.ApplicationProperties{ - // ApplicationState: to.Ptr("Running"), - // ApplicationType: to.Ptr("CustomApplication"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("edgenode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D12_v2"), - // }, - // TargetInstanceCount: to.Ptr[int32](1), - // }}, - // }, - // CreatedDate: to.Ptr("2017-03-22T21:34:39.293"), - // HTTPSEndpoints: []*armhdinsight.ApplicationGetHTTPSEndpoint{ - // { - // AccessModes: []*string{ - // to.Ptr("WebPage")}, - // DestinationPort: to.Ptr[int32](20000), - // Location: to.Ptr("https://cluster1-app.apps.azurehdinsight.net:443"), - // PublicPort: to.Ptr[int32](443), - // }}, - // InstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // { - // Name: to.Ptr("app-install-app"), - // Roles: []*string{ - // to.Ptr("edgenode")}, - // URI: to.Ptr("http://testurl.com/public/hdi-app/20170301/hdinsight-app-install.sh"), - // }}, - // MarketplaceIdentifier: to.Ptr("app-on-hdiapp-on-hdi.1.0.3"), - // ProvisioningState: to.Ptr("Succeeded"), - // SSHEndpoints: []*armhdinsight.ApplicationGetEndpoint{ - // { - // DestinationPort: to.Ptr[int32](22), - // Location: to.Ptr("app.cluster1-ssh.azurehdinsight.net:22"), - // PublicPort: to.Ptr[int32](22), - // }}, - // UninstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // }, - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // }, - // { - // Name: to.Ptr("app2"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/applications"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/applications/app2"), - // Etag: to.Ptr("2C128F8E-BB26-4637-99E4-18EBC39FD51F"), - // Properties: &armhdinsight.ApplicationProperties{ - // ApplicationState: to.Ptr("AzureVMConfiguration"), - // ApplicationType: to.Ptr("CustomApplication"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("edgenode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3"), - // }, - // TargetInstanceCount: to.Ptr[int32](1), - // }}, - // }, - // CreatedDate: to.Ptr("2017-03-28T02:01:25.107"), - // HTTPSEndpoints: []*armhdinsight.ApplicationGetHTTPSEndpoint{ - // { - // AccessModes: []*string{ - // to.Ptr("WebPage")}, - // DestinationPort: to.Ptr[int32](18630), - // Location: to.Ptr("location"), - // PublicPort: to.Ptr[int32](443), - // }}, - // InstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // { - // Name: to.Ptr("app2-Install"), - // Roles: []*string{ - // to.Ptr("edgenode")}, - // URI: to.Ptr("https://app2url.com/azure/2.4.0.0/app2_install.sh"), - // }}, - // MarketplaceIdentifier: to.Ptr("app2-hdinsightsmall.1.0.8"), - // ProvisioningState: to.Ptr("Succeeded"), - // SSHEndpoints: []*armhdinsight.ApplicationGetEndpoint{ - // }, - // UninstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // }, - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetApplicationInProgress.json -func ExampleApplicationsClient_Get_getApplicationOnHdInsightClusterCreationInProgress() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationsClient().Get(ctx, "rg1", "cluster1", "app", 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.Application = armhdinsight.Application{ - // Name: to.Ptr("app"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/applications"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/applications/app"), - // Etag: to.Ptr("2C128F8E-BB26-4637-99E4-18EBC39FD51F"), - // Properties: &armhdinsight.ApplicationProperties{ - // ApplicationState: to.Ptr("AzureVMConfiguration"), - // ApplicationType: to.Ptr("CustomApplication"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("edgenode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3"), - // }, - // TargetInstanceCount: to.Ptr[int32](1), - // }}, - // }, - // CreatedDate: to.Ptr("2017-03-28T02:01:25.107"), - // HTTPSEndpoints: []*armhdinsight.ApplicationGetHTTPSEndpoint{ - // { - // AccessModes: []*string{ - // to.Ptr("WebPage")}, - // DestinationPort: to.Ptr[int32](18630), - // Location: to.Ptr("location"), - // PublicPort: to.Ptr[int32](443), - // }}, - // InstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // { - // Name: to.Ptr("app-Install"), - // Roles: []*string{ - // to.Ptr("edgenode")}, - // URI: to.Ptr("https://app.com/azure/app_install.sh"), - // }}, - // MarketplaceIdentifier: to.Ptr("id"), - // ProvisioningState: to.Ptr("Succeeded"), - // SSHEndpoints: []*armhdinsight.ApplicationGetEndpoint{ - // }, - // UninstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // }, - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetApplicationCreated.json -func ExampleApplicationsClient_Get_getApplicationOnHdInsightClusterSuccessfullyCreated() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationsClient().Get(ctx, "rg1", "cluster1", "app", 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.Application = armhdinsight.Application{ - // Name: to.Ptr("app"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/applications"), - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/applications/app"), - // Etag: to.Ptr("CF938302-6B4D-44A0-A6D2-C0D67E847AEC"), - // Properties: &armhdinsight.ApplicationProperties{ - // ApplicationState: to.Ptr("Running"), - // ApplicationType: to.Ptr("CustomApplication"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("edgenode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D12_v2"), - // }, - // TargetInstanceCount: to.Ptr[int32](1), - // }}, - // }, - // CreatedDate: to.Ptr("2017-03-22T21:34:39.293"), - // HTTPSEndpoints: []*armhdinsight.ApplicationGetHTTPSEndpoint{ - // { - // AccessModes: []*string{ - // to.Ptr("WebPage")}, - // DestinationPort: to.Ptr[int32](20000), - // Location: to.Ptr("https://cluster1.apps.azurehdinsight.net:443"), - // PublicPort: to.Ptr[int32](443), - // }}, - // InstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // { - // Name: to.Ptr("app-install"), - // Roles: []*string{ - // to.Ptr("edgenode")}, - // URI: to.Ptr("http://app.com/public/hdi-app/20170301/app-install.sh"), - // }}, - // MarketplaceIdentifier: to.Ptr("appMarketId"), - // ProvisioningState: to.Ptr("Succeeded"), - // SSHEndpoints: []*armhdinsight.ApplicationGetEndpoint{ - // { - // DestinationPort: to.Ptr[int32](22), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net:22"), - // PublicPort: to.Ptr[int32](22), - // }}, - // UninstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // }, - // }, - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateApplication.json -func ExampleApplicationsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationsClient().BeginCreate(ctx, "rg1", "cluster1", "hue", armhdinsight.Application{ - Properties: &armhdinsight.ApplicationProperties{ - ApplicationType: to.Ptr("CustomApplication"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("edgenode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D12_v2"), - }, - TargetInstanceCount: to.Ptr[int32](1), - }}, - }, - Errors: []*armhdinsight.Errors{}, - HTTPSEndpoints: []*armhdinsight.ApplicationGetHTTPSEndpoint{ - { - AccessModes: []*string{ - to.Ptr("WebPage")}, - DestinationPort: to.Ptr[int32](20000), - SubDomainSuffix: to.Ptr("dss"), - }}, - InstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - { - Name: to.Ptr("app-install-app1"), - Parameters: to.Ptr("-version latest -port 20000"), - Roles: []*string{ - to.Ptr("edgenode")}, - URI: to.Ptr("https://.../install.sh"), - }}, - UninstallScriptActions: []*armhdinsight.RuntimeScriptAction{}, - }, - }, 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.Application = armhdinsight.Application{ - // Name: to.Ptr("hue"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/applications"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/applications/hue"), - // Etag: to.Ptr("etag"), - // Properties: &armhdinsight.ApplicationProperties{ - // ApplicationState: to.Ptr("ApplicationConfiguration"), - // ApplicationType: to.Ptr("CustomApplication"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("edgenode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D12_v2"), - // }, - // TargetInstanceCount: to.Ptr[int32](1), - // }}, - // }, - // CreatedDate: to.Ptr("2017-02-28"), - // Errors: []*armhdinsight.Errors{ - // }, - // HTTPSEndpoints: []*armhdinsight.ApplicationGetHTTPSEndpoint{ - // { - // AccessModes: []*string{ - // to.Ptr("WebPage")}, - // DestinationPort: to.Ptr[int32](20000), - // }}, - // InstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // { - // Name: to.Ptr("app-install-app1"), - // Roles: []*string{ - // to.Ptr("edgenode")}, - // URI: to.Ptr("https://.../install.sh"), - // }}, - // ProvisioningState: to.Ptr("Succeeded"), - // SSHEndpoints: []*armhdinsight.ApplicationGetEndpoint{ - // }, - // UninstallScriptActions: []*armhdinsight.RuntimeScriptAction{ - // }, - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeleteApplication.json -func ExampleApplicationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewApplicationsClient().BeginDelete(ctx, "rg1", "cluster1", "hue", 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetApplicationCreationAsyncOperationStatus.json -func ExampleApplicationsClient_GetAzureAsyncOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewApplicationsClient().GetAzureAsyncOperationStatus(ctx, "rg1", "cluster1", "app", "CF938302-6B4D-44A0-A6D2-C0D67E847AEC", 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.AsyncOperationResult = armhdinsight.AsyncOperationResult{ - // Status: to.Ptr(armhdinsight.AsyncOperationStateInProgress), - // } -} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/autorest.md b/sdk/resourcemanager/hdinsight/armhdinsight/autorest.md index 9d90b524c496..572289619ec0 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/autorest.md +++ b/sdk/resourcemanager/hdinsight/armhdinsight/autorest.md @@ -5,14 +5,13 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hdinsight/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hdinsight/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.3.0-beta.2 +module-version: 1.3.0-beta.3 directive: - from: cluster.json where: $.definitions.Resource transform: > $["title"] = "Resource" -tag: package-2024-08-preview ``` \ No newline at end of file diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/client_factory.go b/sdk/resourcemanager/hdinsight/armhdinsight/client_factory.go index fe80f800bcb8..af10a47b9149 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/client_factory.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/client_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client.go index 86f65e9b65b5..c3abd9c9b1fd 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreate - Creates a new HDInsight cluster with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The cluster create request. @@ -73,7 +70,7 @@ func (client *ClustersClient) BeginCreate(ctx context.Context, resourceGroupName // Create - Creates a new HDInsight cluster with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ClustersClient) create(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, options *ClustersClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginCreate" @@ -96,7 +93,7 @@ func (client *ClustersClient) create(ctx context.Context, resourceGroupName stri } // createCreateRequest creates the Create request. -func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, options *ClustersClientBeginCreateOptions) (*policy.Request, error) { +func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterCreateParametersExtended, _ *ClustersClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -127,7 +124,7 @@ func (client *ClustersClient) createCreateRequest(ctx context.Context, resourceG // BeginDelete - Deletes the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. @@ -152,7 +149,7 @@ func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Deletes the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginDelete" @@ -175,7 +172,7 @@ 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.HDInsight/clusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -194,7 +191,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +200,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG // BeginExecuteScriptActions - Executes script actions on the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The parameters for executing script actions. @@ -230,7 +227,7 @@ func (client *ClustersClient) BeginExecuteScriptActions(ctx context.Context, res // ExecuteScriptActions - Executes script actions on the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ClustersClient) executeScriptActions(ctx context.Context, resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, options *ClustersClientBeginExecuteScriptActionsOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginExecuteScriptActions" @@ -253,7 +250,7 @@ func (client *ClustersClient) executeScriptActions(ctx context.Context, resource } // executeScriptActionsCreateRequest creates the ExecuteScriptActions request. -func (client *ClustersClient) executeScriptActionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, options *ClustersClientBeginExecuteScriptActionsOptions) (*policy.Request, error) { +func (client *ClustersClient) executeScriptActionsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ExecuteScriptActionParameters, _ *ClustersClientBeginExecuteScriptActionsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -272,7 +269,7 @@ func (client *ClustersClient) executeScriptActionsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -284,7 +281,7 @@ func (client *ClustersClient) executeScriptActionsCreateRequest(ctx context.Cont // Get - Gets the specified cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. @@ -311,7 +308,7 @@ 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.HDInsight/clusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -330,7 +327,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -348,7 +345,7 @@ func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersCl // GetAzureAsyncOperationStatus - The the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - operationID - The long running operation id. @@ -377,7 +374,7 @@ func (client *ClustersClient) GetAzureAsyncOperationStatus(ctx context.Context, } // getAzureAsyncOperationStatusCreateRequest creates the GetAzureAsyncOperationStatus request. -func (client *ClustersClient) getAzureAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, operationID string, options *ClustersClientGetAzureAsyncOperationStatusOptions) (*policy.Request, error) { +func (client *ClustersClient) getAzureAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, operationID string, _ *ClustersClientGetAzureAsyncOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/azureasyncoperations/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -400,7 +397,7 @@ func (client *ClustersClient) getAzureAsyncOperationStatusCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -418,7 +415,7 @@ func (client *ClustersClient) getAzureAsyncOperationStatusHandleResponse(resp *h // GetGatewaySettings - Gets the gateway settings for the specified cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ClustersClientGetGatewaySettingsOptions contains the optional parameters for the ClustersClient.GetGatewaySettings @@ -446,7 +443,7 @@ func (client *ClustersClient) GetGatewaySettings(ctx context.Context, resourceGr } // getGatewaySettingsCreateRequest creates the GetGatewaySettings request. -func (client *ClustersClient) getGatewaySettingsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetGatewaySettingsOptions) (*policy.Request, error) { +func (client *ClustersClient) getGatewaySettingsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ClustersClientGetGatewaySettingsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -465,7 +462,7 @@ func (client *ClustersClient) getGatewaySettingsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -482,7 +479,7 @@ func (client *ClustersClient) getGatewaySettingsHandleResponse(resp *http.Respon // NewListPager - Lists all the HDInsight clusters under the subscription. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - 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]{ @@ -508,7 +505,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.HDInsight/clusters" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -519,7 +516,7 @@ func (client *ClustersClient) listCreateRequest(ctx context.Context, options *Cl return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -536,7 +533,7 @@ func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersC // NewListByResourceGroupPager - Lists the HDInsight clusters in a resource group. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.NewListByResourceGroupPager // method. @@ -564,7 +561,7 @@ 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.HDInsight/clusters" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -579,7 +576,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -597,7 +594,7 @@ func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Respo // BeginResize - Resizes the specified HDInsight cluster to the specified size. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - roleName - The constant value for the roleName @@ -624,7 +621,7 @@ func (client *ClustersClient) BeginResize(ctx context.Context, resourceGroupName // Resize - Resizes the specified HDInsight cluster to the specified size. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ClustersClient) resize(ctx context.Context, resourceGroupName string, clusterName string, roleName RoleName, parameters ClusterResizeParameters, options *ClustersClientBeginResizeOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginResize" @@ -647,7 +644,7 @@ func (client *ClustersClient) resize(ctx context.Context, resourceGroupName stri } // resizeCreateRequest creates the Resize request. -func (client *ClustersClient) resizeCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, roleName RoleName, parameters ClusterResizeParameters, options *ClustersClientBeginResizeOptions) (*policy.Request, error) { +func (client *ClustersClient) resizeCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, roleName RoleName, parameters ClusterResizeParameters, _ *ClustersClientBeginResizeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -670,7 +667,7 @@ func (client *ClustersClient) resizeCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -682,7 +679,7 @@ func (client *ClustersClient) resizeCreateRequest(ctx context.Context, resourceG // BeginRotateDiskEncryptionKey - Rotate disk encryption key of the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The parameters for the disk encryption operation. @@ -709,7 +706,7 @@ func (client *ClustersClient) BeginRotateDiskEncryptionKey(ctx context.Context, // RotateDiskEncryptionKey - Rotate disk encryption key of the specified HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ClustersClient) rotateDiskEncryptionKey(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters, options *ClustersClientBeginRotateDiskEncryptionKeyOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginRotateDiskEncryptionKey" @@ -732,7 +729,7 @@ func (client *ClustersClient) rotateDiskEncryptionKey(ctx context.Context, resou } // rotateDiskEncryptionKeyCreateRequest creates the RotateDiskEncryptionKey request. -func (client *ClustersClient) rotateDiskEncryptionKeyCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters, options *ClustersClientBeginRotateDiskEncryptionKeyOptions) (*policy.Request, error) { +func (client *ClustersClient) rotateDiskEncryptionKeyCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterDiskEncryptionParameters, _ *ClustersClientBeginRotateDiskEncryptionKeyOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -751,7 +748,7 @@ func (client *ClustersClient) rotateDiskEncryptionKeyCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -763,7 +760,7 @@ func (client *ClustersClient) rotateDiskEncryptionKeyCreateRequest(ctx context.C // Update - Patch HDInsight cluster with the specified parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The cluster patch request. @@ -791,7 +788,7 @@ 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 ClusterPatchParameters, options *ClustersClientUpdateOptions) (*policy.Request, error) { +func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterPatchParameters, _ *ClustersClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -810,7 +807,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -831,7 +828,7 @@ func (client *ClustersClient) updateHandleResponse(resp *http.Response) (Cluster // BeginUpdateAutoScaleConfiguration - Updates the Autoscale Configuration for HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - roleName - The constant value for the roleName @@ -859,7 +856,7 @@ func (client *ClustersClient) BeginUpdateAutoScaleConfiguration(ctx context.Cont // UpdateAutoScaleConfiguration - Updates the Autoscale Configuration for HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ClustersClient) updateAutoScaleConfiguration(ctx context.Context, resourceGroupName string, clusterName string, roleName RoleName, parameters AutoscaleConfigurationUpdateParameter, options *ClustersClientBeginUpdateAutoScaleConfigurationOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginUpdateAutoScaleConfiguration" @@ -882,7 +879,7 @@ func (client *ClustersClient) updateAutoScaleConfiguration(ctx context.Context, } // updateAutoScaleConfigurationCreateRequest creates the UpdateAutoScaleConfiguration request. -func (client *ClustersClient) updateAutoScaleConfigurationCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, roleName RoleName, parameters AutoscaleConfigurationUpdateParameter, options *ClustersClientBeginUpdateAutoScaleConfigurationOptions) (*policy.Request, error) { +func (client *ClustersClient) updateAutoScaleConfigurationCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, roleName RoleName, parameters AutoscaleConfigurationUpdateParameter, _ *ClustersClientBeginUpdateAutoScaleConfigurationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -905,7 +902,7 @@ func (client *ClustersClient) updateAutoScaleConfigurationCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -917,7 +914,7 @@ func (client *ClustersClient) updateAutoScaleConfigurationCreateRequest(ctx cont // BeginUpdateGatewaySettings - Configures the gateway settings on the specified cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The cluster configurations. @@ -944,7 +941,7 @@ func (client *ClustersClient) BeginUpdateGatewaySettings(ctx context.Context, re // UpdateGatewaySettings - Configures the gateway settings on the specified cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ClustersClient) updateGatewaySettings(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateGatewaySettingsParameters, options *ClustersClientBeginUpdateGatewaySettingsOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginUpdateGatewaySettings" @@ -967,7 +964,7 @@ func (client *ClustersClient) updateGatewaySettings(ctx context.Context, resourc } // updateGatewaySettingsCreateRequest creates the UpdateGatewaySettings request. -func (client *ClustersClient) updateGatewaySettingsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateGatewaySettingsParameters, options *ClustersClientBeginUpdateGatewaySettingsOptions) (*policy.Request, error) { +func (client *ClustersClient) updateGatewaySettingsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateGatewaySettingsParameters, _ *ClustersClientBeginUpdateGatewaySettingsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -986,7 +983,7 @@ func (client *ClustersClient) updateGatewaySettingsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -998,7 +995,7 @@ func (client *ClustersClient) updateGatewaySettingsCreateRequest(ctx context.Con // BeginUpdateIdentityCertificate - Updates the cluster identity certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The cluster configurations. @@ -1025,7 +1022,7 @@ func (client *ClustersClient) BeginUpdateIdentityCertificate(ctx context.Context // UpdateIdentityCertificate - Updates the cluster identity certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ClustersClient) updateIdentityCertificate(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateClusterIdentityCertificateParameters, options *ClustersClientBeginUpdateIdentityCertificateOptions) (*http.Response, error) { var err error const operationName = "ClustersClient.BeginUpdateIdentityCertificate" @@ -1048,7 +1045,7 @@ func (client *ClustersClient) updateIdentityCertificate(ctx context.Context, res } // updateIdentityCertificateCreateRequest creates the UpdateIdentityCertificate request. -func (client *ClustersClient) updateIdentityCertificateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateClusterIdentityCertificateParameters, options *ClustersClientBeginUpdateIdentityCertificateOptions) (*policy.Request, error) { +func (client *ClustersClient) updateIdentityCertificateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters UpdateClusterIdentityCertificateParameters, _ *ClustersClientBeginUpdateIdentityCertificateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1067,7 +1064,7 @@ func (client *ClustersClient) updateIdentityCertificateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client_example_test.go deleted file mode 100644 index 73e31072efe6..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/clusters_client_example_test.go +++ /dev/null @@ -1,3454 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_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/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithAutoscaleConfig.json -func ExampleClustersClient_BeginCreate_createHdInsightClusterWithAutoscaleConfiguration() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - ComponentVersion: map[string]*string{ - "Hadoop": to.Ptr("2.7"), - }, - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("hadoop"), - }, - ClusterVersion: to.Ptr("3.6"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("workernode"), - AutoscaleConfiguration: &armhdinsight.Autoscale{ - Recurrence: &armhdinsight.AutoscaleRecurrence{ - Schedule: []*armhdinsight.AutoscaleSchedule{ - { - Days: []*armhdinsight.DaysOfWeek{ - to.Ptr(armhdinsight.DaysOfWeekMonday), - to.Ptr(armhdinsight.DaysOfWeekTuesday), - to.Ptr(armhdinsight.DaysOfWeekWednesday), - to.Ptr(armhdinsight.DaysOfWeekThursday), - to.Ptr(armhdinsight.DaysOfWeekFriday)}, - TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{ - MaxInstanceCount: to.Ptr[int32](3), - MinInstanceCount: to.Ptr[int32](3), - Time: to.Ptr("09:00"), - }, - }, - { - Days: []*armhdinsight.DaysOfWeek{ - to.Ptr(armhdinsight.DaysOfWeekMonday), - to.Ptr(armhdinsight.DaysOfWeekTuesday), - to.Ptr(armhdinsight.DaysOfWeekWednesday), - to.Ptr(armhdinsight.DaysOfWeekThursday), - to.Ptr(armhdinsight.DaysOfWeekFriday)}, - TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{ - MaxInstanceCount: to.Ptr[int32](6), - MinInstanceCount: to.Ptr[int32](6), - Time: to.Ptr("18:00"), - }, - }, - { - Days: []*armhdinsight.DaysOfWeek{ - to.Ptr(armhdinsight.DaysOfWeekSaturday), - to.Ptr(armhdinsight.DaysOfWeekSunday)}, - TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{ - MaxInstanceCount: to.Ptr[int32](2), - MinInstanceCount: to.Ptr[int32](2), - Time: to.Ptr("09:00"), - }, - }, - { - Days: []*armhdinsight.DaysOfWeek{ - to.Ptr(armhdinsight.DaysOfWeekSaturday), - to.Ptr(armhdinsight.DaysOfWeekSunday)}, - TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{ - MaxInstanceCount: to.Ptr[int32](4), - MinInstanceCount: to.Ptr[int32](4), - Time: to.Ptr("18:00"), - }, - }}, - TimeZone: to.Ptr("China Standard Time"), - }, - }, - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D4_V2"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - ScriptActions: []*armhdinsight.ScriptAction{}, - TargetInstanceCount: to.Ptr[int32](4), - }}, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("hdinsight-autoscale-tes-2019-06-18t05-49-16-591z"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("East US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("3.1"), - // }, - // Kind: to.Ptr("HADOOP"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("4.0.1000.1"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d12_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a2_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2019-11-18T12:25:43.48"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](40), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxHadoopAdlsGen2.json -func ExampleClustersClient_BeginCreate_createHadoopClusterWithAzureDataLakeStorageGen2() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": "true", - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("Hadoop"), - }, - ClusterVersion: to.Ptr("3.6"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D3_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D3_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](4), - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Small"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }}, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.dfs.core.windows.net"), - EnableSecureChannel: to.Ptr(true), - FileSystem: to.Ptr("default"), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("East US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("3.1"), - // }, - // Kind: to.Ptr("HADOOP"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("4.0.1000.1"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d12_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a2_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2019-11-18T12:25:43.48"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](40), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxHadoopSshPassword.json -func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": "true", - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("Hadoop"), - }, - ClusterVersion: to.Ptr("3.5"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D3_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D3_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](4), - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Small"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }}, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("East US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("3.1"), - // }, - // Kind: to.Ptr("HADOOP"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("4.0.1000.1"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d12_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a2_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2019-11-18T12:25:43.48"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](40), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxHadoopSshPublicKey.json -func ExampleClustersClient_BeginCreate_createHadoopOnLinuxClusterWithSshPublicKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("Hadoop"), - }, - ClusterVersion: to.Ptr("3.5"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D3_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D3_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](4), - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Small"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }}, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("East US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("3.1"), - // }, - // Kind: to.Ptr("HADOOP"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("4.0.1000.1"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d12_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a2_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2019-11-18T12:25:43.48"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](40), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateKafkaClusterWithKafkaRestProxy.json -func ExampleClustersClient_BeginCreate_createKafkaClusterWithKafkaRestProxy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - ComponentVersion: map[string]*string{ - "Kafka": to.Ptr("2.1"), - }, - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("kafka"), - }, - ClusterVersion: to.Ptr("4.0"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Large"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - DataDisksGroups: []*armhdinsight.DataDisksGroups{ - { - DisksPerNode: to.Ptr[int32](8), - }}, - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Large"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Small"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }, - { - Name: to.Ptr("kafkamanagementnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D4_v2"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("kafkauser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }}, - }, - KafkaRestProperties: &armhdinsight.KafkaRestProperties{ - ClientGroupInfo: &armhdinsight.ClientGroupInfo{ - GroupID: to.Ptr("00000000-0000-0000-0000-111111111111"), - GroupName: to.Ptr("Kafka security group name"), - }, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("South Central US"), - // Etag: to.Ptr("e1266b83-9bda-4797-a906-1bf82c8eb09a"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/kafka-4.0.1000.1.1911212244.json"), - // ComponentVersion: map[string]*string{ - // "Kafka": to.Ptr("2.1"), - // }, - // Kind: to.Ptr("KAFKA"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("4.0.1000.1"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d3_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // DataDisksGroups: []*armhdinsight.DataDisksGroups{ - // { - // DiskSizeGB: to.Ptr[int32](1023), - // DisksPerNode: to.Ptr[int32](2), - // StorageAccountType: to.Ptr("Standard_LRS"), - // }}, - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d3_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("kafkamanagementnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("KafkaRestProxyPublicEndpoint"), - // Location: to.Ptr("cluster1-kafkarest.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2019-11-25T03:43:23.663"), - // KafkaRestProperties: &armhdinsight.KafkaRestProperties{ - // ClientGroupInfo: &armhdinsight.ClientGroupInfo{ - // GroupID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // GroupName: to.Ptr("security group name"), - // }, - // }, - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](52), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxHadoopSecureHadoop.json -func ExampleClustersClient_BeginCreate_createSecureHadoopCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("Hadoop"), - }, - ClusterVersion: to.Ptr("3.5"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D3_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - ScriptActions: []*armhdinsight.ScriptAction{}, - TargetInstanceCount: to.Ptr[int32](2), - VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - }, - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D3_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - ScriptActions: []*armhdinsight.ScriptAction{}, - TargetInstanceCount: to.Ptr[int32](4), - VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - }, - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Small"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - ScriptActions: []*armhdinsight.ScriptAction{}, - TargetInstanceCount: to.Ptr[int32](3), - VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - }, - }}, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - SecurityProfile: &armhdinsight.SecurityProfile{ - ClusterUsersGroupDNs: []*string{ - to.Ptr("hdiusers")}, - DirectoryType: to.Ptr(armhdinsight.DirectoryTypeActiveDirectory), - Domain: to.Ptr("DomainName"), - DomainUserPassword: to.Ptr("**********"), - DomainUsername: to.Ptr("DomainUsername"), - LdapsUrls: []*string{ - to.Ptr("ldaps://10.10.0.4:636")}, - OrganizationalUnitDN: to.Ptr("OU=Hadoop,DC=hdinsight,DC=test"), - }, - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storage account key"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierPremium), - }, - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("East US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("3.1"), - // }, - // Kind: to.Ptr("HADOOP"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("4.0.1000.1"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d12_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a2_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2019-11-18T12:25:43.48"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](40), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateLinuxSparkSshPassword.json -func ExampleClustersClient_BeginCreate_createSparkOnLinuxClusterWithSshPassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - ComponentVersion: map[string]*string{ - "Spark": to.Ptr("2.0"), - }, - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("Spark"), - }, - ClusterVersion: to.Ptr("3.5"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D12_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D4_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](4), - }}, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("containername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storageapikey*"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("East US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-4.0.1000.1.1910270459.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("3.1"), - // }, - // Kind: to.Ptr("SPARK"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("4.0.1000.1"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d12_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a2_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2019-11-18T12:25:43.48"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](40), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithTLS12.json -func ExampleClustersClient_BeginCreate_createClusterWithTls12() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("Hadoop"), - }, - ClusterVersion: to.Ptr("3.6"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Large"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Large"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Small"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }}, - }, - MinSupportedTLSVersion: to.Ptr("1.2"), - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("default8525"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("South Central US"), - // Etag: to.Ptr("3b76ce3d-892c-4036-9d8b-8ade18ba7a4b"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("2.7"), - // }, - // Kind: to.Ptr("Hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.6.1000.67"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a2_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2020-01-10T08:36:39.153"), - // MinSupportedTLSVersion: to.Ptr("1.2"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](20), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithAvailabilityZones.json -func ExampleClustersClient_BeginCreate_createClusterWithAvailabilityZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "ambari-conf": map[string]any{ - "database-name": "{ambari database name}", - "database-server": "{sql server name}.database.windows.net", - "database-user-name": "**********", - "database-user-password": "**********", - }, - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - "hive-env": map[string]any{ - "hive_database": "Existing MSSQL Server database with SQL authentication", - "hive_database_name": "{hive metastore name}", - "hive_database_type": "mssql", - "hive_existing_mssql_server_database": "{hive metastore name}", - "hive_existing_mssql_server_host": "{sql server name}.database.windows.net", - "hive_hostname": "{sql server name}.database.windows.net", - }, - "hive-site": map[string]any{ - "javax.jdo.option.ConnectionDriverName": "com.microsoft.sqlserver.jdbc.SQLServerDriver", - "javax.jdo.option.ConnectionPassword": "**********!", - "javax.jdo.option.ConnectionURL": "jdbc:sqlserver://{sql server name}.database.windows.net;database={hive metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0", - "javax.jdo.option.ConnectionUserName": "**********", - }, - "oozie-env": map[string]any{ - "oozie_database": "Existing MSSQL Server database with SQL authentication", - "oozie_database_name": "{oozie metastore name}", - "oozie_database_type": "mssql", - "oozie_existing_mssql_server_database": "{oozie metastore name}", - "oozie_existing_mssql_server_host": "{sql server name}.database.windows.net", - "oozie_hostname": "{sql server name}.database.windows.net", - }, - "oozie-site": map[string]any{ - "oozie.db.schema.name": "oozie", - "oozie.service.JPAService.jdbc.driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver", - "oozie.service.JPAService.jdbc.password": "**********", - "oozie.service.JPAService.jdbc.url": "jdbc:sqlserver://{sql server name}.database.windows.net;database={oozie metastore name};encrypt=true;trustServerCertificate=true;create=false;loginTimeout=300;sendStringParametersAsUnicode=true;prepareSQL=0", - "oozie.service.JPAService.jdbc.username": "**********", - }, - }, - Kind: to.Ptr("hadoop"), - }, - ClusterVersion: to.Ptr("3.6"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("standard_d3"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - }, - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("standard_d3"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - }, - }}, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage"), - Container: to.Ptr("containername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storage account key"), - }}, - }, - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("South Central US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterID: to.Ptr("8186508b6234470e9d16c9e8e13bd821"), - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.6.1000.67"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d3"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - // Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - // }, - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d3"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - // Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - // }, - // }}, - // }, - // CreatedDate: to.Ptr("2020-06-09T12:25:43.48"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](16), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithComputeIsolationProperties.json -func ExampleClustersClient_BeginCreate_createClusterWithComputeIsolationProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("hadoop"), - }, - ClusterVersion: to.Ptr("3.6"), - ComputeIsolationProperties: &armhdinsight.ComputeIsolationProperties{ - EnableComputeIsolation: to.Ptr(true), - }, - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("standard_d3"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("standard_d3"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }}, - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage"), - Container: to.Ptr("containername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storage account key"), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("South Central US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterID: to.Ptr("8186508b6234470e9d16c9e8e13bd821"), - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.6.1000.67"), - // ComputeIsolationProperties: &armhdinsight.ComputeIsolationProperties{ - // EnableComputeIsolation: to.Ptr(true), - // }, - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d3"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - // Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - // }, - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d3"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }}, - // }, - // CreatedDate: to.Ptr("2020-06-09T12:25:43.48"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](16), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithEncryptionAtHost.json -func ExampleClustersClient_BeginCreate_createClusterWithEncryptionAtHost() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("Hadoop"), - }, - ClusterVersion: to.Ptr("3.6"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_DS14_v2"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_DS14_v2"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_DS14_v2"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }}, - }, - DiskEncryptionProperties: &armhdinsight.DiskEncryptionProperties{ - EncryptionAtHost: to.Ptr(true), - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("default8525"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("South Central US"), - // Etag: to.Ptr("3b76ce3d-892c-4036-9d8b-8ade18ba7a4b"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("2.7"), - // }, - // Kind: to.Ptr("Hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.6.1000.67"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_ds14_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_ds14_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_ds14_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2020-01-10T08:36:39.153"), - // DiskEncryptionProperties: &armhdinsight.DiskEncryptionProperties{ - // EncryptionAtHost: to.Ptr(true), - // }, - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](20), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithEncryptionInTransit.json -func ExampleClustersClient_BeginCreate_createClusterWithEncryptionInTransit() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("Hadoop"), - }, - ClusterVersion: to.Ptr("3.6"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Large"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Large"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Small"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](3), - }}, - }, - EncryptionInTransitProperties: &armhdinsight.EncryptionInTransitProperties{ - IsEncryptionInTransitEnabled: to.Ptr(true), - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage.blob.core.windows.net"), - Container: to.Ptr("default8525"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storagekey"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("South Central US"), - // Etag: to.Ptr("3b76ce3d-892c-4036-9d8b-8ade18ba7a4b"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2001080246.json"), - // ComponentVersion: map[string]*string{ - // "Hadoop": to.Ptr("2.7"), - // }, - // Kind: to.Ptr("Hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.6.1000.67"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a4_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_a2_v2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2020-01-10T08:36:39.153"), - // EncryptionInTransitProperties: &armhdinsight.EncryptionInTransitProperties{ - // IsEncryptionInTransitEnabled: to.Ptr(true), - // }, - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](20), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateHDInsightClusterWithCustomNetworkProperties.json -func ExampleClustersClient_BeginCreate_createClusterWithNetworkProperties() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreate(ctx, "rg1", "cluster1", armhdinsight.ClusterCreateParametersExtended{ - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("hadoop"), - }, - ClusterVersion: to.Ptr("3.6"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("standard_d3"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - }, - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("standard_d3"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - SSHProfile: &armhdinsight.SSHProfile{ - PublicKeys: []*armhdinsight.SSHPublicKey{ - { - CertificateData: to.Ptr("**********"), - }}, - }, - Username: to.Ptr("sshuser"), - }, - }, - TargetInstanceCount: to.Ptr[int32](2), - VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - }, - }}, - }, - NetworkProperties: &armhdinsight.NetworkProperties{ - PrivateLink: to.Ptr(armhdinsight.PrivateLinkEnabled), - PublicIPTag: &armhdinsight.IPTag{ - IPTagType: to.Ptr("FirstPartyUsage"), - Tag: to.Ptr("/"), - }, - ResourceProviderConnection: to.Ptr(armhdinsight.ResourceProviderConnectionOutbound), - }, - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("mystorage"), - Container: to.Ptr("containername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("storage account key"), - }}, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("South Central US"), - // Etag: to.Ptr("fdf2a6e8-ce83-42cc-8c2d-0ceb11a370ff"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.6.1000.67.2005040905.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterID: to.Ptr("8186508b6234470e9d16c9e8e13bd821"), - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.6.1000.67"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d3"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - // Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - // }, - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("standard_d3"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // VirtualNetworkProfile: &armhdinsight.VirtualNetworkProfile{ - // ID: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname"), - // Subnet: to.Ptr("/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnetname/subnets/vnetsubnet"), - // }, - // }}, - // }, - // CreatedDate: to.Ptr("2020-06-09T12:25:43.48"), - // NetworkProperties: &armhdinsight.NetworkProperties{ - // PrivateLink: to.Ptr(armhdinsight.PrivateLinkEnabled), - // PublicIPTag: &armhdinsight.IPTag{ - // IPTagType: to.Ptr("FirstPartyUsage"), - // Tag: to.Ptr("/"), - // }, - // ResourceProviderConnection: to.Ptr(armhdinsight.ResourceProviderConnectionOutbound), - // }, - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](16), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/PatchLinuxHadoopCluster.json -func ExampleClustersClient_Update_patchHdInsightLinuxClusters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Update(ctx, "rg1", "cluster1", armhdinsight.ClusterPatchParameters{ - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - "key2": to.Ptr("val2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // "key2": to.Ptr("val2"), - // }, - // Etag: to.Ptr("f0212a39-b827-45e0-9ffa-4f5232e58851"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.5.1000.0.9243893.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.5.1000.0"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Medium"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2017-01-11T18:58:26.187"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](24), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/PatchLinuxHadoopClusterWithSystemMSI.json -func ExampleClustersClient_Update_patchHdInsightLinuxClustersWithSystemAssignedMsi() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Update(ctx, "rg1", "cluster1", armhdinsight.ClusterPatchParameters{ - Identity: &armhdinsight.ClusterIdentity{ - Type: to.Ptr(armhdinsight.ResourceIdentityTypeSystemAssigned), - }, - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - "key2": to.Ptr("val2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // "key2": to.Ptr("val2"), - // }, - // Etag: to.Ptr("f0212a39-b827-45e0-9ffa-4f5232e58851"), - // Identity: &armhdinsight.ClusterIdentity{ - // Type: to.Ptr(armhdinsight.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("principalId"), - // TenantID: to.Ptr("tenantId"), - // }, - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.5.1000.0.9243893.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.5.1000.0"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Medium"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2017-01-11T18:58:26.187"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](24), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeleteLinuxHadoopCluster.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 := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginDelete(ctx, "rg1", "cluster1", 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxHadoopCluster.json -func ExampleClustersClient_Get_getHadoopOnLinuxCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Get(ctx, "rg1", "cluster1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Etag: to.Ptr("f0212a39-b827-45e0-9ffa-4f5232e58851"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.5.1000.0.9243893.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.5.1000.0"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Medium"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2017-01-11T18:58:26.187"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](24), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxSparkCluster.json -func ExampleClustersClient_Get_getSparkOnLinuxCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Get(ctx, "rg1", "cluster1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armhdinsight.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Etag: to.Ptr("4cd8b5a9-ca9c-4239-9e5b-3916032e994c"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/spark-3.5.1000.0.9625065.json"), - // ComponentVersion: map[string]*string{ - // "Spark": to.Ptr("2.0"), - // }, - // Kind: to.Ptr("SPARK"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.5.1000.0"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D12_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D4_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Medium"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("sshuser"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2017-03-03T08:35:07.323"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](40), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxHadoopAllClustersInResourceGroup.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 := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListByResourceGroupPager("rg1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClusterListResult = armhdinsight.ClusterListResult{ - // Value: []*armhdinsight.Cluster{ - // { - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Etag: to.Ptr("f0212a39-b827-45e0-9ffa-4f5232e58851"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.5.1000.0.9243893.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.5.1000.0"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Medium"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2017-01-11T18:58:26.187"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](24), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // }, - // { - // Name: to.Ptr("cluster2"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster2"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Etag: to.Ptr("f0212a39-b827-45e0-9ffa-4f5232e58851"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.5.1000.0.9243893.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.5.1000.0"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Medium"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster2-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster2.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2017-01-11T18:58:26.187"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](24), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ResizeLinuxHadoopCluster.json -func ExampleClustersClient_BeginResize() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginResize(ctx, "rg1", "cluster1", armhdinsight.RoleNameWorkernode, armhdinsight.ClusterResizeParameters{ - TargetInstanceCount: to.Ptr[int32](10), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DisableClusterAutoScale.json -func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_disableAutoscaleForTheHdInsightCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUpdateAutoScaleConfiguration(ctx, "rg1", "cluster1", armhdinsight.RoleNameWorkernode, armhdinsight.AutoscaleConfigurationUpdateParameter{}, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableOrUpdateAutoScaleWithLoadBasedConfiguration.json -func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_enableOrUpdateAutoscaleWithTheLoadBasedConfigurationForHdInsightCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUpdateAutoScaleConfiguration(ctx, "rg1", "cluster1", armhdinsight.RoleNameWorkernode, armhdinsight.AutoscaleConfigurationUpdateParameter{ - Autoscale: &armhdinsight.Autoscale{ - Capacity: &armhdinsight.AutoscaleCapacity{ - MaxInstanceCount: to.Ptr[int32](5), - MinInstanceCount: to.Ptr[int32](3), - }, - }, - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableOrUpdateAutoScaleWithScheduleBasedConfiguration.json -func ExampleClustersClient_BeginUpdateAutoScaleConfiguration_enableOrUpdateAutoscaleWithTheScheduleBasedConfigurationForHdInsightCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUpdateAutoScaleConfiguration(ctx, "rg1", "cluster1", armhdinsight.RoleNameWorkernode, armhdinsight.AutoscaleConfigurationUpdateParameter{ - Autoscale: &armhdinsight.Autoscale{ - Recurrence: &armhdinsight.AutoscaleRecurrence{ - Schedule: []*armhdinsight.AutoscaleSchedule{ - { - Days: []*armhdinsight.DaysOfWeek{ - to.Ptr(armhdinsight.DaysOfWeekThursday)}, - TimeAndCapacity: &armhdinsight.AutoscaleTimeAndCapacity{ - MaxInstanceCount: to.Ptr[int32](4), - MinInstanceCount: to.Ptr[int32](4), - Time: to.Ptr("16:00"), - }, - }}, - TimeZone: to.Ptr("China Standard Time"), - }, - }, - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxHadoopAllClusters.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 := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ClusterListResult = armhdinsight.ClusterListResult{ - // Value: []*armhdinsight.Cluster{ - // { - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Etag: to.Ptr("f0212a39-b827-45e0-9ffa-4f5232e58851"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.5.1000.0.9243893.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.5.1000.0"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Medium"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster1-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster1.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2017-01-11T18:58:26.187"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](24), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // }, - // { - // Name: to.Ptr("cluster2"), - // Type: to.Ptr("Microsoft.HDInsight/clusters"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster2"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("val1"), - // }, - // Etag: to.Ptr("f0212a39-b827-45e0-9ffa-4f5232e58851"), - // Properties: &armhdinsight.ClusterGetProperties{ - // ClusterDefinition: &armhdinsight.ClusterDefinition{ - // Blueprint: to.Ptr("https://blueprints.azurehdinsight.net/hadoop-3.5.1000.0.9243893.json"), - // Kind: to.Ptr("hadoop"), - // }, - // ClusterState: to.Ptr("Running"), - // ClusterVersion: to.Ptr("3.5.1000.0"), - // ComputeProfile: &armhdinsight.ComputeProfile{ - // Roles: []*armhdinsight.Role{ - // { - // Name: to.Ptr("headnode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](2), - // }, - // { - // Name: to.Ptr("workernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Standard_D3_V2"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](4), - // }, - // { - // Name: to.Ptr("zookeepernode"), - // HardwareProfile: &armhdinsight.HardwareProfile{ - // VMSize: to.Ptr("Medium"), - // }, - // OSProfile: &armhdinsight.OsProfile{ - // LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - // Username: to.Ptr("pulkitssh"), - // }, - // }, - // TargetInstanceCount: to.Ptr[int32](3), - // }}, - // }, - // ConnectivityEndpoints: []*armhdinsight.ConnectivityEndpoint{ - // { - // Name: to.Ptr("SSH"), - // Location: to.Ptr("cluster2-ssh.azurehdinsight.net"), - // Port: to.Ptr[int32](22), - // Protocol: to.Ptr("TCP"), - // }, - // { - // Name: to.Ptr("HTTPS"), - // Location: to.Ptr("cluster2.azurehdinsight.net"), - // Port: to.Ptr[int32](443), - // Protocol: to.Ptr("TCP"), - // }}, - // CreatedDate: to.Ptr("2017-01-11T18:58:26.187"), - // OSType: to.Ptr(armhdinsight.OSTypeLinux), - // ProvisioningState: to.Ptr(armhdinsight.HDInsightClusterProvisioningStateSucceeded), - // QuotaInfo: &armhdinsight.QuotaInfo{ - // CoresUsed: to.Ptr[int32](24), - // }, - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/RotateLinuxHadoopClusterDiskEncryptionKey.json -func ExampleClustersClient_BeginRotateDiskEncryptionKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginRotateDiskEncryptionKey(ctx, "rg1", "cluster1", armhdinsight.ClusterDiskEncryptionParameters{ - KeyName: to.Ptr("newkeyname"), - KeyVersion: to.Ptr("newkeyversion"), - VaultURI: to.Ptr("https://newkeyvault.vault.azure.net/"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Clusters_GetGatewaySettings.json -func ExampleClustersClient_GetGatewaySettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().GetGatewaySettings(ctx, "rg1", "cluster1", 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.GatewaySettings = armhdinsight.GatewaySettings{ - // IsCredentialEnabled: to.Ptr("true"), - // Password: to.Ptr("**********"), - // UserName: to.Ptr("hadoop"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Clusters_UpdateGatewaySettings_Enable.json -func ExampleClustersClient_BeginUpdateGatewaySettings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUpdateGatewaySettings(ctx, "rg1", "cluster1", armhdinsight.UpdateGatewaySettingsParameters{ - IsCredentialEnabled: to.Ptr(true), - Password: to.Ptr("**********"), - UserName: to.Ptr("hadoop"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetClusterCreatingAsyncOperationStatus.json -func ExampleClustersClient_GetAzureAsyncOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().GetAzureAsyncOperationStatus(ctx, "rg1", "cluster1", "CF938302-6B4D-44A0-A6D2-C0D67E847AEC", 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.AsyncOperationResult = armhdinsight.AsyncOperationResult{ - // Status: to.Ptr(armhdinsight.AsyncOperationStateInProgress), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Clusters_UpdateClusterIdentityCertificate.json -func ExampleClustersClient_BeginUpdateIdentityCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUpdateIdentityCertificate(ctx, "rg1", "cluster1", armhdinsight.UpdateClusterIdentityCertificateParameters{ - ApplicationID: to.Ptr("applicationId"), - Certificate: to.Ptr("base64encodedcertificate"), - CertificatePassword: to.Ptr("**********"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/PostExecuteScriptAction.json -func ExampleClustersClient_BeginExecuteScriptActions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginExecuteScriptActions(ctx, "rg1", "cluster1", armhdinsight.ExecuteScriptActionParameters{ - PersistOnSuccess: to.Ptr(false), - ScriptActions: []*armhdinsight.RuntimeScriptAction{ - { - Name: to.Ptr("Test"), - Parameters: to.Ptr(""), - Roles: []*string{ - to.Ptr("headnode"), - to.Ptr("workernode")}, - URI: to.Ptr("http://testurl.com/install.ssh"), - }}, - }, 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/hdinsight/armhdinsight/configurations_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client.go index 68674bf12155..cf6a6608f5c5 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -48,7 +45,7 @@ func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCrede // Please consider using List configurations API instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - configurationName - The name of the cluster configuration. @@ -76,7 +73,7 @@ func (client *ConfigurationsClient) Get(ctx context.Context, resourceGroupName s } // getCreateRequest creates the Get request. -func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, options *ConfigurationsClientGetOptions) (*policy.Request, error) { +func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, _ *ConfigurationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,7 +96,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +114,7 @@ func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (Conf // List - Gets all configuration information for an HDI cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ConfigurationsClientListOptions contains the optional parameters for the ConfigurationsClient.List method. @@ -144,7 +141,7 @@ func (client *ConfigurationsClient) List(ctx context.Context, resourceGroupName } // listCreateRequest creates the List request. -func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ConfigurationsClientListOptions) (*policy.Request, error) { +func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ConfigurationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -163,7 +160,7 @@ func (client *ConfigurationsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +179,7 @@ func (client *ConfigurationsClient) listHandleResponse(resp *http.Response) (Con // in cluster endpoint instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - configurationName - The name of the cluster configuration. @@ -211,7 +208,7 @@ func (client *ConfigurationsClient) BeginUpdate(ctx context.Context, resourceGro // in cluster endpoint instead. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string, options *ConfigurationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ConfigurationsClient.BeginUpdate" @@ -234,7 +231,7 @@ func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupNam } // updateCreateRequest creates the Update request. -func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string, options *ConfigurationsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters map[string]*string, _ *ConfigurationsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -257,7 +254,7 @@ func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client_example_test.go deleted file mode 100644 index ca4c581c2b33..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/configurations_client_example_test.go +++ /dev/null @@ -1,124 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_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/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Configurations_List.json -func ExampleConfigurationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationsClient().List(ctx, "rg1", "cluster1", 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.ClusterConfigurations = armhdinsight.ClusterConfigurations{ - // Configurations: map[string]map[string]*string{ - // "core-site": map[string]*string{ - // "fs.azure.account.key.test.blob.core.windows.net": to.Ptr("accountKey"), - // "fs.defaultFS": to.Ptr("wasb://test.blob.core.windows.net"), - // }, - // "gateway": map[string]*string{ - // "restAuthCredential.isEnabled": to.Ptr("true"), - // "restAuthCredential.password": to.Ptr("**********"), - // "restAuthCredential.username": to.Ptr("admin"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ChangeHttpConnectivityDisable.json -func ExampleConfigurationsClient_BeginUpdate_disableHttpConnectivity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginUpdate(ctx, "rg1", "cluster1", "gateway", map[string]*string{ - "restAuthCredential.isEnabled": to.Ptr("false"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ChangeHttpConnectivityEnable.json -func ExampleConfigurationsClient_BeginUpdate_enableHttpConnectivity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginUpdate(ctx, "rg1", "cluster1", "gateway", map[string]*string{ - "restAuthCredential.isEnabled": to.Ptr("true"), - "restAuthCredential.password": to.Ptr("**********"), - "restAuthCredential.username": to.Ptr("hadoop"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Configurations_Get.json -func ExampleConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationsClient().Get(ctx, "rg1", "cluster1", "core-site", 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.Value = map[string]*string{ - // "fs.azure.account.key.test.blob.core.windows.net": to.Ptr("accountKey"), - // "fs.defaultFS": to.Ptr("wasb://test.blob.core.windows.net"), - // } -} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/constants.go b/sdk/resourcemanager/hdinsight/armhdinsight/constants.go index 59dd29978098..b5859fd9ef41 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/constants.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/constants.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -10,7 +7,7 @@ package armhdinsight const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" - moduleVersion = "v1.3.0-beta.2" + moduleVersion = "v1.3.0-beta.3" ) // AsyncOperationState - The async operation state. diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client.go index 12a1eef90e4d..d77f25242a04 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewExtensionsClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreate - Creates an HDInsight cluster extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - extensionName - The name of the cluster extension. @@ -74,7 +71,7 @@ func (client *ExtensionsClient) BeginCreate(ctx context.Context, resourceGroupNa // Create - Creates an HDInsight cluster extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ExtensionsClient) create(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension, options *ExtensionsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginCreate" @@ -97,7 +94,7 @@ func (client *ExtensionsClient) create(ctx context.Context, resourceGroupName st } // createCreateRequest creates the Create request. -func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension, options *ExtensionsClientBeginCreateOptions) (*policy.Request, error) { +func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters Extension, _ *ExtensionsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -120,7 +117,7 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,7 +129,7 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, resourc // BeginDelete - Deletes the specified extension for HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - extensionName - The name of the cluster extension. @@ -158,7 +155,7 @@ func (client *ExtensionsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Deletes the specified extension for HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginDelete" @@ -181,7 +178,7 @@ func (client *ExtensionsClient) deleteOperation(ctx context.Context, resourceGro } // deleteCreateRequest creates the Delete request. -func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, options *ExtensionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, _ *ExtensionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -204,7 +201,7 @@ func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +210,7 @@ func (client *ExtensionsClient) deleteCreateRequest(ctx context.Context, resourc // BeginDisableAzureMonitor - Disables the Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientBeginDisableAzureMonitorOptions contains the optional parameters for the ExtensionsClient.BeginDisableAzureMonitor @@ -239,7 +236,7 @@ func (client *ExtensionsClient) BeginDisableAzureMonitor(ctx context.Context, re // DisableAzureMonitor - Disables the Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ExtensionsClient) disableAzureMonitor(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientBeginDisableAzureMonitorOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginDisableAzureMonitor" @@ -262,7 +259,7 @@ func (client *ExtensionsClient) disableAzureMonitor(ctx context.Context, resourc } // disableAzureMonitorCreateRequest creates the DisableAzureMonitor request. -func (client *ExtensionsClient) disableAzureMonitorCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientBeginDisableAzureMonitorOptions) (*policy.Request, error) { +func (client *ExtensionsClient) disableAzureMonitorCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ExtensionsClientBeginDisableAzureMonitorOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -281,7 +278,7 @@ func (client *ExtensionsClient) disableAzureMonitorCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -290,7 +287,7 @@ func (client *ExtensionsClient) disableAzureMonitorCreateRequest(ctx context.Con // BeginDisableAzureMonitorAgent - Disables the Azure Monitor Agent on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientBeginDisableAzureMonitorAgentOptions contains the optional parameters for the ExtensionsClient.BeginDisableAzureMonitorAgent @@ -316,7 +313,7 @@ func (client *ExtensionsClient) BeginDisableAzureMonitorAgent(ctx context.Contex // DisableAzureMonitorAgent - Disables the Azure Monitor Agent on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ExtensionsClient) disableAzureMonitorAgent(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientBeginDisableAzureMonitorAgentOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginDisableAzureMonitorAgent" @@ -339,7 +336,7 @@ func (client *ExtensionsClient) disableAzureMonitorAgent(ctx context.Context, re } // disableAzureMonitorAgentCreateRequest creates the DisableAzureMonitorAgent request. -func (client *ExtensionsClient) disableAzureMonitorAgentCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientBeginDisableAzureMonitorAgentOptions) (*policy.Request, error) { +func (client *ExtensionsClient) disableAzureMonitorAgentCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ExtensionsClientBeginDisableAzureMonitorAgentOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitorAgent" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -358,7 +355,7 @@ func (client *ExtensionsClient) disableAzureMonitorAgentCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -367,7 +364,7 @@ func (client *ExtensionsClient) disableAzureMonitorAgentCreateRequest(ctx contex // BeginDisableMonitoring - Disables the Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientBeginDisableMonitoringOptions contains the optional parameters for the ExtensionsClient.BeginDisableMonitoring @@ -393,7 +390,7 @@ func (client *ExtensionsClient) BeginDisableMonitoring(ctx context.Context, reso // DisableMonitoring - Disables the Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ExtensionsClient) disableMonitoring(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientBeginDisableMonitoringOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginDisableMonitoring" @@ -416,7 +413,7 @@ func (client *ExtensionsClient) disableMonitoring(ctx context.Context, resourceG } // disableMonitoringCreateRequest creates the DisableMonitoring request. -func (client *ExtensionsClient) disableMonitoringCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientBeginDisableMonitoringOptions) (*policy.Request, error) { +func (client *ExtensionsClient) disableMonitoringCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ExtensionsClientBeginDisableMonitoringOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -435,7 +432,7 @@ func (client *ExtensionsClient) disableMonitoringCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -444,7 +441,7 @@ func (client *ExtensionsClient) disableMonitoringCreateRequest(ctx context.Conte // BeginEnableAzureMonitor - Enables the Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The Log Analytics workspace parameters. @@ -471,7 +468,7 @@ func (client *ExtensionsClient) BeginEnableAzureMonitor(ctx context.Context, res // EnableAzureMonitor - Enables the Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ExtensionsClient) enableAzureMonitor(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest, options *ExtensionsClientBeginEnableAzureMonitorOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginEnableAzureMonitor" @@ -494,7 +491,7 @@ func (client *ExtensionsClient) enableAzureMonitor(ctx context.Context, resource } // enableAzureMonitorCreateRequest creates the EnableAzureMonitor request. -func (client *ExtensionsClient) enableAzureMonitorCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest, options *ExtensionsClientBeginEnableAzureMonitorOptions) (*policy.Request, error) { +func (client *ExtensionsClient) enableAzureMonitorCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest, _ *ExtensionsClientBeginEnableAzureMonitorOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -513,7 +510,7 @@ func (client *ExtensionsClient) enableAzureMonitorCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -525,7 +522,7 @@ func (client *ExtensionsClient) enableAzureMonitorCreateRequest(ctx context.Cont // BeginEnableAzureMonitorAgent - Enables the Azure Monitor Agent on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The Log Analytics workspace parameters. @@ -552,7 +549,7 @@ func (client *ExtensionsClient) BeginEnableAzureMonitorAgent(ctx context.Context // EnableAzureMonitorAgent - Enables the Azure Monitor Agent on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ExtensionsClient) enableAzureMonitorAgent(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest, options *ExtensionsClientBeginEnableAzureMonitorAgentOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginEnableAzureMonitorAgent" @@ -575,7 +572,7 @@ func (client *ExtensionsClient) enableAzureMonitorAgent(ctx context.Context, res } // enableAzureMonitorAgentCreateRequest creates the EnableAzureMonitorAgent request. -func (client *ExtensionsClient) enableAzureMonitorAgentCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest, options *ExtensionsClientBeginEnableAzureMonitorAgentOptions) (*policy.Request, error) { +func (client *ExtensionsClient) enableAzureMonitorAgentCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters AzureMonitorRequest, _ *ExtensionsClientBeginEnableAzureMonitorAgentOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitorAgent" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -594,7 +591,7 @@ func (client *ExtensionsClient) enableAzureMonitorAgentCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -606,7 +603,7 @@ func (client *ExtensionsClient) enableAzureMonitorAgentCreateRequest(ctx context // BeginEnableMonitoring - Enables the Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - parameters - The Operations Management Suite (OMS) workspace parameters. @@ -633,7 +630,7 @@ func (client *ExtensionsClient) BeginEnableMonitoring(ctx context.Context, resou // EnableMonitoring - Enables the Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *ExtensionsClient) enableMonitoring(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterMonitoringRequest, options *ExtensionsClientBeginEnableMonitoringOptions) (*http.Response, error) { var err error const operationName = "ExtensionsClient.BeginEnableMonitoring" @@ -656,7 +653,7 @@ func (client *ExtensionsClient) enableMonitoring(ctx context.Context, resourceGr } // enableMonitoringCreateRequest creates the EnableMonitoring request. -func (client *ExtensionsClient) enableMonitoringCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterMonitoringRequest, options *ExtensionsClientBeginEnableMonitoringOptions) (*policy.Request, error) { +func (client *ExtensionsClient) enableMonitoringCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterMonitoringRequest, _ *ExtensionsClientBeginEnableMonitoringOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -675,7 +672,7 @@ func (client *ExtensionsClient) enableMonitoringCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -687,7 +684,7 @@ func (client *ExtensionsClient) enableMonitoringCreateRequest(ctx context.Contex // Get - Gets the extension properties for the specified HDInsight cluster extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - extensionName - The name of the cluster extension. @@ -715,7 +712,7 @@ func (client *ExtensionsClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, options *ExtensionsClientGetOptions) (*policy.Request, error) { +func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, _ *ExtensionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -738,7 +735,7 @@ func (client *ExtensionsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -756,7 +753,7 @@ func (client *ExtensionsClient) getHandleResponse(resp *http.Response) (Extensio // GetAzureAsyncOperationStatus - Gets the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - extensionName - The name of the cluster extension. @@ -786,7 +783,7 @@ func (client *ExtensionsClient) GetAzureAsyncOperationStatus(ctx context.Context } // getAzureAsyncOperationStatusCreateRequest creates the GetAzureAsyncOperationStatus request. -func (client *ExtensionsClient) getAzureAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, operationID string, options *ExtensionsClientGetAzureAsyncOperationStatusOptions) (*policy.Request, error) { +func (client *ExtensionsClient) getAzureAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, operationID string, _ *ExtensionsClientGetAzureAsyncOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -813,7 +810,7 @@ func (client *ExtensionsClient) getAzureAsyncOperationStatusCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -831,7 +828,7 @@ func (client *ExtensionsClient) getAzureAsyncOperationStatusHandleResponse(resp // GetAzureMonitorAgentStatus - Gets the status of Azure Monitor Agent on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientGetAzureMonitorAgentStatusOptions contains the optional parameters for the ExtensionsClient.GetAzureMonitorAgentStatus @@ -859,7 +856,7 @@ func (client *ExtensionsClient) GetAzureMonitorAgentStatus(ctx context.Context, } // getAzureMonitorAgentStatusCreateRequest creates the GetAzureMonitorAgentStatus request. -func (client *ExtensionsClient) getAzureMonitorAgentStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientGetAzureMonitorAgentStatusOptions) (*policy.Request, error) { +func (client *ExtensionsClient) getAzureMonitorAgentStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ExtensionsClientGetAzureMonitorAgentStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitorAgent" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -878,7 +875,7 @@ func (client *ExtensionsClient) getAzureMonitorAgentStatusCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -896,7 +893,7 @@ func (client *ExtensionsClient) getAzureMonitorAgentStatusHandleResponse(resp *h // GetAzureMonitorStatus - Gets the status of Azure Monitor on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientGetAzureMonitorStatusOptions contains the optional parameters for the ExtensionsClient.GetAzureMonitorStatus @@ -924,7 +921,7 @@ func (client *ExtensionsClient) GetAzureMonitorStatus(ctx context.Context, resou } // getAzureMonitorStatusCreateRequest creates the GetAzureMonitorStatus request. -func (client *ExtensionsClient) getAzureMonitorStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientGetAzureMonitorStatusOptions) (*policy.Request, error) { +func (client *ExtensionsClient) getAzureMonitorStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ExtensionsClientGetAzureMonitorStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -943,7 +940,7 @@ func (client *ExtensionsClient) getAzureMonitorStatusCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -961,7 +958,7 @@ func (client *ExtensionsClient) getAzureMonitorStatusHandleResponse(resp *http.R // GetMonitoringStatus - Gets the status of Operations Management Suite (OMS) on the HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ExtensionsClientGetMonitoringStatusOptions contains the optional parameters for the ExtensionsClient.GetMonitoringStatus @@ -989,7 +986,7 @@ func (client *ExtensionsClient) GetMonitoringStatus(ctx context.Context, resourc } // getMonitoringStatusCreateRequest creates the GetMonitoringStatus request. -func (client *ExtensionsClient) getMonitoringStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ExtensionsClientGetMonitoringStatusOptions) (*policy.Request, error) { +func (client *ExtensionsClient) getMonitoringStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ExtensionsClientGetMonitoringStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1008,7 +1005,7 @@ func (client *ExtensionsClient) getMonitoringStatusCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client_example_test.go deleted file mode 100644 index 06fde2e8ae63..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/extensions_client_example_test.go +++ /dev/null @@ -1,318 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_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/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableLinuxClusterMonitoring.json -func ExampleExtensionsClient_BeginEnableMonitoring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginEnableMonitoring(ctx, "rg1", "cluster1", armhdinsight.ClusterMonitoringRequest{ - PrimaryKey: to.Ptr("**********"), - WorkspaceID: to.Ptr("a2090ead-8c9f-4fba-b70e-533e3e003163"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxClusterMonitoringStatus.json -func ExampleExtensionsClient_GetMonitoringStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtensionsClient().GetMonitoringStatus(ctx, "rg1", "cluster1", 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.ClusterMonitoringResponse = armhdinsight.ClusterMonitoringResponse{ - // ClusterMonitoringEnabled: to.Ptr(true), - // WorkspaceID: to.Ptr("id"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DisableLinuxClusterMonitoring.json -func ExampleExtensionsClient_BeginDisableMonitoring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginDisableMonitoring(ctx, "rg1", "cluster1", 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableLinuxClusterAzureMonitor.json -func ExampleExtensionsClient_BeginEnableAzureMonitor() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginEnableAzureMonitor(ctx, "rg1", "cluster1", armhdinsight.AzureMonitorRequest{ - PrimaryKey: to.Ptr("**********"), - WorkspaceID: to.Ptr("a2090ead-8c9f-4fba-b70e-533e3e003163"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxClusterAzureMonitorStatus.json -func ExampleExtensionsClient_GetAzureMonitorStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtensionsClient().GetAzureMonitorStatus(ctx, "rg1", "cluster1", 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.AzureMonitorResponse = armhdinsight.AzureMonitorResponse{ - // ClusterMonitoringEnabled: to.Ptr(true), - // WorkspaceID: to.Ptr("id"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DisableLinuxClusterAzureMonitor.json -func ExampleExtensionsClient_BeginDisableAzureMonitor() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginDisableAzureMonitor(ctx, "rg1", "cluster1", 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/EnableLinuxClusterAzureMonitorAgent.json -func ExampleExtensionsClient_BeginEnableAzureMonitorAgent() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginEnableAzureMonitorAgent(ctx, "rg1", "cluster1", armhdinsight.AzureMonitorRequest{ - PrimaryKey: to.Ptr("**********"), - WorkspaceID: to.Ptr("a2090ead-8c9f-4fba-b70e-533e3e003163"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxClusterAzureMonitorAgentStatus.json -func ExampleExtensionsClient_GetAzureMonitorAgentStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtensionsClient().GetAzureMonitorAgentStatus(ctx, "rg1", "cluster1", 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.AzureMonitorResponse = armhdinsight.AzureMonitorResponse{ - // ClusterMonitoringEnabled: to.Ptr(true), - // WorkspaceID: to.Ptr("id"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DisableLinuxClusterAzureMonitorAgent.json -func ExampleExtensionsClient_BeginDisableAzureMonitorAgent() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginDisableAzureMonitorAgent(ctx, "rg1", "cluster1", 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/CreateExtension.json -func ExampleExtensionsClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginCreate(ctx, "rg1", "cluster1", "clustermonitoring", armhdinsight.Extension{ - PrimaryKey: to.Ptr("**********"), - WorkspaceID: to.Ptr("a2090ead-8c9f-4fba-b70e-533e3e003163"), - }, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetExtension.json -func ExampleExtensionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtensionsClient().Get(ctx, "rg1", "cluster1", "clustermonitoring", 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.ClusterMonitoringResponse = armhdinsight.ClusterMonitoringResponse{ - // ClusterMonitoringEnabled: to.Ptr(true), - // WorkspaceID: to.Ptr("id"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeleteExtension.json -func ExampleExtensionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExtensionsClient().BeginDelete(ctx, "rg1", "cluster1", "clustermonitoring", 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetExtensionCreationAsyncOperationStatus.json -func ExampleExtensionsClient_GetAzureAsyncOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExtensionsClient().GetAzureAsyncOperationStatus(ctx, "rg1", "cluster1", "azuremonitor", "CF938302-6B4D-44A0-A6D2-C0D67E847AEC", 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.AsyncOperationResult = armhdinsight.AsyncOperationResult{ - // Status: to.Ptr(armhdinsight.AsyncOperationStateInProgress), - // } -} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/fake/applications_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/applications_server.go index 38390a635128..ececade1050c 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/applications_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/applications_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -74,29 +71,48 @@ func (a *ApplicationsServerTransport) Do(req *http.Request) (*http.Response, err 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 "ApplicationsClient.BeginCreate": - resp, err = a.dispatchBeginCreate(req) - case "ApplicationsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "ApplicationsClient.Get": - resp, err = a.dispatchGet(req) - case "ApplicationsClient.GetAzureAsyncOperationStatus": - resp, err = a.dispatchGetAzureAsyncOperationStatus(req) - case "ApplicationsClient.NewListByClusterPager": - resp, err = a.dispatchNewListByClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *ApplicationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if applicationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = applicationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ApplicationsClient.BeginCreate": + res.resp, res.err = a.dispatchBeginCreate(req) + case "ApplicationsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "ApplicationsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "ApplicationsClient.GetAzureAsyncOperationStatus": + res.resp, res.err = a.dispatchGetAzureAsyncOperationStatus(req) + case "ApplicationsClient.NewListByClusterPager": + res.resp, res.err = a.dispatchNewListByClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *ApplicationsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -317,3 +333,9 @@ func (a *ApplicationsServerTransport) dispatchNewListByClusterPager(req *http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to ApplicationsServerTransport +var applicationsServerTransportInterceptor 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/hdinsight/armhdinsight/fake/clusters_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/clusters_server.go index 851c08a19f5a..3f295eef6f68 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/clusters_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/clusters_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -33,7 +30,7 @@ type ClustersServer struct { BeginDelete func(ctx context.Context, resourceGroupName string, clusterName string, options *armhdinsight.ClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armhdinsight.ClustersClientDeleteResponse], errResp azfake.ErrorResponder) // BeginExecuteScriptActions is the fake for method ClustersClient.BeginExecuteScriptActions - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginExecuteScriptActions func(ctx context.Context, resourceGroupName string, clusterName string, parameters armhdinsight.ExecuteScriptActionParameters, options *armhdinsight.ClustersClientBeginExecuteScriptActionsOptions) (resp azfake.PollerResponder[armhdinsight.ClustersClientExecuteScriptActionsResponse], errResp azfake.ErrorResponder) // Get is the fake for method ClustersClient.Get @@ -57,11 +54,11 @@ type ClustersServer struct { NewListByResourceGroupPager func(resourceGroupName string, options *armhdinsight.ClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armhdinsight.ClustersClientListByResourceGroupResponse]) // BeginResize is the fake for method ClustersClient.BeginResize - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginResize func(ctx context.Context, resourceGroupName string, clusterName string, roleName armhdinsight.RoleName, parameters armhdinsight.ClusterResizeParameters, options *armhdinsight.ClustersClientBeginResizeOptions) (resp azfake.PollerResponder[armhdinsight.ClustersClientResizeResponse], errResp azfake.ErrorResponder) // BeginRotateDiskEncryptionKey is the fake for method ClustersClient.BeginRotateDiskEncryptionKey - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRotateDiskEncryptionKey func(ctx context.Context, resourceGroupName string, clusterName string, parameters armhdinsight.ClusterDiskEncryptionParameters, options *armhdinsight.ClustersClientBeginRotateDiskEncryptionKeyOptions) (resp azfake.PollerResponder[armhdinsight.ClustersClientRotateDiskEncryptionKeyResponse], errResp azfake.ErrorResponder) // Update is the fake for method ClustersClient.Update @@ -69,15 +66,15 @@ type ClustersServer struct { Update func(ctx context.Context, resourceGroupName string, clusterName string, parameters armhdinsight.ClusterPatchParameters, options *armhdinsight.ClustersClientUpdateOptions) (resp azfake.Responder[armhdinsight.ClustersClientUpdateResponse], errResp azfake.ErrorResponder) // BeginUpdateAutoScaleConfiguration is the fake for method ClustersClient.BeginUpdateAutoScaleConfiguration - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginUpdateAutoScaleConfiguration func(ctx context.Context, resourceGroupName string, clusterName string, roleName armhdinsight.RoleName, parameters armhdinsight.AutoscaleConfigurationUpdateParameter, options *armhdinsight.ClustersClientBeginUpdateAutoScaleConfigurationOptions) (resp azfake.PollerResponder[armhdinsight.ClustersClientUpdateAutoScaleConfigurationResponse], errResp azfake.ErrorResponder) // BeginUpdateGatewaySettings is the fake for method ClustersClient.BeginUpdateGatewaySettings - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginUpdateGatewaySettings func(ctx context.Context, resourceGroupName string, clusterName string, parameters armhdinsight.UpdateGatewaySettingsParameters, options *armhdinsight.ClustersClientBeginUpdateGatewaySettingsOptions) (resp azfake.PollerResponder[armhdinsight.ClustersClientUpdateGatewaySettingsResponse], errResp azfake.ErrorResponder) // BeginUpdateIdentityCertificate is the fake for method ClustersClient.BeginUpdateIdentityCertificate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginUpdateIdentityCertificate func(ctx context.Context, resourceGroupName string, clusterName string, parameters armhdinsight.UpdateClusterIdentityCertificateParameters, options *armhdinsight.ClustersClientBeginUpdateIdentityCertificateOptions) (resp azfake.PollerResponder[armhdinsight.ClustersClientUpdateIdentityCertificateResponse], errResp azfake.ErrorResponder) } @@ -124,47 +121,66 @@ 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.BeginCreate": - resp, err = c.dispatchBeginCreate(req) - case "ClustersClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "ClustersClient.BeginExecuteScriptActions": - resp, err = c.dispatchBeginExecuteScriptActions(req) - case "ClustersClient.Get": - resp, err = c.dispatchGet(req) - case "ClustersClient.GetAzureAsyncOperationStatus": - resp, err = c.dispatchGetAzureAsyncOperationStatus(req) - case "ClustersClient.GetGatewaySettings": - resp, err = c.dispatchGetGatewaySettings(req) - case "ClustersClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "ClustersClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "ClustersClient.BeginResize": - resp, err = c.dispatchBeginResize(req) - case "ClustersClient.BeginRotateDiskEncryptionKey": - resp, err = c.dispatchBeginRotateDiskEncryptionKey(req) - case "ClustersClient.Update": - resp, err = c.dispatchUpdate(req) - case "ClustersClient.BeginUpdateAutoScaleConfiguration": - resp, err = c.dispatchBeginUpdateAutoScaleConfiguration(req) - case "ClustersClient.BeginUpdateGatewaySettings": - resp, err = c.dispatchBeginUpdateGatewaySettings(req) - case "ClustersClient.BeginUpdateIdentityCertificate": - resp, err = c.dispatchBeginUpdateIdentityCertificate(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) + defer close(resultChan) + + 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.BeginCreate": + res.resp, res.err = c.dispatchBeginCreate(req) + case "ClustersClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "ClustersClient.BeginExecuteScriptActions": + res.resp, res.err = c.dispatchBeginExecuteScriptActions(req) + case "ClustersClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ClustersClient.GetAzureAsyncOperationStatus": + res.resp, res.err = c.dispatchGetAzureAsyncOperationStatus(req) + case "ClustersClient.GetGatewaySettings": + res.resp, res.err = c.dispatchGetGatewaySettings(req) + case "ClustersClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + case "ClustersClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "ClustersClient.BeginResize": + res.resp, res.err = c.dispatchBeginResize(req) + case "ClustersClient.BeginRotateDiskEncryptionKey": + res.resp, res.err = c.dispatchBeginRotateDiskEncryptionKey(req) + case "ClustersClient.Update": + res.resp, res.err = c.dispatchUpdate(req) + case "ClustersClient.BeginUpdateAutoScaleConfiguration": + res.resp, res.err = c.dispatchBeginUpdateAutoScaleConfiguration(req) + case "ClustersClient.BeginUpdateGatewaySettings": + res.resp, res.err = c.dispatchBeginUpdateGatewaySettings(req) + case "ClustersClient.BeginUpdateIdentityCertificate": + res.resp, res.err = c.dispatchBeginUpdateIdentityCertificate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ClustersServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -296,9 +312,9 @@ func (c *ClustersServerTransport) dispatchBeginExecuteScriptActions(req *http.Re return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginExecuteScriptActions.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(beginExecuteScriptActions) { c.beginExecuteScriptActions.remove(req) @@ -527,9 +543,9 @@ func (c *ClustersServerTransport) dispatchBeginResize(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginResize.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(beginResize) { c.beginResize.remove(req) @@ -575,9 +591,9 @@ func (c *ClustersServerTransport) dispatchBeginRotateDiskEncryptionKey(req *http return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginRotateDiskEncryptionKey.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(beginRotateDiskEncryptionKey) { c.beginRotateDiskEncryptionKey.remove(req) @@ -670,9 +686,9 @@ func (c *ClustersServerTransport) dispatchBeginUpdateAutoScaleConfiguration(req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginUpdateAutoScaleConfiguration.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(beginUpdateAutoScaleConfiguration) { c.beginUpdateAutoScaleConfiguration.remove(req) @@ -718,9 +734,9 @@ func (c *ClustersServerTransport) dispatchBeginUpdateGatewaySettings(req *http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginUpdateGatewaySettings.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(beginUpdateGatewaySettings) { c.beginUpdateGatewaySettings.remove(req) @@ -766,9 +782,9 @@ func (c *ClustersServerTransport) dispatchBeginUpdateIdentityCertificate(req *ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginUpdateIdentityCertificate.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(beginUpdateIdentityCertificate) { c.beginUpdateIdentityCertificate.remove(req) @@ -776,3 +792,9 @@ func (c *ClustersServerTransport) dispatchBeginUpdateIdentityCertificate(req *ht 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/hdinsight/armhdinsight/fake/configurations_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/configurations_server.go index ff812662789f..a6e069f611cd 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/configurations_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/configurations_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -61,25 +58,44 @@ func (c *ConfigurationsServerTransport) Do(req *http.Request) (*http.Response, e 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 "ConfigurationsClient.Get": - resp, err = c.dispatchGet(req) - case "ConfigurationsClient.List": - resp, err = c.dispatchList(req) - case "ConfigurationsClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ConfigurationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if configurationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = configurationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ConfigurationsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ConfigurationsClient.List": + res.resp, res.err = c.dispatchList(req) + case "ConfigurationsClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ConfigurationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -203,3 +219,9 @@ func (c *ConfigurationsServerTransport) dispatchBeginUpdate(req *http.Request) ( return resp, nil } + +// set this to conditionally intercept incoming requests to ConfigurationsServerTransport +var configurationsServerTransportInterceptor 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/hdinsight/armhdinsight/fake/extensions_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/extensions_server.go index bd63c317ae5c..92f8bb839c37 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/extensions_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/extensions_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -24,7 +21,7 @@ import ( // ExtensionsServer is a fake server for instances of the armhdinsight.ExtensionsClient type. type ExtensionsServer struct { // BeginCreate is the fake for method ExtensionsClient.BeginCreate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginCreate func(ctx context.Context, resourceGroupName string, clusterName string, extensionName string, parameters armhdinsight.Extension, options *armhdinsight.ExtensionsClientBeginCreateOptions) (resp azfake.PollerResponder[armhdinsight.ExtensionsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ExtensionsClient.BeginDelete @@ -44,15 +41,15 @@ type ExtensionsServer struct { BeginDisableMonitoring func(ctx context.Context, resourceGroupName string, clusterName string, options *armhdinsight.ExtensionsClientBeginDisableMonitoringOptions) (resp azfake.PollerResponder[armhdinsight.ExtensionsClientDisableMonitoringResponse], errResp azfake.ErrorResponder) // BeginEnableAzureMonitor is the fake for method ExtensionsClient.BeginEnableAzureMonitor - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginEnableAzureMonitor func(ctx context.Context, resourceGroupName string, clusterName string, parameters armhdinsight.AzureMonitorRequest, options *armhdinsight.ExtensionsClientBeginEnableAzureMonitorOptions) (resp azfake.PollerResponder[armhdinsight.ExtensionsClientEnableAzureMonitorResponse], errResp azfake.ErrorResponder) // BeginEnableAzureMonitorAgent is the fake for method ExtensionsClient.BeginEnableAzureMonitorAgent - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginEnableAzureMonitorAgent func(ctx context.Context, resourceGroupName string, clusterName string, parameters armhdinsight.AzureMonitorRequest, options *armhdinsight.ExtensionsClientBeginEnableAzureMonitorAgentOptions) (resp azfake.PollerResponder[armhdinsight.ExtensionsClientEnableAzureMonitorAgentResponse], errResp azfake.ErrorResponder) // BeginEnableMonitoring is the fake for method ExtensionsClient.BeginEnableMonitoring - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginEnableMonitoring func(ctx context.Context, resourceGroupName string, clusterName string, parameters armhdinsight.ClusterMonitoringRequest, options *armhdinsight.ExtensionsClientBeginEnableMonitoringOptions) (resp azfake.PollerResponder[armhdinsight.ExtensionsClientEnableMonitoringResponse], errResp azfake.ErrorResponder) // Get is the fake for method ExtensionsClient.Get @@ -115,45 +112,64 @@ func (e *ExtensionsServerTransport) 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 "ExtensionsClient.BeginCreate": - resp, err = e.dispatchBeginCreate(req) - case "ExtensionsClient.BeginDelete": - resp, err = e.dispatchBeginDelete(req) - case "ExtensionsClient.BeginDisableAzureMonitor": - resp, err = e.dispatchBeginDisableAzureMonitor(req) - case "ExtensionsClient.BeginDisableAzureMonitorAgent": - resp, err = e.dispatchBeginDisableAzureMonitorAgent(req) - case "ExtensionsClient.BeginDisableMonitoring": - resp, err = e.dispatchBeginDisableMonitoring(req) - case "ExtensionsClient.BeginEnableAzureMonitor": - resp, err = e.dispatchBeginEnableAzureMonitor(req) - case "ExtensionsClient.BeginEnableAzureMonitorAgent": - resp, err = e.dispatchBeginEnableAzureMonitorAgent(req) - case "ExtensionsClient.BeginEnableMonitoring": - resp, err = e.dispatchBeginEnableMonitoring(req) - case "ExtensionsClient.Get": - resp, err = e.dispatchGet(req) - case "ExtensionsClient.GetAzureAsyncOperationStatus": - resp, err = e.dispatchGetAzureAsyncOperationStatus(req) - case "ExtensionsClient.GetAzureMonitorAgentStatus": - resp, err = e.dispatchGetAzureMonitorAgentStatus(req) - case "ExtensionsClient.GetAzureMonitorStatus": - resp, err = e.dispatchGetAzureMonitorStatus(req) - case "ExtensionsClient.GetMonitoringStatus": - resp, err = e.dispatchGetMonitoringStatus(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return e.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err +func (e *ExtensionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if extensionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = extensionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExtensionsClient.BeginCreate": + res.resp, res.err = e.dispatchBeginCreate(req) + case "ExtensionsClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "ExtensionsClient.BeginDisableAzureMonitor": + res.resp, res.err = e.dispatchBeginDisableAzureMonitor(req) + case "ExtensionsClient.BeginDisableAzureMonitorAgent": + res.resp, res.err = e.dispatchBeginDisableAzureMonitorAgent(req) + case "ExtensionsClient.BeginDisableMonitoring": + res.resp, res.err = e.dispatchBeginDisableMonitoring(req) + case "ExtensionsClient.BeginEnableAzureMonitor": + res.resp, res.err = e.dispatchBeginEnableAzureMonitor(req) + case "ExtensionsClient.BeginEnableAzureMonitorAgent": + res.resp, res.err = e.dispatchBeginEnableAzureMonitorAgent(req) + case "ExtensionsClient.BeginEnableMonitoring": + res.resp, res.err = e.dispatchBeginEnableMonitoring(req) + case "ExtensionsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExtensionsClient.GetAzureAsyncOperationStatus": + res.resp, res.err = e.dispatchGetAzureAsyncOperationStatus(req) + case "ExtensionsClient.GetAzureMonitorAgentStatus": + res.resp, res.err = e.dispatchGetAzureMonitorAgentStatus(req) + case "ExtensionsClient.GetAzureMonitorStatus": + res.resp, res.err = e.dispatchGetAzureMonitorStatus(req) + case "ExtensionsClient.GetMonitoringStatus": + res.resp, res.err = e.dispatchGetMonitoringStatus(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err } - - return resp, nil } func (e *ExtensionsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -197,9 +213,9 @@ func (e *ExtensionsServerTransport) dispatchBeginCreate(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginCreate.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(beginCreate) { e.beginCreate.remove(req) @@ -425,9 +441,9 @@ func (e *ExtensionsServerTransport) dispatchBeginEnableAzureMonitor(req *http.Re return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginEnableAzureMonitor.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(beginEnableAzureMonitor) { e.beginEnableAzureMonitor.remove(req) @@ -473,9 +489,9 @@ func (e *ExtensionsServerTransport) dispatchBeginEnableAzureMonitorAgent(req *ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginEnableAzureMonitorAgent.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(beginEnableAzureMonitorAgent) { e.beginEnableAzureMonitorAgent.remove(req) @@ -521,9 +537,9 @@ func (e *ExtensionsServerTransport) dispatchBeginEnableMonitoring(req *http.Requ return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginEnableMonitoring.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(beginEnableMonitoring) { e.beginEnableMonitoring.remove(req) @@ -708,3 +724,9 @@ func (e *ExtensionsServerTransport) dispatchGetMonitoringStatus(req *http.Reques } return resp, nil } + +// set this to conditionally intercept incoming requests to ExtensionsServerTransport +var extensionsServerTransportInterceptor 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/hdinsight/armhdinsight/fake/internal.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/internal.go index be04ff43d678..e3def49261ba 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/internal.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/internal.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -14,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/fake/locations_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/locations_server.go index 8fb9d245dbe7..d280e2f32fcc 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/locations_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/locations_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -69,31 +66,50 @@ func (l *LocationsServerTransport) 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 l.dispatchToMethodFake(req, method) +} - switch method { - case "LocationsClient.CheckNameAvailability": - resp, err = l.dispatchCheckNameAvailability(req) - case "LocationsClient.GetAzureAsyncOperationStatus": - resp, err = l.dispatchGetAzureAsyncOperationStatus(req) - case "LocationsClient.GetCapabilities": - resp, err = l.dispatchGetCapabilities(req) - case "LocationsClient.ListBillingSpecs": - resp, err = l.dispatchListBillingSpecs(req) - case "LocationsClient.ListUsages": - resp, err = l.dispatchListUsages(req) - case "LocationsClient.ValidateClusterCreateRequest": - resp, err = l.dispatchValidateClusterCreateRequest(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (l *LocationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if locationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = locationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LocationsClient.CheckNameAvailability": + res.resp, res.err = l.dispatchCheckNameAvailability(req) + case "LocationsClient.GetAzureAsyncOperationStatus": + res.resp, res.err = l.dispatchGetAzureAsyncOperationStatus(req) + case "LocationsClient.GetCapabilities": + res.resp, res.err = l.dispatchGetCapabilities(req) + case "LocationsClient.ListBillingSpecs": + res.resp, res.err = l.dispatchListBillingSpecs(req) + case "LocationsClient.ListUsages": + res.resp, res.err = l.dispatchListUsages(req) + case "LocationsClient.ValidateClusterCreateRequest": + res.resp, res.err = l.dispatchValidateClusterCreateRequest(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (l *LocationsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -281,3 +297,9 @@ func (l *LocationsServerTransport) dispatchValidateClusterCreateRequest(req *htt } return resp, nil } + +// set this to conditionally intercept incoming requests to LocationsServerTransport +var locationsServerTransportInterceptor 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/hdinsight/armhdinsight/fake/operations_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/operations_server.go index 2703c09a508d..261245bed48f 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/operations_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/operations_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -51,21 +48,40 @@ 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) + defer close(resultChan) - if err != nil { - return nil, err - } + 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) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + 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) { @@ -94,3 +110,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/hdinsight/armhdinsight/fake/privateendpointconnections_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/privateendpointconnections_server.go index 078ae570460f..19cc1eaf813d 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/privateendpointconnections_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -70,27 +67,46 @@ 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.NewListByClusterPager": - resp, err = p.dispatchNewListByClusterPager(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) + defer close(resultChan) - if err != nil { - return nil, err - } + 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.NewListByClusterPager": + res.resp, res.err = p.dispatchNewListByClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + 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) { @@ -270,3 +286,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByClusterPage } 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/hdinsight/armhdinsight/fake/privatelinkresources_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/privatelinkresources_server.go index b134b8d4ce25..04ebdf3c5138 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/privatelinkresources_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -53,23 +50,42 @@ 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.ListByCluster": - resp, err = p.dispatchListByCluster(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) + defer close(resultChan) - if err != nil { - return nil, err - } + 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.ListByCluster": + res.resp, res.err = p.dispatchListByCluster(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + 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) { @@ -141,3 +157,9 @@ func (p *PrivateLinkResourcesServerTransport) dispatchListByCluster(req *http.Re } 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/hdinsight/armhdinsight/fake/scriptactions_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/scriptactions_server.go index dcebd0a76032..6f89f065e367 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/scriptactions_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/scriptactions_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -66,27 +63,46 @@ func (s *ScriptActionsServerTransport) Do(req *http.Request) (*http.Response, er 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 "ScriptActionsClient.Delete": - resp, err = s.dispatchDelete(req) - case "ScriptActionsClient.GetExecutionAsyncOperationStatus": - resp, err = s.dispatchGetExecutionAsyncOperationStatus(req) - case "ScriptActionsClient.GetExecutionDetail": - resp, err = s.dispatchGetExecutionDetail(req) - case "ScriptActionsClient.NewListByClusterPager": - resp, err = s.dispatchNewListByClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScriptActionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if scriptActionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scriptActionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScriptActionsClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "ScriptActionsClient.GetExecutionAsyncOperationStatus": + res.resp, res.err = s.dispatchGetExecutionAsyncOperationStatus(req) + case "ScriptActionsClient.GetExecutionDetail": + res.resp, res.err = s.dispatchGetExecutionDetail(req) + case "ScriptActionsClient.NewListByClusterPager": + res.resp, res.err = s.dispatchNewListByClusterPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ScriptActionsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { @@ -240,3 +256,9 @@ func (s *ScriptActionsServerTransport) dispatchNewListByClusterPager(req *http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to ScriptActionsServerTransport +var scriptActionsServerTransportInterceptor 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/hdinsight/armhdinsight/fake/scriptexecutionhistory_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/scriptexecutionhistory_server.go index 047f121e09bc..c59c5a22a8a0 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/scriptexecutionhistory_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/scriptexecutionhistory_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -58,23 +55,42 @@ func (s *ScriptExecutionHistoryServerTransport) Do(req *http.Request) (*http.Res 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 "ScriptExecutionHistoryClient.NewListByClusterPager": - resp, err = s.dispatchNewListByClusterPager(req) - case "ScriptExecutionHistoryClient.Promote": - resp, err = s.dispatchPromote(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScriptExecutionHistoryServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if scriptExecutionHistoryServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scriptExecutionHistoryServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScriptExecutionHistoryClient.NewListByClusterPager": + res.resp, res.err = s.dispatchNewListByClusterPager(req) + case "ScriptExecutionHistoryClient.Promote": + res.resp, res.err = s.dispatchPromote(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ScriptExecutionHistoryServerTransport) dispatchNewListByClusterPager(req *http.Request) (*http.Response, error) { @@ -154,3 +170,9 @@ func (s *ScriptExecutionHistoryServerTransport) dispatchPromote(req *http.Reques } return resp, nil } + +// set this to conditionally intercept incoming requests to ScriptExecutionHistoryServerTransport +var scriptExecutionHistoryServerTransportInterceptor 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/hdinsight/armhdinsight/fake/server_factory.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/server_factory.go index 1700a381168a..f0807f4d360e 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/server_factory.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/server_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -19,17 +16,38 @@ import ( // ServerFactory is a fake server for instances of the armhdinsight.ClientFactory type. type ServerFactory struct { - ApplicationsServer ApplicationsServer - ClustersServer ClustersServer - ConfigurationsServer ConfigurationsServer - ExtensionsServer ExtensionsServer - LocationsServer LocationsServer - OperationsServer OperationsServer + // ApplicationsServer contains the fakes for client ApplicationsClient + ApplicationsServer ApplicationsServer + + // ClustersServer contains the fakes for client ClustersClient + ClustersServer ClustersServer + + // ConfigurationsServer contains the fakes for client ConfigurationsClient + ConfigurationsServer ConfigurationsServer + + // ExtensionsServer contains the fakes for client ExtensionsClient + ExtensionsServer ExtensionsServer + + // LocationsServer contains the fakes for client LocationsClient + LocationsServer LocationsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer - ScriptActionsServer ScriptActionsServer - ScriptExecutionHistoryServer ScriptExecutionHistoryServer - VirtualMachinesServer VirtualMachinesServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // ScriptActionsServer contains the fakes for client ScriptActionsClient + ScriptActionsServer ScriptActionsServer + + // ScriptExecutionHistoryServer contains the fakes for client ScriptExecutionHistoryClient + ScriptExecutionHistoryServer ScriptExecutionHistoryServer + + // VirtualMachinesServer contains the fakes for client VirtualMachinesClient + VirtualMachinesServer VirtualMachinesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/fake/time_rfc3339.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/hdinsight/armhdinsight/fake/virtualmachines_server.go b/sdk/resourcemanager/hdinsight/armhdinsight/fake/virtualmachines_server.go index 036f4a9a8c56..d6380ed5e600 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/fake/virtualmachines_server.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/fake/virtualmachines_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -32,7 +29,7 @@ type VirtualMachinesServer struct { ListHosts func(ctx context.Context, resourceGroupName string, clusterName string, options *armhdinsight.VirtualMachinesClientListHostsOptions) (resp azfake.Responder[armhdinsight.VirtualMachinesClientListHostsResponse], errResp azfake.ErrorResponder) // BeginRestartHosts is the fake for method VirtualMachinesClient.BeginRestartHosts - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRestartHosts func(ctx context.Context, resourceGroupName string, clusterName string, hosts []*string, options *armhdinsight.VirtualMachinesClientBeginRestartHostsOptions) (resp azfake.PollerResponder[armhdinsight.VirtualMachinesClientRestartHostsResponse], errResp azfake.ErrorResponder) } @@ -61,25 +58,44 @@ func (v *VirtualMachinesServerTransport) 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 v.dispatchToMethodFake(req, method) +} - switch method { - case "VirtualMachinesClient.GetAsyncOperationStatus": - resp, err = v.dispatchGetAsyncOperationStatus(req) - case "VirtualMachinesClient.ListHosts": - resp, err = v.dispatchListHosts(req) - case "VirtualMachinesClient.BeginRestartHosts": - resp, err = v.dispatchBeginRestartHosts(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VirtualMachinesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if virtualMachinesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = virtualMachinesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VirtualMachinesClient.GetAsyncOperationStatus": + res.resp, res.err = v.dispatchGetAsyncOperationStatus(req) + case "VirtualMachinesClient.ListHosts": + res.resp, res.err = v.dispatchListHosts(req) + case "VirtualMachinesClient.BeginRestartHosts": + res.resp, res.err = v.dispatchBeginRestartHosts(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (v *VirtualMachinesServerTransport) dispatchGetAsyncOperationStatus(req *http.Request) (*http.Response, error) { @@ -189,9 +205,9 @@ func (v *VirtualMachinesServerTransport) dispatchBeginRestartHosts(req *http.Req return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginRestartHosts.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(beginRestartHosts) { v.beginRestartHosts.remove(req) @@ -199,3 +215,9 @@ func (v *VirtualMachinesServerTransport) dispatchBeginRestartHosts(req *http.Req return resp, nil } + +// set this to conditionally intercept incoming requests to VirtualMachinesServerTransport +var virtualMachinesServerTransportInterceptor 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/hdinsight/armhdinsight/go.mod b/sdk/resourcemanager/hdinsight/armhdinsight/go.mod index f26c03167e11..16d86142f9ff 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/go.mod +++ b/sdk/resourcemanager/hdinsight/armhdinsight/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsi go 1.23.0 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/go.sum b/sdk/resourcemanager/hdinsight/armhdinsight/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/go.sum +++ b/sdk/resourcemanager/hdinsight/armhdinsight/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/locations_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/locations_client.go index 3a296b8ce8b7..53537a798c51 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/locations_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/locations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential // CheckNameAvailability - Check the cluster name is available or not. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientCheckNameAvailabilityOptions contains the optional parameters for the LocationsClient.CheckNameAvailability // method. @@ -74,7 +71,7 @@ func (client *LocationsClient) CheckNameAvailability(ctx context.Context, locati } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, parameters NameAvailabilityCheckRequestParameters, options *LocationsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, parameters NameAvailabilityCheckRequestParameters, _ *LocationsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -89,7 +86,7 @@ func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -110,7 +107,7 @@ func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Re // GetAzureAsyncOperationStatus - Get the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - location - The Azure location (region) for which to make the request. // - operationID - The long running operation id. // - options - LocationsClientGetAzureAsyncOperationStatusOptions contains the optional parameters for the LocationsClient.GetAzureAsyncOperationStatus @@ -138,7 +135,7 @@ func (client *LocationsClient) GetAzureAsyncOperationStatus(ctx context.Context, } // getAzureAsyncOperationStatusCreateRequest creates the GetAzureAsyncOperationStatus request. -func (client *LocationsClient) getAzureAsyncOperationStatusCreateRequest(ctx context.Context, location string, operationID string, options *LocationsClientGetAzureAsyncOperationStatusOptions) (*policy.Request, error) { +func (client *LocationsClient) getAzureAsyncOperationStatusCreateRequest(ctx context.Context, location string, operationID string, _ *LocationsClientGetAzureAsyncOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/azureasyncoperations/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -157,7 +154,7 @@ func (client *LocationsClient) getAzureAsyncOperationStatusCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +172,7 @@ func (client *LocationsClient) getAzureAsyncOperationStatusHandleResponse(resp * // GetCapabilities - Gets the capabilities for the specified location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientGetCapabilitiesOptions contains the optional parameters for the LocationsClient.GetCapabilities // method. @@ -202,7 +199,7 @@ func (client *LocationsClient) GetCapabilities(ctx context.Context, location str } // getCapabilitiesCreateRequest creates the GetCapabilities request. -func (client *LocationsClient) getCapabilitiesCreateRequest(ctx context.Context, location string, options *LocationsClientGetCapabilitiesOptions) (*policy.Request, error) { +func (client *LocationsClient) getCapabilitiesCreateRequest(ctx context.Context, location string, _ *LocationsClientGetCapabilitiesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -217,7 +214,7 @@ func (client *LocationsClient) getCapabilitiesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -235,7 +232,7 @@ func (client *LocationsClient) getCapabilitiesHandleResponse(resp *http.Response // ListBillingSpecs - Lists the billingSpecs for the specified subscription and location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientListBillingSpecsOptions contains the optional parameters for the LocationsClient.ListBillingSpecs // method. @@ -262,7 +259,7 @@ func (client *LocationsClient) ListBillingSpecs(ctx context.Context, location st } // listBillingSpecsCreateRequest creates the ListBillingSpecs request. -func (client *LocationsClient) listBillingSpecsCreateRequest(ctx context.Context, location string, options *LocationsClientListBillingSpecsOptions) (*policy.Request, error) { +func (client *LocationsClient) listBillingSpecsCreateRequest(ctx context.Context, location string, _ *LocationsClientListBillingSpecsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -277,7 +274,7 @@ func (client *LocationsClient) listBillingSpecsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +292,7 @@ func (client *LocationsClient) listBillingSpecsHandleResponse(resp *http.Respons // ListUsages - Lists the usages for the specified location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientListUsagesOptions contains the optional parameters for the LocationsClient.ListUsages method. func (client *LocationsClient) ListUsages(ctx context.Context, location string, options *LocationsClientListUsagesOptions) (LocationsClientListUsagesResponse, error) { @@ -321,7 +318,7 @@ func (client *LocationsClient) ListUsages(ctx context.Context, location string, } // listUsagesCreateRequest creates the ListUsages request. -func (client *LocationsClient) listUsagesCreateRequest(ctx context.Context, location string, options *LocationsClientListUsagesOptions) (*policy.Request, error) { +func (client *LocationsClient) listUsagesCreateRequest(ctx context.Context, location string, _ *LocationsClientListUsagesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -336,7 +333,7 @@ func (client *LocationsClient) listUsagesCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -354,7 +351,7 @@ func (client *LocationsClient) listUsagesHandleResponse(resp *http.Response) (Lo // ValidateClusterCreateRequest - Validate the cluster create request spec is valid or not. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - location - The Azure location (region) for which to make the request. // - options - LocationsClientValidateClusterCreateRequestOptions contains the optional parameters for the LocationsClient.ValidateClusterCreateRequest // method. @@ -381,7 +378,7 @@ func (client *LocationsClient) ValidateClusterCreateRequest(ctx context.Context, } // validateClusterCreateRequestCreateRequest creates the ValidateClusterCreateRequest request. -func (client *LocationsClient) validateClusterCreateRequestCreateRequest(ctx context.Context, location string, parameters ClusterCreateRequestValidationParameters, options *LocationsClientValidateClusterCreateRequestOptions) (*policy.Request, error) { +func (client *LocationsClient) validateClusterCreateRequestCreateRequest(ctx context.Context, location string, parameters ClusterCreateRequestValidationParameters, _ *LocationsClientValidateClusterCreateRequestOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -396,7 +393,7 @@ func (client *LocationsClient) validateClusterCreateRequestCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/locations_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/locations_client_example_test.go deleted file mode 100644 index 0b59ae4c6cb1..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/locations_client_example_test.go +++ /dev/null @@ -1,661 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_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/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetHDInsightCapabilities.json -func ExampleLocationsClient_GetCapabilities() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().GetCapabilities(ctx, "West US", 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.CapabilitiesResult = armhdinsight.CapabilitiesResult{ - // Features: []*string{ - // to.Ptr("ALLOW_GATEWAY_AUTH_BYPASS"), - // to.Ptr("AUX_IAAS_FUNCTIONALITIES"), - // to.Ptr("BLOCK_APPS_FOR_SECURE_CLUSTER"), - // to.Ptr("CLUSTER_RESIZE"), - // to.Ptr("CLUSTERS_CONTRACT_1"), - // to.Ptr("CLUSTERS_CONTRACT_1_SDK"), - // to.Ptr("CLUSTERS_CONTRACT_2_SDK"), - // to.Ptr("CLUSTERS_CONTRACT_VERSION_3_SDK"), - // to.Ptr("COLLECTANONYMIZEDLOGS"), - // to.Ptr("CONTAINER_LOG_COLLECTOR"), - // to.Ptr("CONTAINER_RESOURCE_V3"), - // to.Ptr("CUSTOM_ACTIONS_V2"), - // to.Ptr("DATALAKE"), - // to.Ptr("DATALAKE_3_2"), - // to.Ptr("DATALAKE_3_4"), - // to.Ptr("DATALAKE_3_5"), - // to.Ptr("DATALAKE_DEFAULTFS_3_5"), - // to.Ptr("DEFAULT_CONTAINER_IDENTIFIER_AND_STORAGEFQDN_ALREADY_USED"), - // to.Ptr("DOCUMENT_VALIDATION_IN_API"), - // to.Ptr("ENABLEDATALAKE"), - // to.Ptr("ENABLEGENEVAANALYTICS"), - // to.Ptr("HADOOP_VIRTUAL_NETWORK_ENABLED"), - // to.Ptr("HS2_ZK_ROUTER_INTERACTIVEHIVE"), - // to.Ptr("IAAS_ALLOW_CUSTOM_DNS"), - // to.Ptr("IAAS_AMBARI_APP_TIMELINE_SERVER_HA_SERVICE"), - // to.Ptr("IAAS_AMBARI_DEPENDENCY_BASED_DEPLOYMENT"), - // to.Ptr("IAAS_AMBARI_HA_SERVICES"), - // to.Ptr("IAAS_AMBARI_HISTORYSERVER_HA_SERVICE"), - // to.Ptr("IAAS_AMBARI_LOWER_LATENCY"), - // to.Ptr("IAAS_AMBARI_SKIP_COMPONENTS_INSTALL"), - // to.Ptr("IAAS_ARM_PROVISIONING"), - // to.Ptr("IAAS_CLOSE_HEAD_HTTPS_END_POINT_AFTER_CLUSTER_CREATE"), - // to.Ptr("IAAS_CLUSTER_APPLICATION_ALLOW_MULTIPLE_ROLE_INSTANCES"), - // to.Ptr("IAAS_CLUSTER_APPLICATION_REMOVE"), - // to.Ptr("IAAS_CLUSTER_CONTAINER_PREUPLOAD_SUBMIT_WAIT"), - // to.Ptr("IAAS_CLUSTER_RSERVER"), - // to.Ptr("IAAS_DB_CREATION_IN_PARALLEL_TO_VM"), - // to.Ptr("IAAS_DELETE_LEAKED_RESOURCES"), - // to.Ptr("IAAS_DEPLOYMENTS"), - // to.Ptr("IAAS_DO_NOT_CREATE_WASB_TABLES_IN_CUSTOMER_STORAGE"), - // to.Ptr("IAAS_ENABLE_CLUSTER_CONFIG_OVERRIDES"), - // to.Ptr("IAAS_ENABLE_OFFLINE_CLEANUP"), - // to.Ptr("IAAS_ENABLE_OFFLINE_CLEANUP_FOR_DELETING_VMS"), - // to.Ptr("IAAS_INCLUDE_STORAGE_IN_SUBSCRIPTION_SELECTION"), - // to.Ptr("IAAS_PARALLEL_DB_CREATE"), - // to.Ptr("IAAS_PREPROVISION_METASTORES_SCHEMAS"), - // to.Ptr("IAAS_SCRIPTACTIONS_DELETE_VMS_CRUD_FAILURES"), - // to.Ptr("IAAS_SCRIPTACTIONS_RUNNING"), - // to.Ptr("IAAS_SHORT_VM_NAME"), - // to.Ptr("IAAS_SUBMIT_AMBARI_REQUEST_ONCE_LINUX_VM_ARE_AVAILABLE"), - // to.Ptr("IAAS_TEZ_ATS_V15"), - // to.Ptr("IAAS_USE_UNATTENDED_UPGRADES_FOR_PATCHING"), - // to.Ptr("IAAS_VALIDATE_CUSTOM_VNET"), - // to.Ptr("IAAS_VALIDATE_NSG"), - // to.Ptr("IAAS_WAIT_FOR_CLOSING_HEAD_HTTPS_END_POINT_AFTER_CLUSTER_CREATE"), - // to.Ptr("IAAS_YARN_HDINSIGHT_SQL_TIMELINE_STORE"), - // to.Ptr("IAAS_YARN_HDINSIGHT_TIMELINE_STORE"), - // to.Ptr("INTERACTIVEHIVE"), - // to.Ptr("MDSCENTRALLOGGING"), - // to.Ptr("NODE_SETUP_POLLER_ENABLED"), - // to.Ptr("OVERPROVISION_HOSTGROUP_edgenode"), - // to.Ptr("OVERPROVISION_HOSTGROUP_Gateway"), - // to.Ptr("OVERPROVISION_HOSTGROUP_Workernode"), - // to.Ptr("OVERPROVISION_HOSTGROUP_zookeepernode"), - // to.Ptr("PERF_OPTIMIZED_RESOURCE_LOCATION_FETCH"), - // to.Ptr("PORTALAPPINSTALL"), - // to.Ptr("POWERSHELL_SCRIPT_ACTION"), - // to.Ptr("POWERSHELL_SCRIPT_ACTION_SDK"), - // to.Ptr("PREMIUM_TIER_PREVIEW"), - // to.Ptr("PROVISIONING_AGENT"), - // to.Ptr("RMHA"), - // to.Ptr("RSERVER_CLUSTERTYPE_3_5_ENABLED"), - // to.Ptr("RSERVER_CLUSTERTYPE_ENABLED"), - // to.Ptr("SHOW_HUMBOLDT_GA"), - // to.Ptr("SHOW_IBIZA_CREATE"), - // to.Ptr("SPARK_2_1"), - // to.Ptr("SPARK_EXPERIMENTAL"), - // to.Ptr("STORM_PREVIEW"), - // to.Ptr("UI_CREATE_WIZARD_V2"), - // to.Ptr("VIRTUAL_NETWORK_ENABLED"), - // to.Ptr("VMSIZES_AUX")}, - // Quota: &armhdinsight.QuotaCapability{ - // CoresUsed: to.Ptr[int64](0), - // MaxCoresAllowed: to.Ptr[int64](3000), - // RegionalQuotas: []*armhdinsight.RegionalQuotaCapability{ - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Australia East"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Australia Southeast"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Brazil South"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Canada Central"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Canada East"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Central India"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](24), - // RegionName: to.Ptr("Central US"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Central US EUAP"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](24), - // RegionName: to.Ptr("East Asia"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](24), - // RegionName: to.Ptr("East US"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("East US 2"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Japan East"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Japan West"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("North Central US"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("North Europe"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("South Central US"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("Southeast Asia"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("West Central US"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("West Europe"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](132), - // RegionName: to.Ptr("West US"), - // }, - // { - // CoresAvailable: to.Ptr[int64](1000), - // CoresUsed: to.Ptr[int64](0), - // RegionName: to.Ptr("West US 2"), - // }}, - // }, - // Regions: map[string]*armhdinsight.RegionsCapability{ - // "iaas": &armhdinsight.RegionsCapability{ - // Available: []*string{ - // to.Ptr("AUSTRALIA EAST"), - // to.Ptr("AUSTRALIA SOUTHEAST"), - // to.Ptr("BRAZIL SOUTH"), - // to.Ptr("CANADA CENTRAL"), - // to.Ptr("CANADA EAST"), - // to.Ptr("CENTRAL INDIA"), - // to.Ptr("CENTRAL US"), - // to.Ptr("CENTRAL US EUAP"), - // to.Ptr("EAST ASIA"), - // to.Ptr("EAST US"), - // to.Ptr("EAST US 2"), - // to.Ptr("JAPAN EAST"), - // to.Ptr("JAPAN WEST"), - // to.Ptr("NORTH CENTRAL US"), - // to.Ptr("NORTH EUROPE"), - // to.Ptr("SOUTH CENTRAL US"), - // to.Ptr("SOUTHEAST ASIA"), - // to.Ptr("WEST CENTRAL US"), - // to.Ptr("WEST EUROPE"), - // to.Ptr("WEST US"), - // to.Ptr("WEST US 2")}, - // }, - // "paas": &armhdinsight.RegionsCapability{ - // Available: []*string{ - // to.Ptr("AUSTRALIA EAST"), - // to.Ptr("AUSTRALIA SOUTHEAST"), - // to.Ptr("BRAZIL SOUTH"), - // to.Ptr("CENTRAL INDIA"), - // to.Ptr("CENTRAL US"), - // to.Ptr("EAST ASIA"), - // to.Ptr("EAST US"), - // to.Ptr("EAST US 2"), - // to.Ptr("JAPAN EAST"), - // to.Ptr("JAPAN WEST"), - // to.Ptr("NORTH CENTRAL US"), - // to.Ptr("NORTH EUROPE"), - // to.Ptr("SOUTH CENTRAL US"), - // to.Ptr("SOUTHEAST ASIA"), - // to.Ptr("WEST EUROPE"), - // to.Ptr("WEST US"), - // to.Ptr("WEST US 2")}, - // }, - // }, - // Versions: map[string]*armhdinsight.VersionsCapability{ - // "iaas": &armhdinsight.VersionsCapability{ - // Available: []*armhdinsight.VersionSpec{ - // { - // ComponentVersions: map[string]*string{ - // "HBase": to.Ptr("0.98.4"), - // "HDP": to.Ptr("2.2"), - // "Hadoop": to.Ptr("2.6.0"), - // "Storm": to.Ptr("0.9.3"), - // }, - // DisplayName: to.Ptr("Version 3.2.1000.0.8840373"), - // FriendlyName: to.Ptr("3.2"), - // IsDefault: to.Ptr(false), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HBase": to.Ptr("1.1.2"), - // "HDP": to.Ptr("2.3"), - // "Hadoop": to.Ptr("2.7.0"), - // "Spark": to.Ptr("1.5.2"), - // "Storm": to.Ptr("0.10.0"), - // }, - // DisplayName: to.Ptr("Version 3.3.1000.0.9776961"), - // FriendlyName: to.Ptr("3.3"), - // IsDefault: to.Ptr(false), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HBase": to.Ptr("1.1.2"), - // "HDP": to.Ptr("2.4"), - // "Hadoop": to.Ptr("2.7.1"), - // "RServer": to.Ptr("8.0"), - // "Spark": to.Ptr("1.6.2"), - // "Storm": to.Ptr("0.10.0"), - // }, - // DisplayName: to.Ptr("Version 3.4.1000.0.9719475"), - // FriendlyName: to.Ptr("3.4"), - // IsDefault: to.Ptr(false), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HBase": to.Ptr("1.1.2"), - // "HDP": to.Ptr("2.5"), - // "Hadoop": to.Ptr("2.7.3"), - // "InteractiveHive": to.Ptr("2.1.0"), - // "RServer": to.Ptr("9.0"), - // "Spark": to.Ptr("1.6.3,2.0.2"), - // "Storm": to.Ptr("1.0.1"), - // }, - // DisplayName: to.Ptr("Version 3.5.1000.0.9732704"), - // FriendlyName: to.Ptr("3.5"), - // IsDefault: to.Ptr(true), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HDP": to.Ptr("2.6"), - // "Spark": to.Ptr("2.1.0"), - // }, - // DisplayName: to.Ptr("Version 3.6.1000.0.9503998"), - // FriendlyName: to.Ptr("3.6"), - // IsDefault: to.Ptr(false), - // }, - // { - // DisplayName: to.Ptr("Version 99.152.1000.0.6943836"), - // FriendlyName: to.Ptr("99.152"), - // IsDefault: to.Ptr(false), - // }}, - // }, - // "paas": &armhdinsight.VersionsCapability{ - // Available: []*armhdinsight.VersionSpec{ - // { - // DisplayName: to.Ptr("HdInsight version 1.6.1.0.335536"), - // FriendlyName: to.Ptr("1.6"), - // IsDefault: to.Ptr(false), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HDP": to.Ptr("1.3"), - // "Hadoop": to.Ptr("1.2.0"), - // }, - // DisplayName: to.Ptr("Version 2.1.9.406.1221105"), - // FriendlyName: to.Ptr("2.1"), - // IsDefault: to.Ptr(false), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HDP": to.Ptr("2.0"), - // "Hadoop": to.Ptr("2.2.0"), - // }, - // DisplayName: to.Ptr("Version 3.0.6.989.2441725"), - // FriendlyName: to.Ptr("3.0"), - // IsDefault: to.Ptr(false), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HBase": to.Ptr("0.98"), - // "HDP": to.Ptr("2.1.7"), - // "Hadoop": to.Ptr("2.4.0"), - // }, - // DisplayName: to.Ptr("Version 3.1.4.989.2441725"), - // FriendlyName: to.Ptr("3.1"), - // IsDefault: to.Ptr(false), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HBase": to.Ptr("0.98.4"), - // "HDP": to.Ptr("2.2"), - // "Hadoop": to.Ptr("2.6.0"), - // "Storm": to.Ptr("0.9.3"), - // }, - // DisplayName: to.Ptr("Version 3.2.7.989.2441725"), - // FriendlyName: to.Ptr("3.2"), - // IsDefault: to.Ptr(false), - // }, - // { - // ComponentVersions: map[string]*string{ - // "HBase": to.Ptr("1.1.2"), - // "HDP": to.Ptr("2.3"), - // "Hadoop": to.Ptr("2.7.0"), - // "Storm": to.Ptr("0.10.0"), - // }, - // DisplayName: to.Ptr("Version 3.3.0.989.2441725"), - // FriendlyName: to.Ptr("3.3"), - // IsDefault: to.Ptr(true), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetHDInsightUsages.json -func ExampleLocationsClient_ListUsages() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().ListUsages(ctx, "West US", 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.UsagesListResult = armhdinsight.UsagesListResult{ - // Value: []*armhdinsight.Usage{ - // { - // Name: &armhdinsight.LocalizedName{ - // LocalizedValue: to.Ptr("Cores"), - // Value: to.Ptr("cores"), - // }, - // CurrentValue: to.Ptr[int64](0), - // Limit: to.Ptr[int64](5000), - // Unit: to.Ptr("Count"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Locations_ListBillingSpecs.json -func ExampleLocationsClient_ListBillingSpecs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().ListBillingSpecs(ctx, "East US 2", 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.BillingResponseListResult = armhdinsight.BillingResponseListResult{ - // BillingResources: []*armhdinsight.BillingResources{ - // { - // BillingMeters: []*armhdinsight.BillingMeters{ - // }, - // DiskBillingMeters: []*armhdinsight.DiskBillingMeters{ - // }, - // Region: to.Ptr("East US 2"), - // }, - // { - // BillingMeters: []*armhdinsight.BillingMeters{ - // { - // Meter: to.Ptr("11111111-1111-1111-1111-111111111111"), - // MeterParameter: to.Ptr("default"), - // Unit: to.Ptr("CoreHours"), - // }, - // { - // Meter: to.Ptr("11111111-1111-1111-1111-111111111111"), - // MeterParameter: to.Ptr("Kafka"), - // Unit: to.Ptr("CoreHours"), - // }}, - // DiskBillingMeters: []*armhdinsight.DiskBillingMeters{ - // { - // DiskRpMeter: to.Ptr("11111111-1111-1111-1111-111111111111"), - // SKU: to.Ptr("All"), - // Tier: to.Ptr(armhdinsight.TierStandard), - // }, - // { - // DiskRpMeter: to.Ptr("11111111-1111-1111-1111-111111111111"), - // SKU: to.Ptr("All"), - // Tier: to.Ptr(armhdinsight.TierStandard), - // }}, - // Region: to.Ptr("default"), - // }}, - // VMSizeFilters: []*armhdinsight.VMSizeCompatibilityFilterV2{ - // { - // FilterMode: to.Ptr(armhdinsight.FilterModeExclude), - // }}, - // VMSizes: []*string{ - // to.Ptr("A5"), - // to.Ptr("A6"), - // to.Ptr("A7")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Locations_GetAsyncOperationStatus.json -func ExampleLocationsClient_GetAzureAsyncOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().GetAzureAsyncOperationStatus(ctx, "East US 2", "8a0348f4-8a85-4ec2-abe0-03b26104a9a0-0", 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.AsyncOperationResult = armhdinsight.AsyncOperationResult{ - // Status: to.Ptr(armhdinsight.AsyncOperationStateSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Locations_CheckClusterNameAvailability.json -func ExampleLocationsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().CheckNameAvailability(ctx, "westus", armhdinsight.NameAvailabilityCheckRequestParameters{ - Name: to.Ptr("test123"), - Type: to.Ptr("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.NameAvailabilityCheckResult = armhdinsight.NameAvailabilityCheckResult{ - // Message: to.Ptr("Cluster name 'test123' is unavailable"), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr("AlreadyExists"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/HDI_Locations_ValidateClusterCreateRequest.json -func ExampleLocationsClient_ValidateClusterCreateRequest() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().ValidateClusterCreateRequest(ctx, "southcentralus", armhdinsight.ClusterCreateRequestValidationParameters{ - Location: to.Ptr("southcentralus"), - Properties: &armhdinsight.ClusterCreateProperties{ - ClusterDefinition: &armhdinsight.ClusterDefinition{ - ComponentVersion: map[string]*string{ - "Spark": to.Ptr("2.4"), - }, - Configurations: map[string]any{ - "gateway": map[string]any{ - "restAuthCredential.isEnabled": true, - "restAuthCredential.password": "**********", - "restAuthCredential.username": "admin", - }, - }, - Kind: to.Ptr("spark"), - }, - ClusterVersion: to.Ptr("4.0"), - ComputeProfile: &armhdinsight.ComputeProfile{ - Roles: []*armhdinsight.Role{ - { - Name: to.Ptr("headnode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_E8_V3"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("********"), - Username: to.Ptr("sshuser"), - }, - }, - ScriptActions: []*armhdinsight.ScriptAction{}, - TargetInstanceCount: to.Ptr[int32](2), - }, - { - Name: to.Ptr("workernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_E8_V3"), - }, - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("********"), - Username: to.Ptr("sshuser"), - }, - }, - ScriptActions: []*armhdinsight.ScriptAction{}, - TargetInstanceCount: to.Ptr[int32](4), - }, - { - Name: to.Ptr("zookeepernode"), - HardwareProfile: &armhdinsight.HardwareProfile{ - VMSize: to.Ptr("Standard_D13_V2"), - }, - MinInstanceCount: to.Ptr[int32](1), - OSProfile: &armhdinsight.OsProfile{ - LinuxOperatingSystemProfile: &armhdinsight.LinuxOperatingSystemProfile{ - Password: to.Ptr("**********"), - Username: to.Ptr("sshuser"), - }, - }, - ScriptActions: []*armhdinsight.ScriptAction{}, - TargetInstanceCount: to.Ptr[int32](3), - }}, - }, - MinSupportedTLSVersion: to.Ptr("1.2"), - OSType: to.Ptr(armhdinsight.OSTypeLinux), - StorageProfile: &armhdinsight.StorageProfile{ - Storageaccounts: []*armhdinsight.StorageAccount{ - { - Name: to.Ptr("storagename.blob.core.windows.net"), - Container: to.Ptr("contianername"), - EnableSecureChannel: to.Ptr(true), - IsDefault: to.Ptr(true), - Key: to.Ptr("*******"), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storagename"), - }}, - }, - Tier: to.Ptr(armhdinsight.TierStandard), - }, - Tags: map[string]*string{}, - Name: to.Ptr("testclustername"), - Type: to.Ptr("Microsoft.HDInsight/clusters"), - FetchAaddsResource: to.Ptr(false), - TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }, 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.ClusterCreateValidationResult = armhdinsight.ClusterCreateValidationResult{ - // EstimatedCreationDuration: to.Ptr("PT20M"), - // ValidationErrors: []*armhdinsight.ValidationErrorInfo{ - // }, - // } -} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/models.go b/sdk/resourcemanager/hdinsight/armhdinsight/models.go index d52de18d3e7e..51836c5d3c65 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/models.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/models.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -623,7 +620,8 @@ type ClusterMonitoringResponse struct { // ClusterPatchParameters - The PatchCluster request parameters type ClusterPatchParameters struct { - // The identity of the cluster, if configured. + // The identity of the cluster, if configured. Setting this property will override the existing identity configuration of + // the cluster. Identity *ClusterIdentity // The resource tags. @@ -735,6 +733,18 @@ type EncryptionInTransitProperties struct { IsEncryptionInTransitEnabled *bool } +// EntraUserInfo - Details of an Entra user for gateway access. +type EntraUserInfo struct { + // The display name of the Entra user. + DisplayName *string + + // The unique object ID of the Entra user or client ID of the enterprise applications. + ObjectID *string + + // The User Principal Name (UPN) of the Entra user. It may be empty in certain cases, such as for enterprise applications. + Upn *string +} + // ErrorResponse - Describes the format of Error response. type ErrorResponse struct { // Error code @@ -782,6 +792,9 @@ type Extension struct { // GatewaySettings - Gateway settings. type GatewaySettings struct { + // List of Entra users for gateway access. + RestAuthEntraUsers []*EntraUserInfo + // READ-ONLY; Indicates whether or not the gateway settings based authorization is enabled. IsCredentialEnabled *string @@ -1505,7 +1518,8 @@ type UpdateClusterIdentityCertificateParameters struct { CertificatePassword *string } -// UpdateGatewaySettingsParameters - The update gateway settings request parameters. +// UpdateGatewaySettingsParameters - The update gateway settings request parameters. Note either basic or entra user should +// be provided at a time. type UpdateGatewaySettingsParameters struct { // Indicates whether or not the gateway settings based authorization is enabled. IsCredentialEnabled *bool @@ -1513,6 +1527,9 @@ type UpdateGatewaySettingsParameters struct { // The gateway settings user password. Password *string + // List of Entra users for gateway access. + RestAuthEntraUsers []*EntraUserInfo + // The gateway settings user name. UserName *string } diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/models_serde.go b/sdk/resourcemanager/hdinsight/armhdinsight/models_serde.go index 4b985223cf8a..b96221de8454 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/models_serde.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/models_serde.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -1849,6 +1846,41 @@ func (e *EncryptionInTransitProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EntraUserInfo. +func (e EntraUserInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "objectId", e.ObjectID) + populate(objectMap, "upn", e.Upn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EntraUserInfo. +func (e *EntraUserInfo) 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 "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &e.ObjectID) + delete(rawMsg, key) + case "upn": + err = unpopulate(val, "Upn", &e.Upn) + 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 ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2009,6 +2041,7 @@ func (g GatewaySettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "restAuthCredential.isEnabled", g.IsCredentialEnabled) populate(objectMap, "restAuthCredential.password", g.Password) + populate(objectMap, "restAuthEntraUsers", g.RestAuthEntraUsers) populate(objectMap, "restAuthCredential.username", g.UserName) return json.Marshal(objectMap) } @@ -2028,6 +2061,9 @@ func (g *GatewaySettings) UnmarshalJSON(data []byte) error { case "restAuthCredential.password": err = unpopulate(val, "Password", &g.Password) delete(rawMsg, key) + case "restAuthEntraUsers": + err = unpopulate(val, "RestAuthEntraUsers", &g.RestAuthEntraUsers) + delete(rawMsg, key) case "restAuthCredential.username": err = unpopulate(val, "UserName", &g.UserName) delete(rawMsg, key) @@ -3953,6 +3989,7 @@ func (u UpdateGatewaySettingsParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "restAuthCredential.isEnabled", u.IsCredentialEnabled) populate(objectMap, "restAuthCredential.password", u.Password) + populate(objectMap, "restAuthEntraUsers", u.RestAuthEntraUsers) populate(objectMap, "restAuthCredential.username", u.UserName) return json.Marshal(objectMap) } @@ -3972,6 +4009,9 @@ func (u *UpdateGatewaySettingsParameters) UnmarshalJSON(data []byte) error { case "restAuthCredential.password": err = unpopulate(val, "Password", &u.Password) delete(rawMsg, key) + case "restAuthEntraUsers": + err = unpopulate(val, "RestAuthEntraUsers", &u.RestAuthEntraUsers) + delete(rawMsg, key) case "restAuthCredential.username": err = unpopulate(val, "UserName", &u.UserName) delete(rawMsg, key) diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/operations_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/operations_client.go index 6a71d7532b24..496b45996768 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/operations_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/operations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -39,7 +36,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available HDInsight REST API operations. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - 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]{ @@ -65,14 +62,14 @@ 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.HDInsight/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-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/operations_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/operations_client_example_test.go deleted file mode 100644 index ea9395eb8931..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/operations_client_example_test.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ListHDInsightOperations.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 := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armhdinsight.OperationListResult{ - // Value: []*armhdinsight.Operation{ - // { - // Name: to.Ptr("Microsoft.HDInsight/register/action"), - // Display: &armhdinsight.OperationDisplay{ - // Description: to.Ptr("Register HDInsight resource provider for the subscription"), - // Operation: to.Ptr("Register HDInsight resource provider"), - // Provider: to.Ptr("Microsoft.HDInsight"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.HDInsight/unregister/action"), - // Display: &armhdinsight.OperationDisplay{ - // Description: to.Ptr("Unregister HDInsight resource provider for the subscription"), - // Operation: to.Ptr("Unregister HDInsight resource provider"), - // Provider: to.Ptr("Microsoft.HDInsight"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/options.go b/sdk/resourcemanager/hdinsight/armhdinsight/options.go index decaa6509a37..f36ade37296e 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/options.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/options.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -10,13 +7,13 @@ package armhdinsight // ApplicationsClientBeginCreateOptions contains the optional parameters for the ApplicationsClient.BeginCreate method. type ApplicationsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ApplicationsClientBeginDeleteOptions contains the optional parameters for the ApplicationsClient.BeginDelete method. type ApplicationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -39,54 +36,54 @@ type ApplicationsClientListByClusterOptions struct { // ClustersClientBeginCreateOptions contains the optional parameters for the ClustersClient.BeginCreate method. type ClustersClientBeginCreateOptions struct { - // 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 } // ClustersClientBeginExecuteScriptActionsOptions contains the optional parameters for the ClustersClient.BeginExecuteScriptActions // method. type ClustersClientBeginExecuteScriptActionsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginResizeOptions contains the optional parameters for the ClustersClient.BeginResize method. type ClustersClientBeginResizeOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginRotateDiskEncryptionKeyOptions contains the optional parameters for the ClustersClient.BeginRotateDiskEncryptionKey // method. type ClustersClientBeginRotateDiskEncryptionKeyOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginUpdateAutoScaleConfigurationOptions contains the optional parameters for the ClustersClient.BeginUpdateAutoScaleConfiguration // method. type ClustersClientBeginUpdateAutoScaleConfigurationOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginUpdateGatewaySettingsOptions contains the optional parameters for the ClustersClient.BeginUpdateGatewaySettings // method. type ClustersClientBeginUpdateGatewaySettingsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginUpdateIdentityCertificateOptions contains the optional parameters for the ClustersClient.BeginUpdateIdentityCertificate // method. type ClustersClientBeginUpdateIdentityCertificateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -124,7 +121,7 @@ type ClustersClientUpdateOptions struct { // ConfigurationsClientBeginUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginUpdate method. type ConfigurationsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -140,55 +137,55 @@ type ConfigurationsClientListOptions struct { // ExtensionsClientBeginCreateOptions contains the optional parameters for the ExtensionsClient.BeginCreate method. type ExtensionsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExtensionsClientBeginDeleteOptions contains the optional parameters for the ExtensionsClient.BeginDelete method. type ExtensionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExtensionsClientBeginDisableAzureMonitorAgentOptions contains the optional parameters for the ExtensionsClient.BeginDisableAzureMonitorAgent // method. type ExtensionsClientBeginDisableAzureMonitorAgentOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExtensionsClientBeginDisableAzureMonitorOptions contains the optional parameters for the ExtensionsClient.BeginDisableAzureMonitor // method. type ExtensionsClientBeginDisableAzureMonitorOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExtensionsClientBeginDisableMonitoringOptions contains the optional parameters for the ExtensionsClient.BeginDisableMonitoring // method. type ExtensionsClientBeginDisableMonitoringOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExtensionsClientBeginEnableAzureMonitorAgentOptions contains the optional parameters for the ExtensionsClient.BeginEnableAzureMonitorAgent // method. type ExtensionsClientBeginEnableAzureMonitorAgentOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExtensionsClientBeginEnableAzureMonitorOptions contains the optional parameters for the ExtensionsClient.BeginEnableAzureMonitor // method. type ExtensionsClientBeginEnableAzureMonitorOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExtensionsClientBeginEnableMonitoringOptions contains the optional parameters for the ExtensionsClient.BeginEnableMonitoring // method. type ExtensionsClientBeginEnableMonitoringOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -262,14 +259,14 @@ type OperationsClientListOptions 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 } @@ -334,7 +331,7 @@ type ScriptExecutionHistoryClientPromoteOptions struct { // VirtualMachinesClientBeginRestartHostsOptions contains the optional parameters for the VirtualMachinesClient.BeginRestartHosts // method. type VirtualMachinesClientBeginRestartHostsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client.go index 03dcc28b3628..73ac98821202 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Approve or reject a private endpoint connection manually. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -75,7 +72,7 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Approve or reject a private endpoint connection manually. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview 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" @@ -98,7 +95,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.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -121,7 +118,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -133,7 +130,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes the specific private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -160,7 +157,7 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Deletes the specific private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview 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" @@ -183,7 +180,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.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -206,7 +203,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -215,7 +212,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specific private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - privateEndpointConnectionName - The name of the private endpoint connection. @@ -244,7 +241,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.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -267,7 +264,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -284,7 +281,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByClusterPager - Lists the private endpoint connections for a HDInsight cluster. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - PrivateEndpointConnectionsClientListByClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByClusterPager @@ -313,7 +310,7 @@ func (client *PrivateEndpointConnectionsClient) NewListByClusterPager(resourceGr } // listByClusterCreateRequest creates the ListByCluster request. -func (client *PrivateEndpointConnectionsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateEndpointConnectionsClientListByClusterOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *PrivateEndpointConnectionsClientListByClusterOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -332,7 +329,7 @@ func (client *PrivateEndpointConnectionsClient) listByClusterCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client_example_test.go deleted file mode 100644 index 18de7da7fded..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,171 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_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/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetAllPrivateEndpointConnectionsInCluster.json -func ExamplePrivateEndpointConnectionsClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByClusterPager("rg1", "cluster1", 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 = armhdinsight.PrivateEndpointConnectionListResult{ - // Value: []*armhdinsight.PrivateEndpointConnection{ - // { - // Name: to.Ptr("testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/privateEndpointConnections/testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2"), - // Properties: &armhdinsight.PrivateEndpointConnectionProperties{ - // LinkIdentifier: to.Ptr("620815036"), - // PrivateEndpoint: &armhdinsight.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/privateEndpoints/testprivateep"), - // }, - // PrivateLinkServiceConnectionState: &armhdinsight.PrivateLinkServiceConnectionState{ - // Description: to.Ptr(""), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armhdinsight.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armhdinsight.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/ApprovePrivateEndpointConnection.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 := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "rg1", "cluster1", "testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2", armhdinsight.PrivateEndpointConnection{ - Properties: &armhdinsight.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armhdinsight.PrivateLinkServiceConnectionState{ - Description: to.Ptr("update it from pending to approved."), - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armhdinsight.PrivateLinkServiceConnectionStatusApproved), - }, - }, - }, 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 = armhdinsight.PrivateEndpointConnection{ - // Name: to.Ptr("testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/privateEndpointConnections/testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2"), - // Properties: &armhdinsight.PrivateEndpointConnectionProperties{ - // LinkIdentifier: to.Ptr("620815036"), - // PrivateEndpoint: &armhdinsight.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/privateEndpoints/testprivateep"), - // }, - // PrivateLinkServiceConnectionState: &armhdinsight.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("update it from pending to approved."), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armhdinsight.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armhdinsight.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetPrivateEndpointConnection.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 := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "rg1", "cluster1", "testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armhdinsight.PrivateEndpointConnection{ - // Name: to.Ptr("testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/privateEndpointConnections/testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2"), - // Properties: &armhdinsight.PrivateEndpointConnectionProperties{ - // LinkIdentifier: to.Ptr("620815036"), - // PrivateEndpoint: &armhdinsight.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/privateEndpoints/testprivateep"), - // }, - // PrivateLinkServiceConnectionState: &armhdinsight.PrivateLinkServiceConnectionState{ - // Description: to.Ptr(""), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armhdinsight.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armhdinsight.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeletePrivateEndpointConnection.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 := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "rg1", "cluster1", "testprivateep.b3bf5fed-9b12-4560-b7d0-2abe1bba07e2", 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/hdinsight/armhdinsight/privatelinkresources_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client.go index 27fe47ad9bad..862cc73e45fb 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // Get - Gets the specific private link resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - privateLinkResourceName - The name of the private link resource. @@ -76,7 +73,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.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,7 +96,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +114,7 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) // ListByCluster - Lists the private link resources in a HDInsight cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - PrivateLinkResourcesClientListByClusterOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByCluster @@ -145,7 +142,7 @@ func (client *PrivateLinkResourcesClient) ListByCluster(ctx context.Context, res } // listByClusterCreateRequest creates the ListByCluster request. -func (client *PrivateLinkResourcesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateLinkResourcesClientListByClusterOptions) (*policy.Request, error) { +func (client *PrivateLinkResourcesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *PrivateLinkResourcesClientListByClusterOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -164,7 +161,7 @@ func (client *PrivateLinkResourcesClient) listByClusterCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client_example_test.go deleted file mode 100644 index e8f2e786fec4..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,97 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetAllPrivateLinkResourcesInCluster.json -func ExamplePrivateLinkResourcesClient_ListByCluster() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByCluster(ctx, "rg1", "cluster1", 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.PrivateLinkResourceListResult = armhdinsight.PrivateLinkResourceListResult{ - // Value: []*armhdinsight.PrivateLinkResource{ - // { - // Name: to.Ptr("gateway"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/privateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/privateLinkResources/gateway"), - // Properties: &armhdinsight.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("gateway"), - // RequiredMembers: []*string{ - // to.Ptr("gateway")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azurehdinsight.net")}, - // }, - // }, - // { - // Name: to.Ptr("headnode"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/privateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/privateLinkResources/headnode"), - // Properties: &armhdinsight.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("headnode"), - // RequiredMembers: []*string{ - // to.Ptr("headnode")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azurehdinsight.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetPrivateLinkResource.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 := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "rg1", "cluster1", "gateway", 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 = armhdinsight.PrivateLinkResource{ - // Name: to.Ptr("gateway"), - // Type: to.Ptr("Microsoft.HDInsight/clusters/privateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.HDInsight/clusters/cluster1/privateLinkResources/gateway"), - // Properties: &armhdinsight.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("gateway"), - // RequiredMembers: []*string{ - // to.Ptr("gateway")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azurehdinsight.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/responses.go b/sdk/resourcemanager/hdinsight/armhdinsight/responses.go index 8251cd22cfeb..b0a31ba3e291 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/responses.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/responses.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client.go index 6505a6382628..0ed972d36c2c 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewScriptActionsClient(subscriptionID string, credential azcore.TokenCreden // Delete - Deletes a specified persisted script action of the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - scriptName - The name of the script. @@ -74,7 +71,7 @@ func (client *ScriptActionsClient) Delete(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *ScriptActionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, scriptName string, options *ScriptActionsClientDeleteOptions) (*policy.Request, error) { +func (client *ScriptActionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, scriptName string, _ *ScriptActionsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +94,7 @@ func (client *ScriptActionsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,7 +103,7 @@ func (client *ScriptActionsClient) deleteCreateRequest(ctx context.Context, reso // GetExecutionAsyncOperationStatus - Gets the async operation status of execution operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - operationID - The long running operation id. @@ -135,7 +132,7 @@ func (client *ScriptActionsClient) GetExecutionAsyncOperationStatus(ctx context. } // getExecutionAsyncOperationStatusCreateRequest creates the GetExecutionAsyncOperationStatus request. -func (client *ScriptActionsClient) getExecutionAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, operationID string, options *ScriptActionsClientGetExecutionAsyncOperationStatusOptions) (*policy.Request, error) { +func (client *ScriptActionsClient) getExecutionAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, operationID string, _ *ScriptActionsClientGetExecutionAsyncOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions/azureasyncoperations/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -158,7 +155,7 @@ func (client *ScriptActionsClient) getExecutionAsyncOperationStatusCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +173,7 @@ func (client *ScriptActionsClient) getExecutionAsyncOperationStatusHandleRespons // GetExecutionDetail - Gets the script execution detail for the given script execution ID. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - scriptExecutionID - The script execution Id @@ -205,7 +202,7 @@ func (client *ScriptActionsClient) GetExecutionDetail(ctx context.Context, resou } // getExecutionDetailCreateRequest creates the GetExecutionDetail request. -func (client *ScriptActionsClient) getExecutionDetailCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string, options *ScriptActionsClientGetExecutionDetailOptions) (*policy.Request, error) { +func (client *ScriptActionsClient) getExecutionDetailCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string, _ *ScriptActionsClientGetExecutionDetailOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -228,7 +225,7 @@ func (client *ScriptActionsClient) getExecutionDetailCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,7 +242,7 @@ func (client *ScriptActionsClient) getExecutionDetailHandleResponse(resp *http.R // NewListByClusterPager - Lists all the persisted script actions for the specified cluster. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ScriptActionsClientListByClusterOptions contains the optional parameters for the ScriptActionsClient.NewListByClusterPager @@ -274,7 +271,7 @@ func (client *ScriptActionsClient) NewListByClusterPager(resourceGroupName strin } // listByClusterCreateRequest creates the ListByCluster request. -func (client *ScriptActionsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ScriptActionsClientListByClusterOptions) (*policy.Request, error) { +func (client *ScriptActionsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ScriptActionsClientListByClusterOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -293,7 +290,7 @@ func (client *ScriptActionsClient) listByClusterCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client_example_test.go deleted file mode 100644 index 9f6406f1c9b4..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/scriptactions_client_example_test.go +++ /dev/null @@ -1,129 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/DeleteScriptAction.json -func ExampleScriptActionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScriptActionsClient().Delete(ctx, "rg1", "cluster1", "scriptName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetLinuxHadoopScriptAction.json -func ExampleScriptActionsClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScriptActionsClient().NewListByClusterPager("rg1", "cluster1", 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.ScriptActionsList = armhdinsight.ScriptActionsList{ - // Value: []*armhdinsight.RuntimeScriptActionDetail{ - // { - // Name: to.Ptr("app-Install"), - // ApplicationName: to.Ptr("app"), - // Roles: []*string{ - // to.Ptr("edgenode")}, - // URI: to.Ptr("https://app.com/azure/app_install.sh"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetScriptActionById.json -func ExampleScriptActionsClient_GetExecutionDetail() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScriptActionsClient().GetExecutionDetail(ctx, "rg1", "cluster1", "391145124054712", 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.RuntimeScriptActionDetail = armhdinsight.RuntimeScriptActionDetail{ - // Name: to.Ptr("Test"), - // ApplicationName: to.Ptr("app1"), - // Roles: []*string{ - // to.Ptr("headnode"), - // to.Ptr("workernode")}, - // URI: to.Ptr("http://testurl.com/install.ssh"), - // DebugInformation: to.Ptr(""), - // EndTime: to.Ptr("2017-03-22T21:34:39.293"), - // ExecutionSummary: []*armhdinsight.ScriptActionExecutionSummary{ - // }, - // Operation: to.Ptr("PostClusterCreateScriptActionRequest"), - // ScriptExecutionID: to.Ptr[int64](391145124054712), - // StartTime: to.Ptr("2017-03-22T21:34:39.293"), - // Status: to.Ptr("ValidationFailed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetScriptExecutionAsyncOperationStatus.json -func ExampleScriptActionsClient_GetExecutionAsyncOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScriptActionsClient().GetExecutionAsyncOperationStatus(ctx, "rg1", "cluster1", "CF938302-6B4D-44A0-A6D2-C0D67E847AEC", 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.AsyncOperationResult = armhdinsight.AsyncOperationResult{ - // Status: to.Ptr(armhdinsight.AsyncOperationStateInProgress), - // } -} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client.go index 229b8eab9d74..70f7afa6bd80 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -46,7 +43,7 @@ func NewScriptExecutionHistoryClient(subscriptionID string, credential azcore.To // NewListByClusterPager - Lists all scripts' execution history for the specified cluster. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - ScriptExecutionHistoryClientListByClusterOptions contains the optional parameters for the ScriptExecutionHistoryClient.NewListByClusterPager @@ -75,7 +72,7 @@ func (client *ScriptExecutionHistoryClient) NewListByClusterPager(resourceGroupN } // listByClusterCreateRequest creates the ListByCluster request. -func (client *ScriptExecutionHistoryClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ScriptExecutionHistoryClientListByClusterOptions) (*policy.Request, error) { +func (client *ScriptExecutionHistoryClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *ScriptExecutionHistoryClientListByClusterOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,7 +91,7 @@ func (client *ScriptExecutionHistoryClient) listByClusterCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -112,7 +109,7 @@ func (client *ScriptExecutionHistoryClient) listByClusterHandleResponse(resp *ht // Promote - Promotes the specified ad-hoc script execution to a persisted script. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - scriptExecutionID - The script execution Id @@ -140,7 +137,7 @@ func (client *ScriptExecutionHistoryClient) Promote(ctx context.Context, resourc } // promoteCreateRequest creates the Promote request. -func (client *ScriptExecutionHistoryClient) promoteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string, options *ScriptExecutionHistoryClientPromoteOptions) (*policy.Request, error) { +func (client *ScriptExecutionHistoryClient) promoteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, scriptExecutionID string, _ *ScriptExecutionHistoryClientPromoteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -163,7 +160,7 @@ func (client *ScriptExecutionHistoryClient) promoteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client_example_test.go deleted file mode 100644 index 980fd3373396..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/scriptexecutionhistory_client_example_test.go +++ /dev/null @@ -1,93 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetScriptExecutionHistory.json -func ExampleScriptExecutionHistoryClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScriptExecutionHistoryClient().NewListByClusterPager("rg1", "cluster1", 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.ScriptActionExecutionHistoryList = armhdinsight.ScriptActionExecutionHistoryList{ - // Value: []*armhdinsight.RuntimeScriptActionDetail{ - // { - // Name: to.Ptr("Test"), - // ApplicationName: to.Ptr("app1"), - // Roles: []*string{ - // to.Ptr("headnode"), - // to.Ptr("workernode")}, - // URI: to.Ptr("http://testurl.com/install.ssh"), - // EndTime: to.Ptr("2017-03-22T21:34:39.293"), - // ExecutionSummary: []*armhdinsight.ScriptActionExecutionSummary{ - // }, - // Operation: to.Ptr("PostClusterCreateScriptActionRequest"), - // ScriptExecutionID: to.Ptr[int64](391145124054712), - // StartTime: to.Ptr("2017-03-22T21:34:39.293"), - // Status: to.Ptr("ValidationFailed"), - // }, - // { - // Name: to.Ptr("Test"), - // ApplicationName: to.Ptr("app2"), - // Roles: []*string{ - // to.Ptr("headnode"), - // to.Ptr("workernode")}, - // URI: to.Ptr("http://testurl.com/install-script.ssh"), - // EndTime: to.Ptr("2017-03-22T21:34:39.293"), - // ExecutionSummary: []*armhdinsight.ScriptActionExecutionSummary{ - // }, - // Operation: to.Ptr("PostClusterCreateScriptActionRequest"), - // ScriptExecutionID: to.Ptr[int64](391144597342127), - // StartTime: to.Ptr("2017-03-22T21:34:39.293"), - // Status: to.Ptr("ValidationFailed"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/PromoteLinuxHadoopScriptAction.json -func ExampleScriptExecutionHistoryClient_Promote() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScriptExecutionHistoryClient().Promote(ctx, "rg1", "cluster1", "391145124054712", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/time_rfc3339.go b/sdk/resourcemanager/hdinsight/armhdinsight/time_rfc3339.go index b94acefe0b69..bc05d7c0b922 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/time_rfc3339.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/time_rfc3339.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client.go b/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client.go index 8ce6f83f2a5f..32d1e19bfc9c 100644 --- a/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client.go +++ b/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCred // GetAsyncOperationStatus - Gets the async operation status. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - operationID - The long running operation id. @@ -76,7 +73,7 @@ func (client *VirtualMachinesClient) GetAsyncOperationStatus(ctx context.Context } // getAsyncOperationStatusCreateRequest creates the GetAsyncOperationStatus request. -func (client *VirtualMachinesClient) getAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, operationID string, options *VirtualMachinesClientGetAsyncOperationStatusOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) getAsyncOperationStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, operationID string, _ *VirtualMachinesClientGetAsyncOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts/azureasyncoperations/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,7 +96,7 @@ func (client *VirtualMachinesClient) getAsyncOperationStatusCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -117,7 +114,7 @@ func (client *VirtualMachinesClient) getAsyncOperationStatusHandleResponse(resp // ListHosts - Lists the HDInsight clusters hosts // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - options - VirtualMachinesClientListHostsOptions contains the optional parameters for the VirtualMachinesClient.ListHosts @@ -145,7 +142,7 @@ func (client *VirtualMachinesClient) ListHosts(ctx context.Context, resourceGrou } // listHostsCreateRequest creates the ListHosts request. -func (client *VirtualMachinesClient) listHostsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *VirtualMachinesClientListHostsOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) listHostsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, _ *VirtualMachinesClientListHostsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -164,7 +161,7 @@ func (client *VirtualMachinesClient) listHostsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +179,7 @@ func (client *VirtualMachinesClient) listHostsHandleResponse(resp *http.Response // BeginRestartHosts - Restarts the specified HDInsight cluster hosts. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. // - clusterName - The name of the cluster. // - hosts - The list of hosts to restart @@ -209,7 +206,7 @@ func (client *VirtualMachinesClient) BeginRestartHosts(ctx context.Context, reso // RestartHosts - Restarts the specified HDInsight cluster hosts. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-08-01-preview +// Generated from API version 2025-01-15-preview func (client *VirtualMachinesClient) restartHosts(ctx context.Context, resourceGroupName string, clusterName string, hosts []*string, options *VirtualMachinesClientBeginRestartHostsOptions) (*http.Response, error) { var err error const operationName = "VirtualMachinesClient.BeginRestartHosts" @@ -232,7 +229,7 @@ func (client *VirtualMachinesClient) restartHosts(ctx context.Context, resourceG } // restartHostsCreateRequest creates the RestartHosts request. -func (client *VirtualMachinesClient) restartHostsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, hosts []*string, options *VirtualMachinesClientBeginRestartHostsOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) restartHostsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, hosts []*string, _ *VirtualMachinesClientBeginRestartHostsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -251,7 +248,7 @@ func (client *VirtualMachinesClient) restartHostsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-08-01-preview") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, hosts); err != nil { diff --git a/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client_example_test.go b/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client_example_test.go deleted file mode 100644 index b27c9fe2e611..000000000000 --- a/sdk/resourcemanager/hdinsight/armhdinsight/virtualmachines_client_example_test.go +++ /dev/null @@ -1,113 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armhdinsight_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/hdinsight/armhdinsight" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetClusterVirtualMachines.json -func ExampleVirtualMachinesClient_ListHosts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().ListHosts(ctx, "rg1", "cluster1", 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.HostInfoArray = []*armhdinsight.HostInfo{ - // { - // Name: to.Ptr("gateway1"), - // }, - // { - // Name: to.Ptr("gateway3"), - // }, - // { - // Name: to.Ptr("headnode0"), - // }, - // { - // Name: to.Ptr("headnode3"), - // }, - // { - // Name: to.Ptr("workernode0"), - // }, - // { - // Name: to.Ptr("workernode1"), - // }, - // { - // Name: to.Ptr("zookeepernode0"), - // }, - // { - // Name: to.Ptr("zookeepernode2"), - // }, - // { - // Name: to.Ptr("zookeepernode3"), - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/RestartVirtualMachinesOperation.json -func ExampleVirtualMachinesClient_BeginRestartHosts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginRestartHosts(ctx, "rg1", "cluster1", []*string{ - to.Ptr("gateway1"), - to.Ptr("gateway3")}, 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/aec83a5f0ed56da4fd16fa027b9fa27edfa8988b/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/examples/GetRestartHostsAsyncOperationStatus.json -func ExampleVirtualMachinesClient_GetAsyncOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armhdinsight.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().GetAsyncOperationStatus(ctx, "rg1", "cluster1", "CF938302-6B4D-44A0-A6D2-C0D67E847AEC", 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.AsyncOperationResult = armhdinsight.AsyncOperationResult{ - // Status: to.Ptr(armhdinsight.AsyncOperationStateInProgress), - // } -}