From b19cd0265f7632f2d6f2c470696aaa3d17708d14 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 27 Feb 2023 09:36:29 +0000 Subject: [PATCH] CodeGen from PR 22799 in Azure/azure-rest-api-specs Merge 25a6ac1bd3c32cc3c33291149edf6f08173de2a7 into 27db05be12c8863e7ac85218b84632b9ea539ae4 --- .../armsqlvirtualmachine/CHANGELOG.md | 17 + .../armsqlvirtualmachine/autorest.md | 6 +- .../availabilitygrouplisteners_client.go | 89 +-- ...ilitygrouplisteners_client_example_test.go | 165 ------ .../armsqlvirtualmachine/constants.go | 18 +- .../armsqlvirtualmachine/go.mod | 14 +- .../armsqlvirtualmachine/go.sum | 24 +- .../armsqlvirtualmachine/groups_client.go | 106 ++-- .../groups_client_example_test.go | 175 ------ .../armsqlvirtualmachine/models.go | 98 +++- .../armsqlvirtualmachine/models_serde.go | 257 +++++++-- .../armsqlvirtualmachine/operations_client.go | 11 +- .../operations_client_example_test.go | 41 -- .../armsqlvirtualmachine/response_types.go | 39 +- .../sqlvirtualmachines_client.go | 180 +++--- .../sqlvirtualmachines_client_example_test.go | 520 ------------------ .../armsqlvirtualmachine/time_rfc3339.go | 2 +- .../troubleshoot_client.go | 125 +++++ 18 files changed, 715 insertions(+), 1172 deletions(-) delete mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go delete mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go delete mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go create mode 100644 sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/troubleshoot_client.go diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md index ea9b2a677639..f4fe7a071b2c 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/CHANGELOG.md @@ -1,5 +1,22 @@ # Release History +## 0.8.0 (2023-02-27) +### Features Added + +- New value `LeastPrivilegeModeNotSet` added to type alias `LeastPrivilegeMode` +- New type alias `TroubleshootingScenario` with values `TroubleshootingScenarioUnhealthyReplica` +- New function `NewTroubleshootClient(string, azcore.TokenCredential, *arm.ClientOptions) (*TroubleshootClient, error)` +- New function `*TroubleshootClient.BeginTroubleshoot(context.Context, string, string, SQLVMTroubleshooting, *TroubleshootClientBeginTroubleshootOptions) (*runtime.Poller[TroubleshootClientTroubleshootResponse], error)` +- New struct `AADAuthenticationSettings` +- New struct `SQLVMTroubleshooting` +- New struct `TroubleshootClient` +- New struct `TroubleshootingAdditionalProperties` +- New struct `TroubleshootingStatus` +- New struct `UnhealthyReplicaInfo` +- New field `TroubleshootingStatus` in struct `Properties` +- New field `AzureAdAuthenticationSettings` in struct `ServerConfigurationsManagementSettings` + + ## 0.7.0 (2022-09-17) ### Features Added diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md index 203ed84f15b3..636d2a51f077 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/sqlvirtualmachine/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/e24bbf6a66cb0a19c072c6f15cee163acbd7acf7/specification/sqlvirtualmachine/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sqlvirtualmachine/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.7.0 +module-version: 0.8.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go index 33e3ea905920..43504c659903 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client.go @@ -32,9 +32,9 @@ type AvailabilityGroupListenersClient struct { } // NewAvailabilityGroupListenersClient creates a new instance of AvailabilityGroupListenersClient with the specified values. -// subscriptionID - Subscription ID that identifies an Azure subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewAvailabilityGroupListenersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AvailabilityGroupListenersClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,21 +57,24 @@ func NewAvailabilityGroupListenersClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Creates or updates an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// availabilityGroupListenerName - Name of the availability group listener. -// parameters - The availability group listener. -// options - AvailabilityGroupListenersClientBeginCreateOrUpdateOptions contains the optional parameters for the AvailabilityGroupListenersClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - availabilityGroupListenerName - Name of the availability group listener. +// - parameters - The availability group listener. +// - options - AvailabilityGroupListenersClientBeginCreateOrUpdateOptions contains the optional parameters for the AvailabilityGroupListenersClient.BeginCreateOrUpdate +// method. func (client *AvailabilityGroupListenersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, parameters AvailabilityGroupListener, options *AvailabilityGroupListenersClientBeginCreateOrUpdateOptions) (*runtime.Poller[AvailabilityGroupListenersClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[AvailabilityGroupListenersClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AvailabilityGroupListenersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[AvailabilityGroupListenersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -79,7 +82,8 @@ func (client *AvailabilityGroupListenersClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Creates or updates an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *AvailabilityGroupListenersClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, parameters AvailabilityGroupListener, options *AvailabilityGroupListenersClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, parameters, options) if err != nil { @@ -119,7 +123,7 @@ func (client *AvailabilityGroupListenersClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -127,20 +131,23 @@ func (client *AvailabilityGroupListenersClient) createOrUpdateCreateRequest(ctx // BeginDelete - Deletes an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// availabilityGroupListenerName - Name of the availability group listener. -// options - AvailabilityGroupListenersClientBeginDeleteOptions contains the optional parameters for the AvailabilityGroupListenersClient.BeginDelete -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - availabilityGroupListenerName - Name of the availability group listener. +// - options - AvailabilityGroupListenersClientBeginDeleteOptions contains the optional parameters for the AvailabilityGroupListenersClient.BeginDelete +// method. func (client *AvailabilityGroupListenersClient) BeginDelete(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, options *AvailabilityGroupListenersClientBeginDeleteOptions) (*runtime.Poller[AvailabilityGroupListenersClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, options) if err != nil { return nil, err } - return runtime.NewPoller[AvailabilityGroupListenersClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AvailabilityGroupListenersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[AvailabilityGroupListenersClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -148,7 +155,8 @@ func (client *AvailabilityGroupListenersClient) BeginDelete(ctx context.Context, // Delete - Deletes an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *AvailabilityGroupListenersClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, options *AvailabilityGroupListenersClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, options) if err != nil { @@ -188,20 +196,22 @@ func (client *AvailabilityGroupListenersClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets an availability group listener. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// availabilityGroupListenerName - Name of the availability group listener. -// options - AvailabilityGroupListenersClientGetOptions contains the optional parameters for the AvailabilityGroupListenersClient.Get -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - availabilityGroupListenerName - Name of the availability group listener. +// - options - AvailabilityGroupListenersClientGetOptions contains the optional parameters for the AvailabilityGroupListenersClient.Get +// method. func (client *AvailabilityGroupListenersClient) Get(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, availabilityGroupListenerName string, options *AvailabilityGroupListenersClientGetOptions) (AvailabilityGroupListenersClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, availabilityGroupListenerName, options) if err != nil { @@ -244,7 +254,7 @@ func (client *AvailabilityGroupListenersClient) getCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,12 +270,13 @@ func (client *AvailabilityGroupListenersClient) getHandleResponse(resp *http.Res } // NewListByGroupPager - Lists all availability group listeners in a SQL virtual machine group. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// options - AvailabilityGroupListenersClientListByGroupOptions contains the optional parameters for the AvailabilityGroupListenersClient.ListByGroup -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - options - AvailabilityGroupListenersClientListByGroupOptions contains the optional parameters for the AvailabilityGroupListenersClient.NewListByGroupPager +// method. func (client *AvailabilityGroupListenersClient) NewListByGroupPager(resourceGroupName string, sqlVirtualMachineGroupName string, options *AvailabilityGroupListenersClientListByGroupOptions) *runtime.Pager[AvailabilityGroupListenersClientListByGroupResponse] { return runtime.NewPager(runtime.PagingHandler[AvailabilityGroupListenersClientListByGroupResponse]{ More: func(page AvailabilityGroupListenersClientListByGroupResponse) bool { @@ -314,7 +325,7 @@ func (client *AvailabilityGroupListenersClient) listByGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go deleted file mode 100644 index 7c131f45bacd..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/availabilitygrouplisteners_client_example_test.go +++ /dev/null @@ -1,165 +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. - -package armsqlvirtualmachine_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/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "testvmgroup", "agl-test", &armsqlvirtualmachine.AvailabilityGroupListenersClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_BeginCreateOrUpdate_createsOrUpdatesAnAvailabilityGroupListenerUsingLoadBalancerThisIsUsedForVMsPresentInSingleSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", "agl-test", armsqlvirtualmachine.AvailabilityGroupListener{ - Properties: &armsqlvirtualmachine.AvailabilityGroupListenerProperties{ - AvailabilityGroupName: to.Ptr("ag-test"), - LoadBalancerConfigurations: []*armsqlvirtualmachine.LoadBalancerConfiguration{ - { - LoadBalancerResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/loadBalancers/lb-test"), - PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ - IPAddress: to.Ptr("10.1.0.112"), - SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - }, - ProbePort: to.Ptr[int32](59983), - SQLVirtualMachineInstances: []*string{ - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2"), - to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm3")}, - }}, - Port: to.Ptr[int32](1433), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateAvailabilityGroupListenerWithMultiSubnet.json -func ExampleAvailabilityGroupListenersClient_BeginCreateOrUpdate_createsOrUpdatesAnAvailabilityGroupListenerThisIsUsedForVMsPresentInMultiSubnet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", "agl-test", armsqlvirtualmachine.AvailabilityGroupListener{ - Properties: &armsqlvirtualmachine.AvailabilityGroupListenerProperties{ - AvailabilityGroupName: to.Ptr("ag-test"), - MultiSubnetIPConfigurations: []*armsqlvirtualmachine.MultiSubnetIPConfiguration{ - { - PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ - IPAddress: to.Ptr("10.0.0.112"), - SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default"), - }, - SQLVirtualMachineInstance: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm2"), - }, - { - PrivateIPAddress: &armsqlvirtualmachine.PrivateIPAddress{ - IPAddress: to.Ptr("10.0.1.112"), - SubnetResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/alternate"), - }, - SQLVirtualMachineInstance: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/testvm1"), - }}, - Port: to.Ptr[int32](1433), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "testvmgroup", "agl-test", 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/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByGroupAvailabilityGroupListener.json -func ExampleAvailabilityGroupListenersClient_NewListByGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewAvailabilityGroupListenersClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByGroupPager("testrg", "testvmgroup", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go index 906f96e8d36a..8bd4f27d4ec5 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/constants.go @@ -11,7 +11,7 @@ package armsqlvirtualmachine const ( moduleName = "armsqlvirtualmachine" - moduleVersion = "v0.7.0" + moduleVersion = "v0.8.0" ) // AssessmentDayOfWeek - Day of the week to run assessment. @@ -280,12 +280,14 @@ type LeastPrivilegeMode string const ( LeastPrivilegeModeEnabled LeastPrivilegeMode = "Enabled" + LeastPrivilegeModeNotSet LeastPrivilegeMode = "NotSet" ) // PossibleLeastPrivilegeModeValues returns the possible values for the LeastPrivilegeMode const type. func PossibleLeastPrivilegeModeValues() []LeastPrivilegeMode { return []LeastPrivilegeMode{ LeastPrivilegeModeEnabled, + LeastPrivilegeModeNotSet, } } @@ -462,3 +464,17 @@ func PossibleStorageWorkloadTypeValues() []StorageWorkloadType { StorageWorkloadTypeOLTP, } } + +// TroubleshootingScenario - SQL VM troubleshooting scenario. +type TroubleshootingScenario string + +const ( + TroubleshootingScenarioUnhealthyReplica TroubleshootingScenario = "UnhealthyReplica" +) + +// PossibleTroubleshootingScenarioValues returns the possible values for the TroubleshootingScenario const type. +func PossibleTroubleshootingScenarioValues() []TroubleshootingScenario { + return []TroubleshootingScenario{ + TroubleshootingScenarioUnhealthyReplica, + } +} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod index fd6005fb3a68..c422025ad953 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/a go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go index cedf520cf3bb..b3abbd2007f9 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client.go @@ -32,9 +32,9 @@ type GroupsClient struct { } // NewGroupsClient creates a new instance of GroupsClient with the specified values. -// subscriptionID - Subscription ID that identifies an Azure subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,20 +57,23 @@ func NewGroupsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Creates or updates a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// parameters - The SQL virtual machine group. -// options - GroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - parameters - The SQL virtual machine group. +// - options - GroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the GroupsClient.BeginCreateOrUpdate +// method. func (client *GroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, parameters Group, options *GroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[GroupsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, sqlVirtualMachineGroupName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[GroupsClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GroupsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[GroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -78,7 +81,8 @@ func (client *GroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Creates or updates a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *GroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, parameters Group, options *GroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, parameters, options) if err != nil { @@ -114,7 +118,7 @@ func (client *GroupsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,18 +126,21 @@ func (client *GroupsClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Deletes a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// options - GroupsClientBeginDeleteOptions contains the optional parameters for the GroupsClient.BeginDelete method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - options - GroupsClientBeginDeleteOptions contains the optional parameters for the GroupsClient.BeginDelete method. func (client *GroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, options *GroupsClientBeginDeleteOptions) (*runtime.Poller[GroupsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, sqlVirtualMachineGroupName, options) if err != nil { return nil, err } - return runtime.NewPoller[GroupsClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GroupsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[GroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -141,7 +148,8 @@ func (client *GroupsClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deletes a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *GroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, options *GroupsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, options) if err != nil { @@ -177,18 +185,20 @@ func (client *GroupsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets a SQL virtual machine group. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// options - GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - options - GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. func (client *GroupsClient) Get(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, options *GroupsClientGetOptions) (GroupsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, options) if err != nil { @@ -224,7 +234,7 @@ func (client *GroupsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,8 +250,9 @@ func (client *GroupsClient) getHandleResponse(resp *http.Response) (GroupsClient } // NewListPager - Gets all SQL virtual machine groups in a subscription. -// Generated from API version 2022-07-01-preview -// options - GroupsClientListOptions contains the optional parameters for the GroupsClient.List method. +// +// Generated from API version 2022-08-01-preview +// - options - GroupsClientListOptions contains the optional parameters for the GroupsClient.NewListPager method. func (client *GroupsClient) NewListPager(options *GroupsClientListOptions) *runtime.Pager[GroupsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[GroupsClientListResponse]{ More: func(page GroupsClientListResponse) bool { @@ -282,7 +293,7 @@ func (client *GroupsClient) listCreateRequest(ctx context.Context, options *Grou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -298,11 +309,12 @@ func (client *GroupsClient) listHandleResponse(resp *http.Response) (GroupsClien } // NewListByResourceGroupPager - Gets all SQL virtual machine groups in a resource group. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// options - GroupsClientListByResourceGroupOptions contains the optional parameters for the GroupsClient.ListByResourceGroup -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - options - GroupsClientListByResourceGroupOptions contains the optional parameters for the GroupsClient.NewListByResourceGroupPager +// method. func (client *GroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *GroupsClientListByResourceGroupOptions) *runtime.Pager[GroupsClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[GroupsClientListByResourceGroupResponse]{ More: func(page GroupsClientListByResourceGroupResponse) bool { @@ -347,7 +359,7 @@ func (client *GroupsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -364,19 +376,22 @@ func (client *GroupsClient) listByResourceGroupHandleResponse(resp *http.Respons // BeginUpdate - Updates SQL virtual machine group tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// parameters - The SQL virtual machine group. -// options - GroupsClientBeginUpdateOptions contains the optional parameters for the GroupsClient.BeginUpdate method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - parameters - The SQL virtual machine group. +// - options - GroupsClientBeginUpdateOptions contains the optional parameters for the GroupsClient.BeginUpdate method. func (client *GroupsClient) BeginUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, parameters GroupUpdate, options *GroupsClientBeginUpdateOptions) (*runtime.Poller[GroupsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, sqlVirtualMachineGroupName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[GroupsClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[GroupsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[GroupsClientUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -384,7 +399,8 @@ func (client *GroupsClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Updates SQL virtual machine group tags. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *GroupsClient) update(ctx context.Context, resourceGroupName string, sqlVirtualMachineGroupName string, parameters GroupUpdate, options *GroupsClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineGroupName, parameters, options) if err != nil { @@ -420,7 +436,7 @@ func (client *GroupsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go deleted file mode 100644 index 22fd39c711be..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/groups_client_example_test.go +++ /dev/null @@ -1,175 +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. - -package armsqlvirtualmachine_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/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetSqlVirtualMachineGroup.json -func ExampleGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "testvmgroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineGroup.json -func ExampleGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvmgroup", armsqlvirtualmachine.Group{ - Location: to.Ptr("northeurope"), - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - Properties: &armsqlvirtualmachine.GroupProperties{ - SQLImageOffer: to.Ptr("SQL2016-WS2016"), - SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLVMGroupImageSKUEnterprise), - WsfcDomainProfile: &armsqlvirtualmachine.WsfcDomainProfile{ - ClusterBootstrapAccount: to.Ptr("testrpadmin"), - ClusterOperatorAccount: to.Ptr("testrp@testdomain.com"), - ClusterSubnetType: to.Ptr(armsqlvirtualmachine.ClusterSubnetTypeMultiSubnet), - DomainFqdn: to.Ptr("testdomain.com"), - OuPath: to.Ptr("OU=WSCluster,DC=testdomain,DC=com"), - SQLServiceAccount: to.Ptr("sqlservice@testdomain.com"), - StorageAccountPrimaryKey: to.Ptr(""), - StorageAccountURL: to.Ptr("https://storgact.blob.core.windows.net/"), - }, - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteSqlVirtualMachineGroup.json -func ExampleGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "testvmgroup", 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/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/UpdateSqlVirtualMachineGroup.json -func ExampleGroupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "testrg", "testvmgroup", armsqlvirtualmachine.GroupUpdate{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByResourceGroupSqlVirtualMachineGroup.json -func ExampleGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListSubscriptionSqlVirtualMachineGroup.json -func ExampleGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewGroupsClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go index c7402032b9a2..697c6b053a2a 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models.go @@ -11,6 +11,13 @@ package armsqlvirtualmachine import "time" +// AADAuthenticationSettings - Enable AAD authentication for SQL VM. +type AADAuthenticationSettings struct { + // The client Id of the Managed Identity to query Microsoft Graph API. An empty string must be used for the system assigned + // Managed Identity + ClientID *string `json:"clientId,omitempty"` +} + // AdditionalFeaturesServerConfigurations - Additional SQL Server feature settings. type AdditionalFeaturesServerConfigurations struct { // Enable or disable R services (SQL 2016 onwards). @@ -41,15 +48,15 @@ type AgReplica struct { SQLVirtualMachineInstanceID *string `json:"sqlVirtualMachineInstanceId,omitempty"` } -// AssessmentSettings - Configure assessment for databases in your SQL virtual machine. +// AssessmentSettings - Configure SQL best practices Assessment for databases in your SQL virtual machine. type AssessmentSettings struct { - // Enable or disable assessment feature on SQL virtual machine. + // Enable or disable SQL best practices Assessment feature on SQL virtual machine. Enable *bool `json:"enable,omitempty"` - // Run assessment immediately on SQL virtual machine. + // Run SQL best practices Assessment immediately on SQL virtual machine. RunImmediately *bool `json:"runImmediately,omitempty"` - // Schedule for Assessment. + // Schedule for SQL best practices Assessment. Schedule *Schedule `json:"schedule,omitempty"` } @@ -185,7 +192,7 @@ type AvailabilityGroupListenersClientGetOptions struct { Expand *string } -// AvailabilityGroupListenersClientListByGroupOptions contains the optional parameters for the AvailabilityGroupListenersClient.ListByGroup +// AvailabilityGroupListenersClientListByGroupOptions contains the optional parameters for the AvailabilityGroupListenersClient.NewListByGroupPager // method. type AvailabilityGroupListenersClientListByGroupOptions struct { // placeholder for future optional parameters @@ -278,12 +285,13 @@ type GroupsClientGetOptions struct { // placeholder for future optional parameters } -// GroupsClientListByResourceGroupOptions contains the optional parameters for the GroupsClient.ListByResourceGroup method. +// GroupsClientListByResourceGroupOptions contains the optional parameters for the GroupsClient.NewListByResourceGroupPager +// method. type GroupsClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// GroupsClientListOptions contains the optional parameters for the GroupsClient.List method. +// GroupsClientListOptions contains the optional parameters for the GroupsClient.NewListPager method. type GroupsClientListOptions struct { // placeholder for future optional parameters } @@ -354,7 +362,7 @@ type Operation struct { Origin *OperationOrigin `json:"origin,omitempty" azure:"ro"` // READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties,omitempty" azure:"ro"` + Properties map[string]any `json:"properties,omitempty" azure:"ro"` } // OperationDisplay - Display metadata associated with the operation. @@ -381,7 +389,7 @@ type OperationListResult struct { Value []*Operation `json:"value,omitempty" azure:"ro"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -397,7 +405,7 @@ type PrivateIPAddress struct { // Properties - The SQL virtual machine properties. type Properties struct { - // Assessment Settings. + // SQL best practices Assessment Settings. AssessmentSettings *AssessmentSettings `json:"assessmentSettings,omitempty"` // Auto backup settings for SQL Server. @@ -447,6 +455,9 @@ type Properties struct { // READ-ONLY; Provisioning state to track the async operation status. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Troubleshooting status + TroubleshootingStatus *TroubleshootingStatus `json:"troubleshootingStatus,omitempty" azure:"ro"` } // ResourceIdentity - Azure Active Directory identity configuration for a resource. @@ -552,6 +563,24 @@ type SQLTempDbSettings struct { PersistFolderPath *string `json:"persistFolderPath,omitempty"` } +// SQLVMTroubleshooting - Details required for SQL VM troubleshooting +type SQLVMTroubleshooting struct { + // End time in UTC timezone. + EndTimeUTC *time.Time `json:"endTimeUtc,omitempty"` + + // Troubleshooting properties + Properties *TroubleshootingAdditionalProperties `json:"properties,omitempty"` + + // Start time in UTC timezone. + StartTimeUTC *time.Time `json:"startTimeUtc,omitempty"` + + // SQL VM troubleshooting scenario. + TroubleshootingScenario *TroubleshootingScenario `json:"troubleshootingScenario,omitempty"` + + // READ-ONLY; Virtual machine resource id for response. + VirtualMachineResourceID *string `json:"virtualMachineResourceId,omitempty" azure:"ro"` +} + // SQLVirtualMachine - A SQL virtual machine. type SQLVirtualMachine struct { // REQUIRED; Resource location. @@ -620,19 +649,19 @@ type SQLVirtualMachinesClientGetOptions struct { Expand *string } -// SQLVirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.ListByResourceGroup +// SQLVirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.NewListByResourceGroupPager // method. type SQLVirtualMachinesClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// SQLVirtualMachinesClientListBySQLVMGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.ListBySQLVMGroup +// SQLVirtualMachinesClientListBySQLVMGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.NewListBySQLVMGroupPager // method. type SQLVirtualMachinesClientListBySQLVMGroupOptions struct { // placeholder for future optional parameters } -// SQLVirtualMachinesClientListOptions contains the optional parameters for the SQLVirtualMachinesClient.List method. +// SQLVirtualMachinesClientListOptions contains the optional parameters for the SQLVirtualMachinesClient.NewListPager method. type SQLVirtualMachinesClientListOptions struct { // placeholder for future optional parameters } @@ -667,6 +696,9 @@ type ServerConfigurationsManagementSettings struct { // Additional SQL feature settings. AdditionalFeaturesServerConfigurations *AdditionalFeaturesServerConfigurations `json:"additionalFeaturesServerConfigurations,omitempty"` + // Azure AD authentication Settings. + AzureAdAuthenticationSettings *AADAuthenticationSettings `json:"azureAdAuthenticationSettings,omitempty"` + // SQL connectivity type settings. SQLConnectivityUpdateSettings *SQLConnectivityUpdateSettings `json:"sqlConnectivityUpdateSettings,omitempty"` @@ -722,6 +754,46 @@ type SystemData struct { LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` } +// TroubleshootClientBeginTroubleshootOptions contains the optional parameters for the TroubleshootClient.BeginTroubleshoot +// method. +type TroubleshootClientBeginTroubleshootOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// TroubleshootingAdditionalProperties - SQL VM Troubleshooting additional properties. +type TroubleshootingAdditionalProperties struct { + // The unhealthy replica information + UnhealthyReplicaInfo *UnhealthyReplicaInfo `json:"unhealthyReplicaInfo,omitempty"` +} + +// TroubleshootingStatus - Status of last troubleshooting operation on this SQL VM +type TroubleshootingStatus struct { + // READ-ONLY; End time in UTC timezone. + EndTimeUTC *time.Time `json:"endTimeUtc,omitempty" azure:"ro"` + + // READ-ONLY; Last troubleshooting trigger time in UTC timezone + LastTriggerTimeUTC *time.Time `json:"lastTriggerTimeUtc,omitempty" azure:"ro"` + + // READ-ONLY; Troubleshooting properties + Properties *TroubleshootingAdditionalProperties `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; Root cause of the issue + RootCause *string `json:"rootCause,omitempty" azure:"ro"` + + // READ-ONLY; Start time in UTC timezone. + StartTimeUTC *time.Time `json:"startTimeUtc,omitempty" azure:"ro"` + + // READ-ONLY; SQL VM troubleshooting scenario. + TroubleshootingScenario *TroubleshootingScenario `json:"troubleshootingScenario,omitempty" azure:"ro"` +} + +// UnhealthyReplicaInfo - SQL VM Troubleshoot UnhealthyReplica scenario information. +type UnhealthyReplicaInfo struct { + // The name of the availability group + AvailabilityGroupName *string `json:"availabilityGroupName,omitempty"` +} + // Update - An update to a SQL virtual machine. type Update struct { // Resource tags. diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go index fe970d8a5c14..122d527334b9 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/models_serde.go @@ -16,9 +16,36 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type AADAuthenticationSettings. +func (a AADAuthenticationSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", a.ClientID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADAuthenticationSettings. +func (a *AADAuthenticationSettings) 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", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &a.ClientID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AdditionalFeaturesServerConfigurations. func (a AdditionalFeaturesServerConfigurations) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "isRServicesEnabled", a.IsRServicesEnabled) return json.Marshal(objectMap) } @@ -45,7 +72,7 @@ func (a *AdditionalFeaturesServerConfigurations) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type AgConfiguration. func (a AgConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "replicas", a.Replicas) return json.Marshal(objectMap) } @@ -72,7 +99,7 @@ func (a *AgConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AgReplica. func (a AgReplica) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "commit", a.Commit) populate(objectMap, "failover", a.Failover) populate(objectMap, "readableSecondary", a.ReadableSecondary) @@ -115,7 +142,7 @@ func (a *AgReplica) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AssessmentSettings. func (a AssessmentSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enable", a.Enable) populate(objectMap, "runImmediately", a.RunImmediately) populate(objectMap, "schedule", a.Schedule) @@ -150,7 +177,7 @@ func (a *AssessmentSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoBackupSettings. func (a AutoBackupSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "backupScheduleType", a.BackupScheduleType) populate(objectMap, "backupSystemDbs", a.BackupSystemDbs) populate(objectMap, "daysOfWeek", a.DaysOfWeek) @@ -229,7 +256,7 @@ func (a *AutoBackupSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoPatchingSettings. func (a AutoPatchingSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dayOfWeek", a.DayOfWeek) populate(objectMap, "enable", a.Enable) populate(objectMap, "maintenanceWindowDuration", a.MaintenanceWindowDuration) @@ -268,7 +295,7 @@ func (a *AutoPatchingSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AvailabilityGroupListener. func (a AvailabilityGroupListener) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -311,7 +338,7 @@ func (a *AvailabilityGroupListener) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AvailabilityGroupListenerListResult. func (a AvailabilityGroupListenerListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", a.NextLink) populate(objectMap, "value", a.Value) return json.Marshal(objectMap) @@ -342,7 +369,7 @@ func (a *AvailabilityGroupListenerListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AvailabilityGroupListenerProperties. func (a AvailabilityGroupListenerProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "availabilityGroupConfiguration", a.AvailabilityGroupConfiguration) populate(objectMap, "availabilityGroupName", a.AvailabilityGroupName) populate(objectMap, "createDefaultAvailabilityGroupIfNotExist", a.CreateDefaultAvailabilityGroupIfNotExist) @@ -393,7 +420,7 @@ func (a *AvailabilityGroupListenerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Group. func (g Group) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", g.ID) populate(objectMap, "location", g.Location) populate(objectMap, "name", g.Name) @@ -444,7 +471,7 @@ func (g *Group) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GroupListResult. func (g GroupListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", g.NextLink) populate(objectMap, "value", g.Value) return json.Marshal(objectMap) @@ -475,7 +502,7 @@ func (g *GroupListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GroupProperties. func (g GroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clusterConfiguration", g.ClusterConfiguration) populate(objectMap, "clusterManagerType", g.ClusterManagerType) populate(objectMap, "provisioningState", g.ProvisioningState) @@ -526,7 +553,7 @@ func (g *GroupProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GroupUpdate. func (g GroupUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "tags", g.Tags) return json.Marshal(objectMap) } @@ -553,7 +580,7 @@ func (g *GroupUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type KeyVaultCredentialSettings. func (k KeyVaultCredentialSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "azureKeyVaultUrl", k.AzureKeyVaultURL) populate(objectMap, "credentialName", k.CredentialName) populate(objectMap, "enable", k.Enable) @@ -596,7 +623,7 @@ func (k *KeyVaultCredentialSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ListResult. func (l ListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) @@ -627,7 +654,7 @@ func (l *ListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LoadBalancerConfiguration. func (l LoadBalancerConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "loadBalancerResourceId", l.LoadBalancerResourceID) populate(objectMap, "privateIpAddress", l.PrivateIPAddress) populate(objectMap, "probePort", l.ProbePort) @@ -670,7 +697,7 @@ func (l *LoadBalancerConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MultiSubnetIPConfiguration. func (m MultiSubnetIPConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "privateIpAddress", m.PrivateIPAddress) populate(objectMap, "sqlVirtualMachineInstance", m.SQLVirtualMachineInstance) return json.Marshal(objectMap) @@ -701,7 +728,7 @@ func (m *MultiSubnetIPConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "display", o.Display) populate(objectMap, "name", o.Name) populate(objectMap, "origin", o.Origin) @@ -740,7 +767,7 @@ func (o *Operation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationDisplay. func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", o.Description) populate(objectMap, "operation", o.Operation) populate(objectMap, "provider", o.Provider) @@ -779,7 +806,7 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationListResult. func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) @@ -810,7 +837,7 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateIPAddress. func (p PrivateIPAddress) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "ipAddress", p.IPAddress) populate(objectMap, "subnetResourceId", p.SubnetResourceID) return json.Marshal(objectMap) @@ -841,7 +868,7 @@ func (p *PrivateIPAddress) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Properties. func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "assessmentSettings", p.AssessmentSettings) populate(objectMap, "autoBackupSettings", p.AutoBackupSettings) populate(objectMap, "autoPatchingSettings", p.AutoPatchingSettings) @@ -856,6 +883,7 @@ func (p Properties) MarshalJSON() ([]byte, error) { populate(objectMap, "sqlVirtualMachineGroupResourceId", p.SQLVirtualMachineGroupResourceID) populate(objectMap, "serverConfigurationsManagementSettings", p.ServerConfigurationsManagementSettings) populate(objectMap, "storageConfigurationSettings", p.StorageConfigurationSettings) + populate(objectMap, "troubleshootingStatus", p.TroubleshootingStatus) populate(objectMap, "virtualMachineResourceId", p.VirtualMachineResourceID) populate(objectMap, "wsfcDomainCredentials", p.WsfcDomainCredentials) populate(objectMap, "wsfcStaticIp", p.WsfcStaticIP) @@ -913,6 +941,9 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "storageConfigurationSettings": err = unpopulate(val, "StorageConfigurationSettings", &p.StorageConfigurationSettings) delete(rawMsg, key) + case "troubleshootingStatus": + err = unpopulate(val, "TroubleshootingStatus", &p.TroubleshootingStatus) + delete(rawMsg, key) case "virtualMachineResourceId": err = unpopulate(val, "VirtualMachineResourceID", &p.VirtualMachineResourceID) delete(rawMsg, key) @@ -932,7 +963,7 @@ func (p *Properties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceIdentity. func (r ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "principalId", r.PrincipalID) populate(objectMap, "tenantId", r.TenantID) populate(objectMap, "type", r.Type) @@ -967,7 +998,7 @@ func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SQLConnectivityUpdateSettings. func (s SQLConnectivityUpdateSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "connectivityType", s.ConnectivityType) populate(objectMap, "port", s.Port) populate(objectMap, "sqlAuthUpdatePassword", s.SQLAuthUpdatePassword) @@ -1006,7 +1037,7 @@ func (s *SQLConnectivityUpdateSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SQLInstanceSettings. func (s SQLInstanceSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "collation", s.Collation) populate(objectMap, "isIfiEnabled", s.IsIfiEnabled) populate(objectMap, "isLpimEnabled", s.IsLpimEnabled) @@ -1057,7 +1088,7 @@ func (s *SQLInstanceSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SQLStorageSettings. func (s SQLStorageSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "defaultFilePath", s.DefaultFilePath) populate(objectMap, "luns", s.Luns) return json.Marshal(objectMap) @@ -1088,7 +1119,7 @@ func (s *SQLStorageSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SQLStorageUpdateSettings. func (s SQLStorageUpdateSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskConfigurationType", s.DiskConfigurationType) populate(objectMap, "diskCount", s.DiskCount) populate(objectMap, "startingDeviceId", s.StartingDeviceID) @@ -1123,7 +1154,7 @@ func (s *SQLStorageUpdateSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SQLTempDbSettings. func (s SQLTempDbSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dataFileCount", s.DataFileCount) populate(objectMap, "dataFileSize", s.DataFileSize) populate(objectMap, "dataGrowth", s.DataGrowth) @@ -1180,9 +1211,52 @@ func (s *SQLTempDbSettings) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SQLVMTroubleshooting. +func (s SQLVMTroubleshooting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endTimeUtc", s.EndTimeUTC) + populate(objectMap, "properties", s.Properties) + populateTimeRFC3339(objectMap, "startTimeUtc", s.StartTimeUTC) + populate(objectMap, "troubleshootingScenario", s.TroubleshootingScenario) + populate(objectMap, "virtualMachineResourceId", s.VirtualMachineResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLVMTroubleshooting. +func (s *SQLVMTroubleshooting) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &s.EndTimeUTC) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &s.StartTimeUTC) + delete(rawMsg, key) + case "troubleshootingScenario": + err = unpopulate(val, "TroubleshootingScenario", &s.TroubleshootingScenario) + delete(rawMsg, key) + case "virtualMachineResourceId": + err = unpopulate(val, "VirtualMachineResourceID", &s.VirtualMachineResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SQLVirtualMachine. func (s SQLVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "identity", s.Identity) populate(objectMap, "location", s.Location) @@ -1237,7 +1311,7 @@ func (s *SQLVirtualMachine) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SQLWorkloadTypeUpdateSettings. func (s SQLWorkloadTypeUpdateSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "sqlWorkloadType", s.SQLWorkloadType) return json.Marshal(objectMap) } @@ -1264,7 +1338,7 @@ func (s *SQLWorkloadTypeUpdateSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Schedule. func (s Schedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "dayOfWeek", s.DayOfWeek) populate(objectMap, "enable", s.Enable) populate(objectMap, "monthlyOccurrence", s.MonthlyOccurrence) @@ -1307,8 +1381,9 @@ func (s *Schedule) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServerConfigurationsManagementSettings. func (s ServerConfigurationsManagementSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalFeaturesServerConfigurations", s.AdditionalFeaturesServerConfigurations) + populate(objectMap, "azureAdAuthenticationSettings", s.AzureAdAuthenticationSettings) populate(objectMap, "sqlConnectivityUpdateSettings", s.SQLConnectivityUpdateSettings) populate(objectMap, "sqlInstanceSettings", s.SQLInstanceSettings) populate(objectMap, "sqlStorageUpdateSettings", s.SQLStorageUpdateSettings) @@ -1328,6 +1403,9 @@ func (s *ServerConfigurationsManagementSettings) UnmarshalJSON(data []byte) erro case "additionalFeaturesServerConfigurations": err = unpopulate(val, "AdditionalFeaturesServerConfigurations", &s.AdditionalFeaturesServerConfigurations) delete(rawMsg, key) + case "azureAdAuthenticationSettings": + err = unpopulate(val, "AzureAdAuthenticationSettings", &s.AzureAdAuthenticationSettings) + delete(rawMsg, key) case "sqlConnectivityUpdateSettings": err = unpopulate(val, "SQLConnectivityUpdateSettings", &s.SQLConnectivityUpdateSettings) delete(rawMsg, key) @@ -1350,7 +1428,7 @@ func (s *ServerConfigurationsManagementSettings) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type StorageConfigurationSettings. func (s StorageConfigurationSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "diskConfigurationType", s.DiskConfigurationType) populate(objectMap, "sqlDataSettings", s.SQLDataSettings) populate(objectMap, "sqlLogSettings", s.SQLLogSettings) @@ -1397,7 +1475,7 @@ func (s *StorageConfigurationSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) @@ -1442,9 +1520,110 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingAdditionalProperties. +func (t TroubleshootingAdditionalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "unhealthyReplicaInfo", t.UnhealthyReplicaInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingAdditionalProperties. +func (t *TroubleshootingAdditionalProperties) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "unhealthyReplicaInfo": + err = unpopulate(val, "UnhealthyReplicaInfo", &t.UnhealthyReplicaInfo) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TroubleshootingStatus. +func (t TroubleshootingStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "endTimeUtc", t.EndTimeUTC) + populateTimeRFC3339(objectMap, "lastTriggerTimeUtc", t.LastTriggerTimeUTC) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "rootCause", t.RootCause) + populateTimeRFC3339(objectMap, "startTimeUtc", t.StartTimeUTC) + populate(objectMap, "troubleshootingScenario", t.TroubleshootingScenario) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TroubleshootingStatus. +func (t *TroubleshootingStatus) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &t.EndTimeUTC) + delete(rawMsg, key) + case "lastTriggerTimeUtc": + err = unpopulateTimeRFC3339(val, "LastTriggerTimeUTC", &t.LastTriggerTimeUTC) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "rootCause": + err = unpopulate(val, "RootCause", &t.RootCause) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &t.StartTimeUTC) + delete(rawMsg, key) + case "troubleshootingScenario": + err = unpopulate(val, "TroubleshootingScenario", &t.TroubleshootingScenario) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UnhealthyReplicaInfo. +func (u UnhealthyReplicaInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "availabilityGroupName", u.AvailabilityGroupName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UnhealthyReplicaInfo. +func (u *UnhealthyReplicaInfo) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityGroupName": + err = unpopulate(val, "AvailabilityGroupName", &u.AvailabilityGroupName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Update. func (u Update) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "tags", u.Tags) return json.Marshal(objectMap) } @@ -1471,7 +1650,7 @@ func (u *Update) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WsfcDomainCredentials. func (w WsfcDomainCredentials) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clusterBootstrapAccountPassword", w.ClusterBootstrapAccountPassword) populate(objectMap, "clusterOperatorAccountPassword", w.ClusterOperatorAccountPassword) populate(objectMap, "sqlServiceAccountPassword", w.SQLServiceAccountPassword) @@ -1506,7 +1685,7 @@ func (w *WsfcDomainCredentials) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type WsfcDomainProfile. func (w WsfcDomainProfile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clusterBootstrapAccount", w.ClusterBootstrapAccount) populate(objectMap, "clusterOperatorAccount", w.ClusterOperatorAccount) populate(objectMap, "clusterSubnetType", w.ClusterSubnetType) @@ -1563,7 +1742,7 @@ func (w *WsfcDomainProfile) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -1573,7 +1752,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go index 8796edc6a6ba..5f57ddd1559d 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client.go @@ -28,8 +28,8 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -50,8 +50,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available SQL Virtual Machine Rest API operations. -// Generated from API version 2022-07-01-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2022-08-01-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]{ More: func(page OperationsClientListResponse) bool { @@ -88,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go deleted file mode 100644 index dae17c934bac..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/operations_client_example_test.go +++ /dev/null @@ -1,41 +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. - -package armsqlvirtualmachine_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListOperation.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go index 51b028b96de8..e01022780bf5 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/response_types.go @@ -9,12 +9,12 @@ package armsqlvirtualmachine -// AvailabilityGroupListenersClientCreateOrUpdateResponse contains the response from method AvailabilityGroupListenersClient.CreateOrUpdate. +// AvailabilityGroupListenersClientCreateOrUpdateResponse contains the response from method AvailabilityGroupListenersClient.BeginCreateOrUpdate. type AvailabilityGroupListenersClientCreateOrUpdateResponse struct { AvailabilityGroupListener } -// AvailabilityGroupListenersClientDeleteResponse contains the response from method AvailabilityGroupListenersClient.Delete. +// AvailabilityGroupListenersClientDeleteResponse contains the response from method AvailabilityGroupListenersClient.BeginDelete. type AvailabilityGroupListenersClientDeleteResponse struct { // placeholder for future response values } @@ -24,17 +24,17 @@ type AvailabilityGroupListenersClientGetResponse struct { AvailabilityGroupListener } -// AvailabilityGroupListenersClientListByGroupResponse contains the response from method AvailabilityGroupListenersClient.ListByGroup. +// AvailabilityGroupListenersClientListByGroupResponse contains the response from method AvailabilityGroupListenersClient.NewListByGroupPager. type AvailabilityGroupListenersClientListByGroupResponse struct { AvailabilityGroupListenerListResult } -// GroupsClientCreateOrUpdateResponse contains the response from method GroupsClient.CreateOrUpdate. +// GroupsClientCreateOrUpdateResponse contains the response from method GroupsClient.BeginCreateOrUpdate. type GroupsClientCreateOrUpdateResponse struct { Group } -// GroupsClientDeleteResponse contains the response from method GroupsClient.Delete. +// GroupsClientDeleteResponse contains the response from method GroupsClient.BeginDelete. type GroupsClientDeleteResponse struct { // placeholder for future response values } @@ -44,32 +44,32 @@ type GroupsClientGetResponse struct { Group } -// GroupsClientListByResourceGroupResponse contains the response from method GroupsClient.ListByResourceGroup. +// GroupsClientListByResourceGroupResponse contains the response from method GroupsClient.NewListByResourceGroupPager. type GroupsClientListByResourceGroupResponse struct { GroupListResult } -// GroupsClientListResponse contains the response from method GroupsClient.List. +// GroupsClientListResponse contains the response from method GroupsClient.NewListPager. type GroupsClientListResponse struct { GroupListResult } -// GroupsClientUpdateResponse contains the response from method GroupsClient.Update. +// GroupsClientUpdateResponse contains the response from method GroupsClient.BeginUpdate. type GroupsClientUpdateResponse struct { Group } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationListResult } -// SQLVirtualMachinesClientCreateOrUpdateResponse contains the response from method SQLVirtualMachinesClient.CreateOrUpdate. +// SQLVirtualMachinesClientCreateOrUpdateResponse contains the response from method SQLVirtualMachinesClient.BeginCreateOrUpdate. type SQLVirtualMachinesClientCreateOrUpdateResponse struct { SQLVirtualMachine } -// SQLVirtualMachinesClientDeleteResponse contains the response from method SQLVirtualMachinesClient.Delete. +// SQLVirtualMachinesClientDeleteResponse contains the response from method SQLVirtualMachinesClient.BeginDelete. type SQLVirtualMachinesClientDeleteResponse struct { // placeholder for future response values } @@ -79,32 +79,37 @@ type SQLVirtualMachinesClientGetResponse struct { SQLVirtualMachine } -// SQLVirtualMachinesClientListByResourceGroupResponse contains the response from method SQLVirtualMachinesClient.ListByResourceGroup. +// SQLVirtualMachinesClientListByResourceGroupResponse contains the response from method SQLVirtualMachinesClient.NewListByResourceGroupPager. type SQLVirtualMachinesClientListByResourceGroupResponse struct { ListResult } -// SQLVirtualMachinesClientListBySQLVMGroupResponse contains the response from method SQLVirtualMachinesClient.ListBySQLVMGroup. +// SQLVirtualMachinesClientListBySQLVMGroupResponse contains the response from method SQLVirtualMachinesClient.NewListBySQLVMGroupPager. type SQLVirtualMachinesClientListBySQLVMGroupResponse struct { ListResult } -// SQLVirtualMachinesClientListResponse contains the response from method SQLVirtualMachinesClient.List. +// SQLVirtualMachinesClientListResponse contains the response from method SQLVirtualMachinesClient.NewListPager. type SQLVirtualMachinesClientListResponse struct { ListResult } -// SQLVirtualMachinesClientRedeployResponse contains the response from method SQLVirtualMachinesClient.Redeploy. +// SQLVirtualMachinesClientRedeployResponse contains the response from method SQLVirtualMachinesClient.BeginRedeploy. type SQLVirtualMachinesClientRedeployResponse struct { // placeholder for future response values } -// SQLVirtualMachinesClientStartAssessmentResponse contains the response from method SQLVirtualMachinesClient.StartAssessment. +// SQLVirtualMachinesClientStartAssessmentResponse contains the response from method SQLVirtualMachinesClient.BeginStartAssessment. type SQLVirtualMachinesClientStartAssessmentResponse struct { // placeholder for future response values } -// SQLVirtualMachinesClientUpdateResponse contains the response from method SQLVirtualMachinesClient.Update. +// SQLVirtualMachinesClientUpdateResponse contains the response from method SQLVirtualMachinesClient.BeginUpdate. type SQLVirtualMachinesClientUpdateResponse struct { SQLVirtualMachine } + +// TroubleshootClientTroubleshootResponse contains the response from method TroubleshootClient.BeginTroubleshoot. +type TroubleshootClientTroubleshootResponse struct { + SQLVMTroubleshooting +} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go index 08306e25cb8c..7c1e6483a6e1 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client.go @@ -32,9 +32,9 @@ type SQLVirtualMachinesClient struct { } // NewSQLVirtualMachinesClient creates a new instance of SQLVirtualMachinesClient with the specified values. -// subscriptionID - Subscription ID that identifies an Azure subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - subscriptionID - Subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewSQLVirtualMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVirtualMachinesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,20 +57,23 @@ func NewSQLVirtualMachinesClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Creates or updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineName - Name of the SQL virtual machine. -// parameters - The SQL virtual machine. -// options - SQLVirtualMachinesClientBeginCreateOrUpdateOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineName - Name of the SQL virtual machine. +// - parameters - The SQL virtual machine. +// - options - SQLVirtualMachinesClientBeginCreateOrUpdateOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginCreateOrUpdate +// method. func (client *SQLVirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVirtualMachine, options *SQLVirtualMachinesClientBeginCreateOrUpdateOptions) (*runtime.Poller[SQLVirtualMachinesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -78,7 +81,8 @@ func (client *SQLVirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Creates or updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVirtualMachine, options *SQLVirtualMachinesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) if err != nil { @@ -114,7 +118,7 @@ func (client *SQLVirtualMachinesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -122,19 +126,22 @@ func (client *SQLVirtualMachinesClient) createOrUpdateCreateRequest(ctx context. // BeginDelete - Deletes a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineName - Name of the SQL virtual machine. -// options - SQLVirtualMachinesClientBeginDeleteOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginDelete -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineName - Name of the SQL virtual machine. +// - options - SQLVirtualMachinesClientBeginDeleteOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginDelete +// method. func (client *SQLVirtualMachinesClient) BeginDelete(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginDeleteOptions) (*runtime.Poller[SQLVirtualMachinesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientDeleteResponse](options.ResumeToken, client.pl, nil) } @@ -142,7 +149,8 @@ func (client *SQLVirtualMachinesClient) BeginDelete(ctx context.Context, resourc // Delete - Deletes a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -178,18 +186,20 @@ func (client *SQLVirtualMachinesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineName - Name of the SQL virtual machine. -// options - SQLVirtualMachinesClientGetOptions contains the optional parameters for the SQLVirtualMachinesClient.Get method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineName - Name of the SQL virtual machine. +// - options - SQLVirtualMachinesClientGetOptions contains the optional parameters for the SQLVirtualMachinesClient.Get method. func (client *SQLVirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientGetOptions) (SQLVirtualMachinesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -228,7 +238,7 @@ func (client *SQLVirtualMachinesClient) getCreateRequest(ctx context.Context, re if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -244,8 +254,10 @@ func (client *SQLVirtualMachinesClient) getHandleResponse(resp *http.Response) ( } // NewListPager - Gets all SQL virtual machines in a subscription. -// Generated from API version 2022-07-01-preview -// options - SQLVirtualMachinesClientListOptions contains the optional parameters for the SQLVirtualMachinesClient.List method. +// +// Generated from API version 2022-08-01-preview +// - options - SQLVirtualMachinesClientListOptions contains the optional parameters for the SQLVirtualMachinesClient.NewListPager +// method. func (client *SQLVirtualMachinesClient) NewListPager(options *SQLVirtualMachinesClientListOptions) *runtime.Pager[SQLVirtualMachinesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SQLVirtualMachinesClientListResponse]{ More: func(page SQLVirtualMachinesClientListResponse) bool { @@ -286,7 +298,7 @@ func (client *SQLVirtualMachinesClient) listCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -302,11 +314,12 @@ func (client *SQLVirtualMachinesClient) listHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Gets all SQL virtual machines in a resource group. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// options - SQLVirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.ListByResourceGroup -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - options - SQLVirtualMachinesClientListByResourceGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.NewListByResourceGroupPager +// method. func (client *SQLVirtualMachinesClient) NewListByResourceGroupPager(resourceGroupName string, options *SQLVirtualMachinesClientListByResourceGroupOptions) *runtime.Pager[SQLVirtualMachinesClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[SQLVirtualMachinesClientListByResourceGroupResponse]{ More: func(page SQLVirtualMachinesClientListByResourceGroupResponse) bool { @@ -351,7 +364,7 @@ func (client *SQLVirtualMachinesClient) listByResourceGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -367,12 +380,13 @@ func (client *SQLVirtualMachinesClient) listByResourceGroupHandleResponse(resp * } // NewListBySQLVMGroupPager - Gets the list of sql virtual machines in a SQL virtual machine group. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineGroupName - Name of the SQL virtual machine group. -// options - SQLVirtualMachinesClientListBySQLVMGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.ListBySQLVMGroup -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineGroupName - Name of the SQL virtual machine group. +// - options - SQLVirtualMachinesClientListBySQLVMGroupOptions contains the optional parameters for the SQLVirtualMachinesClient.NewListBySQLVMGroupPager +// method. func (client *SQLVirtualMachinesClient) NewListBySQLVMGroupPager(resourceGroupName string, sqlVirtualMachineGroupName string, options *SQLVirtualMachinesClientListBySQLVMGroupOptions) *runtime.Pager[SQLVirtualMachinesClientListBySQLVMGroupResponse] { return runtime.NewPager(runtime.PagingHandler[SQLVirtualMachinesClientListBySQLVMGroupResponse]{ More: func(page SQLVirtualMachinesClientListBySQLVMGroupResponse) bool { @@ -421,7 +435,7 @@ func (client *SQLVirtualMachinesClient) listBySQLVMGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -436,29 +450,33 @@ func (client *SQLVirtualMachinesClient) listBySQLVMGroupHandleResponse(resp *htt return result, nil } -// BeginRedeploy - Uninstalls and reinstalls the SQL Iaas Extension. +// BeginRedeploy - Uninstalls and reinstalls the SQL IaaS Extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineName - Name of the SQL virtual machine. -// options - SQLVirtualMachinesClientBeginRedeployOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginRedeploy -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineName - Name of the SQL virtual machine. +// - options - SQLVirtualMachinesClientBeginRedeployOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginRedeploy +// method. func (client *SQLVirtualMachinesClient) BeginRedeploy(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginRedeployOptions) (*runtime.Poller[SQLVirtualMachinesClientRedeployResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.redeploy(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientRedeployResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientRedeployResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientRedeployResponse](options.ResumeToken, client.pl, nil) } } -// Redeploy - Uninstalls and reinstalls the SQL Iaas Extension. +// Redeploy - Uninstalls and reinstalls the SQL IaaS Extension. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -494,34 +512,39 @@ func (client *SQLVirtualMachinesClient) redeployCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// BeginStartAssessment - Starts Assessment on SQL virtual machine. +// BeginStartAssessment - Starts SQL best practices Assessment on SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineName - Name of the SQL virtual machine. -// options - SQLVirtualMachinesClientBeginStartAssessmentOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginStartAssessment -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineName - Name of the SQL virtual machine. +// - options - SQLVirtualMachinesClientBeginStartAssessmentOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginStartAssessment +// method. func (client *SQLVirtualMachinesClient) BeginStartAssessment(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginStartAssessmentOptions) (*runtime.Poller[SQLVirtualMachinesClientStartAssessmentResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.startAssessment(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientStartAssessmentResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientStartAssessmentResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientStartAssessmentResponse](options.ResumeToken, client.pl, nil) } } -// StartAssessment - Starts Assessment on SQL virtual machine. +// StartAssessment - Starts SQL best practices Assessment on SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) startAssessment(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, options *SQLVirtualMachinesClientBeginStartAssessmentOptions) (*http.Response, error) { req, err := client.startAssessmentCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, options) if err != nil { @@ -557,27 +580,31 @@ func (client *SQLVirtualMachinesClient) startAssessmentCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginUpdate - Updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview -// resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource -// Manager API or the portal. -// sqlVirtualMachineName - Name of the SQL virtual machine. -// parameters - The SQL virtual machine. -// options - SQLVirtualMachinesClientBeginUpdateOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginUpdate -// method. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineName - Name of the SQL virtual machine. +// - parameters - The SQL virtual machine. +// - options - SQLVirtualMachinesClientBeginUpdateOptions contains the optional parameters for the SQLVirtualMachinesClient.BeginUpdate +// method. func (client *SQLVirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters Update, options *SQLVirtualMachinesClientBeginUpdateOptions) (*runtime.Poller[SQLVirtualMachinesClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[SQLVirtualMachinesClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SQLVirtualMachinesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[SQLVirtualMachinesClientUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -585,7 +612,8 @@ func (client *SQLVirtualMachinesClient) BeginUpdate(ctx context.Context, resourc // Update - Updates a SQL virtual machine. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-07-01-preview +// +// Generated from API version 2022-08-01-preview func (client *SQLVirtualMachinesClient) update(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters Update, options *SQLVirtualMachinesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) if err != nil { @@ -621,7 +649,7 @@ func (client *SQLVirtualMachinesClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-07-01-preview") + reqQP.Set("api-version", "2022-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go deleted file mode 100644 index 42956b4e6c4a..000000000000 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/sqlvirtualmachines_client_example_test.go +++ /dev/null @@ -1,520 +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. - -package armsqlvirtualmachine_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/sqlvirtualmachine/armsqlvirtualmachine" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListBySqlVirtualMachineGroupSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_NewListBySQLVMGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySQLVMGroupPager("testrg", "testvm", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListSubscriptionSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/StartAssessmentOnSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginStartAssessment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStartAssessment(ctx, "testrg", "testvm", 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/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/RedeploySqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginRedeploy() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRedeploy(ctx, "testrg", "testvm", 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/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/GetSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "testrg", "testvm", &armsqlvirtualmachine.SQLVirtualMachinesClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateVirtualMachineWithVMGroup.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineAndJoinsItToASqlVirtualMachineGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - SQLVirtualMachineGroupResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachineGroups/testvmgroup"), - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm2"), - WsfcDomainCredentials: &armsqlvirtualmachine.WsfcDomainCredentials{ - ClusterBootstrapAccountPassword: to.Ptr(""), - ClusterOperatorAccountPassword: to.Ptr(""), - SQLServiceAccountPassword: to.Ptr(""), - }, - WsfcStaticIP: to.Ptr("10.0.0.7"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineAutomatedBackupWeekly.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForAutomatedBackUpSettingsWithWeeklyAndDaysOfTheWeekToRunTheBackUp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - AutoBackupSettings: &armsqlvirtualmachine.AutoBackupSettings{ - BackupScheduleType: to.Ptr(armsqlvirtualmachine.BackupScheduleTypeManual), - BackupSystemDbs: to.Ptr(true), - DaysOfWeek: []*armsqlvirtualmachine.AutoBackupDaysOfWeek{ - to.Ptr(armsqlvirtualmachine.AutoBackupDaysOfWeekMonday), - to.Ptr(armsqlvirtualmachine.AutoBackupDaysOfWeekFriday)}, - Enable: to.Ptr(true), - EnableEncryption: to.Ptr(true), - FullBackupFrequency: to.Ptr(armsqlvirtualmachine.FullBackupFrequencyTypeWeekly), - FullBackupStartTime: to.Ptr[int32](6), - FullBackupWindowHours: to.Ptr[int32](11), - LogBackupFrequency: to.Ptr[int32](10), - Password: to.Ptr(""), - RetentionPeriod: to.Ptr[int32](17), - StorageAccessKey: to.Ptr(""), - StorageAccountURL: to.Ptr("https://teststorage.blob.core.windows.net/"), - StorageContainerName: to.Ptr("testcontainer"), - }, - AutoPatchingSettings: &armsqlvirtualmachine.AutoPatchingSettings{ - DayOfWeek: to.Ptr(armsqlvirtualmachine.DayOfWeekSunday), - Enable: to.Ptr(true), - MaintenanceWindowDuration: to.Ptr[int32](60), - MaintenanceWindowStartingHour: to.Ptr[int32](2), - }, - KeyVaultCredentialSettings: &armsqlvirtualmachine.KeyVaultCredentialSettings{ - Enable: to.Ptr(false), - }, - ServerConfigurationsManagementSettings: &armsqlvirtualmachine.ServerConfigurationsManagementSettings{ - AdditionalFeaturesServerConfigurations: &armsqlvirtualmachine.AdditionalFeaturesServerConfigurations{ - IsRServicesEnabled: to.Ptr(false), - }, - SQLConnectivityUpdateSettings: &armsqlvirtualmachine.SQLConnectivityUpdateSettings{ - ConnectivityType: to.Ptr(armsqlvirtualmachine.ConnectivityTypePRIVATE), - Port: to.Ptr[int32](1433), - SQLAuthUpdatePassword: to.Ptr(""), - SQLAuthUpdateUserName: to.Ptr("sqllogin"), - }, - SQLStorageUpdateSettings: &armsqlvirtualmachine.SQLStorageUpdateSettings{ - DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), - DiskCount: to.Ptr[int32](1), - StartingDeviceID: to.Ptr[int32](2), - }, - SQLWorkloadTypeUpdateSettings: &armsqlvirtualmachine.SQLWorkloadTypeUpdateSettings{ - SQLWorkloadType: to.Ptr(armsqlvirtualmachine.SQLWorkloadTypeOLTP), - }, - }, - SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLImageSKUEnterprise), - SQLManagement: to.Ptr(armsqlvirtualmachine.SQLManagementModeFull), - SQLServerLicenseType: to.Ptr(armsqlvirtualmachine.SQLServerLicenseTypePAYG), - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationEXTEND.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForStorageConfigurationSettingsToExtendDataLogOrTempDbStoragePool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - StorageConfigurationSettings: &armsqlvirtualmachine.StorageConfigurationSettings{ - DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeEXTEND), - SQLDataSettings: &armsqlvirtualmachine.SQLStorageSettings{ - Luns: []*int32{ - to.Ptr[int32](2)}, - }, - }, - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineStorageConfigurationNEW.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineForStorageConfigurationSettingsToNewDataLogAndTempDbStoragePool() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - StorageConfigurationSettings: &armsqlvirtualmachine.StorageConfigurationSettings{ - DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), - SQLDataSettings: &armsqlvirtualmachine.SQLStorageSettings{ - DefaultFilePath: to.Ptr("F:\\folderpath\\"), - Luns: []*int32{ - to.Ptr[int32](0)}, - }, - SQLLogSettings: &armsqlvirtualmachine.SQLStorageSettings{ - DefaultFilePath: to.Ptr("G:\\folderpath\\"), - Luns: []*int32{ - to.Ptr[int32](1)}, - }, - SQLSystemDbOnDataDisk: to.Ptr(true), - SQLTempDbSettings: &armsqlvirtualmachine.SQLTempDbSettings{ - DataFileCount: to.Ptr[int32](8), - DataFileSize: to.Ptr[int32](256), - DataGrowth: to.Ptr[int32](512), - DefaultFilePath: to.Ptr("D:\\TEMP"), - LogFileSize: to.Ptr[int32](256), - LogGrowth: to.Ptr[int32](512), - }, - StorageWorkloadType: to.Ptr(armsqlvirtualmachine.StorageWorkloadTypeOLTP), - }, - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineMAX.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineWithMaxParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - AssessmentSettings: &armsqlvirtualmachine.AssessmentSettings{ - Enable: to.Ptr(true), - RunImmediately: to.Ptr(true), - Schedule: &armsqlvirtualmachine.Schedule{ - DayOfWeek: to.Ptr(armsqlvirtualmachine.AssessmentDayOfWeekSunday), - Enable: to.Ptr(true), - StartTime: to.Ptr("23:17"), - WeeklyInterval: to.Ptr[int32](1), - }, - }, - AutoBackupSettings: &armsqlvirtualmachine.AutoBackupSettings{ - BackupScheduleType: to.Ptr(armsqlvirtualmachine.BackupScheduleTypeManual), - BackupSystemDbs: to.Ptr(true), - Enable: to.Ptr(true), - EnableEncryption: to.Ptr(true), - FullBackupFrequency: to.Ptr(armsqlvirtualmachine.FullBackupFrequencyTypeDaily), - FullBackupStartTime: to.Ptr[int32](6), - FullBackupWindowHours: to.Ptr[int32](11), - LogBackupFrequency: to.Ptr[int32](10), - Password: to.Ptr(""), - RetentionPeriod: to.Ptr[int32](17), - StorageAccessKey: to.Ptr(""), - StorageAccountURL: to.Ptr("https://teststorage.blob.core.windows.net/"), - StorageContainerName: to.Ptr("testcontainer"), - }, - AutoPatchingSettings: &armsqlvirtualmachine.AutoPatchingSettings{ - DayOfWeek: to.Ptr(armsqlvirtualmachine.DayOfWeekSunday), - Enable: to.Ptr(true), - MaintenanceWindowDuration: to.Ptr[int32](60), - MaintenanceWindowStartingHour: to.Ptr[int32](2), - }, - EnableAutomaticUpgrade: to.Ptr(true), - KeyVaultCredentialSettings: &armsqlvirtualmachine.KeyVaultCredentialSettings{ - Enable: to.Ptr(false), - }, - LeastPrivilegeMode: to.Ptr(armsqlvirtualmachine.LeastPrivilegeModeEnabled), - ServerConfigurationsManagementSettings: &armsqlvirtualmachine.ServerConfigurationsManagementSettings{ - AdditionalFeaturesServerConfigurations: &armsqlvirtualmachine.AdditionalFeaturesServerConfigurations{ - IsRServicesEnabled: to.Ptr(false), - }, - SQLConnectivityUpdateSettings: &armsqlvirtualmachine.SQLConnectivityUpdateSettings{ - ConnectivityType: to.Ptr(armsqlvirtualmachine.ConnectivityTypePRIVATE), - Port: to.Ptr[int32](1433), - SQLAuthUpdatePassword: to.Ptr(""), - SQLAuthUpdateUserName: to.Ptr("sqllogin"), - }, - SQLInstanceSettings: &armsqlvirtualmachine.SQLInstanceSettings{ - Collation: to.Ptr("SQL_Latin1_General_CP1_CI_AS"), - IsIfiEnabled: to.Ptr(true), - IsLpimEnabled: to.Ptr(true), - IsOptimizeForAdHocWorkloadsEnabled: to.Ptr(true), - MaxDop: to.Ptr[int32](8), - MaxServerMemoryMB: to.Ptr[int32](128), - MinServerMemoryMB: to.Ptr[int32](0), - }, - SQLStorageUpdateSettings: &armsqlvirtualmachine.SQLStorageUpdateSettings{ - DiskConfigurationType: to.Ptr(armsqlvirtualmachine.DiskConfigurationTypeNEW), - DiskCount: to.Ptr[int32](1), - StartingDeviceID: to.Ptr[int32](2), - }, - SQLWorkloadTypeUpdateSettings: &armsqlvirtualmachine.SQLWorkloadTypeUpdateSettings{ - SQLWorkloadType: to.Ptr(armsqlvirtualmachine.SQLWorkloadTypeOLTP), - }, - }, - SQLImageSKU: to.Ptr(armsqlvirtualmachine.SQLImageSKUEnterprise), - SQLManagement: to.Ptr(armsqlvirtualmachine.SQLManagementModeFull), - SQLServerLicenseType: to.Ptr(armsqlvirtualmachine.SQLServerLicenseTypePAYG), - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/CreateOrUpdateSqlVirtualMachineMIN.json -func ExampleSQLVirtualMachinesClient_BeginCreateOrUpdate_createsOrUpdatesASqlVirtualMachineWithMinParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.SQLVirtualMachine{ - Location: to.Ptr("northeurope"), - Properties: &armsqlvirtualmachine.Properties{ - VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.Compute/virtualMachines/testvm"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/DeleteSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "testrg", "testvm1", 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/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/UpdateSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "testrg", "testvm", armsqlvirtualmachine.Update{ - Tags: map[string]*string{ - "mytag": to.Ptr("myval"), - }, - }, 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/preview/2022-07-01-preview/examples/ListByResourceGroupSqlVirtualMachine.json -func ExampleSQLVirtualMachinesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsqlvirtualmachine.NewSQLVirtualMachinesClient("00000000-1111-2222-3333-444444444444", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("testrg", nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/time_rfc3339.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/time_rfc3339.go index 6680b2257477..06aee44278ef 100644 --- a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/time_rfc3339.go +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/troubleshoot_client.go b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/troubleshoot_client.go new file mode 100644 index 000000000000..681e1e4d76f3 --- /dev/null +++ b/sdk/resourcemanager/sqlvirtualmachine/armsqlvirtualmachine/troubleshoot_client.go @@ -0,0 +1,125 @@ +//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 armsqlvirtualmachine + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TroubleshootClient contains the methods for the SQLVirtualMachineTroubleshoot group. +// Don't use this type directly, use NewTroubleshootClient() instead. +type TroubleshootClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewTroubleshootClient creates a new instance of TroubleshootClient with the specified values. +// - subscriptionID - Subscription ID that identifies an Azure subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTroubleshootClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TroubleshootClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &TroubleshootClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginTroubleshoot - Starts SQL virtual machine troubleshooting. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +// - resourceGroupName - Name of the resource group that contains the resource. You can obtain this value from the Azure Resource +// Manager API or the portal. +// - sqlVirtualMachineName - Name of the SQL virtual machine. +// - parameters - The SQL virtual machine troubleshooting entity. +// - options - TroubleshootClientBeginTroubleshootOptions contains the optional parameters for the TroubleshootClient.BeginTroubleshoot +// method. +func (client *TroubleshootClient) BeginTroubleshoot(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVMTroubleshooting, options *TroubleshootClientBeginTroubleshootOptions) (*runtime.Poller[TroubleshootClientTroubleshootResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.troubleshoot(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[TroubleshootClientTroubleshootResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[TroubleshootClientTroubleshootResponse](options.ResumeToken, client.pl, nil) + } +} + +// Troubleshoot - Starts SQL virtual machine troubleshooting. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2022-08-01-preview +func (client *TroubleshootClient) troubleshoot(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVMTroubleshooting, options *TroubleshootClientBeginTroubleshootOptions) (*http.Response, error) { + req, err := client.troubleshootCreateRequest(ctx, resourceGroupName, sqlVirtualMachineName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// troubleshootCreateRequest creates the Troubleshoot request. +func (client *TroubleshootClient) troubleshootCreateRequest(ctx context.Context, resourceGroupName string, sqlVirtualMachineName string, parameters SQLVMTroubleshooting, options *TroubleshootClientBeginTroubleshootOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SqlVirtualMachine/sqlVirtualMachines/{sqlVirtualMachineName}/troubleshoot" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if sqlVirtualMachineName == "" { + return nil, errors.New("parameter sqlVirtualMachineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sqlVirtualMachineName}", url.PathEscape(sqlVirtualMachineName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +}