From 799f5f3abf207139b28d495726b7d11b9a04e140 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 23 Oct 2023 02:38:40 +0000 Subject: [PATCH] CodeGen from PR 26191 in Azure/azure-rest-api-specs Merge 8e069352d3006fdab04af5527670aa9c49b4cff1 into 28c5aaa5810448fce57da7e47427259a0c8850bf --- .../mysql/armmysql/CHANGELOG.md | 4 + .../mysql/armmysql/advisors_client.go | 14 +- .../armmysql/advisors_client_example_test.go | 80 -- .../mysql/armmysql/autorest.md | 6 +- .../armmysql/checknameavailability_client.go | 19 +- ...ecknameavailability_client_example_test.go | 47 -- .../mysql/armmysql/client_factory.go | 107 ++- .../mysql/armmysql/configurations_client.go | 32 +- .../configurations_client_example_test.go | 707 ---------------- .../mysql/armmysql/constants.go | 13 +- .../mysql/armmysql/databases_client.go | 45 +- .../armmysql/databases_client_example_test.go | 153 ---- .../mysql/armmysql/firewallrules_client.go | 45 +- .../firewallrules_client_example_test.go | 153 ---- sdk/resourcemanager/mysql/armmysql/go.mod | 20 +- sdk/resourcemanager/mysql/armmysql/go.sum | 38 +- .../mysql/armmysql/interfaces.go | 19 + .../locationbasedperformancetier_client.go | 3 +- ...asedperformancetier_client_example_test.go | 206 ----- ...dedactionsessionsoperationstatus_client.go | 14 +- ...ionsoperationstatus_client_example_test.go | 43 - ...drecommendedactionsessionsresult_client.go | 3 +- ...ctionsessionsresult_client_example_test.go | 96 --- .../mysql/armmysql/logfiles_client.go | 3 +- .../armmysql/logfiles_client_example_test.go | 58 -- .../mysql/armmysql/management_client.go | 27 +- .../management_client_example_test.go | 63 -- sdk/resourcemanager/mysql/armmysql/models.go | 428 +--------- .../mysql/armmysql/models_serde.go | 3 +- .../mysql/armmysql/operations_client.go | 14 +- .../operations_client_example_test.go | 245 ------ sdk/resourcemanager/mysql/armmysql/options.go | 392 +++++++++ .../mysql/armmysql/polymorphic_helpers.go | 8 +- .../privateendpointconnections_client.go | 63 +- ...endpointconnections_client_example_test.go | 228 ------ .../armmysql/privatelinkresources_client.go | 14 +- ...rivatelinkresources_client_example_test.go | 86 -- .../mysql/armmysql/querytexts_client.go | 14 +- .../querytexts_client_example_test.go | 95 --- .../armmysql/recommendedactions_client.go | 14 +- .../recommendedactions_client_example_test.go | 141 ---- .../armmysql/recoverableservers_client.go | 14 +- .../recoverableservers_client_example_test.go | 51 -- .../mysql/armmysql/replicas_client.go | 3 +- .../armmysql/replicas_client_example_test.go | 139 ---- .../mysql/armmysql/response_types.go | 56 +- .../armmysql/serveradministrators_client.go | 45 +- ...erveradministrators_client_example_test.go | 152 ---- .../serverbasedperformancetier_client.go | 3 +- ...asedperformancetier_client_example_test.go | 206 ----- .../mysql/armmysql/serverkeys_client.go | 45 +- .../serverkeys_client_example_test.go | 150 ---- .../mysql/armmysql/serverparameters_client.go | 21 +- .../serverparameters_client_example_test.go | 71 -- .../mysql/armmysql/servers_client.go | 120 ++- .../armmysql/servers_client_example_test.go | 759 ------------------ .../serversecurityalertpolicies_client.go | 32 +- ...curityalertpolicies_client_example_test.go | 194 ----- .../mysql/armmysql/time_rfc3339.go | 3 +- .../armmysql/topquerystatistics_client.go | 19 +- .../topquerystatistics_client_example_test.go | 132 --- .../armmysql/virtualnetworkrules_client.go | 45 +- ...virtualnetworkrules_client_example_test.go | 156 ---- .../mysql/armmysql/waitstatistics_client.go | 19 +- .../waitstatistics_client_example_test.go | 123 --- 65 files changed, 994 insertions(+), 5327 deletions(-) delete mode 100644 sdk/resourcemanager/mysql/armmysql/advisors_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/checknameavailability_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/configurations_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/databases_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/firewallrules_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysql/interfaces.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/locationbasedperformancetier_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsoperationstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsresult_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/logfiles_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/management_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/operations_client_example_test.go create mode 100644 sdk/resourcemanager/mysql/armmysql/options.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/querytexts_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/recommendedactions_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/recoverableservers_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/replicas_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/serveradministrators_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/serverbasedperformancetier_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/serverkeys_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/serverparameters_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/servers_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/serversecurityalertpolicies_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/topquerystatistics_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/virtualnetworkrules_client_example_test.go delete mode 100644 sdk/resourcemanager/mysql/armmysql/waitstatistics_client_example_test.go diff --git a/sdk/resourcemanager/mysql/armmysql/CHANGELOG.md b/sdk/resourcemanager/mysql/armmysql/CHANGELOG.md index c766954e9165..b9e3db6d791b 100644 --- a/sdk/resourcemanager/mysql/armmysql/CHANGELOG.md +++ b/sdk/resourcemanager/mysql/armmysql/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.1.2 (2023-10-23) +### Other Changes + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/mysql/armmysql/advisors_client.go b/sdk/resourcemanager/mysql/armmysql/advisors_client.go index 1d3d1b284c15..9de8c5f8cb20 100644 --- a/sdk/resourcemanager/mysql/armmysql/advisors_client.go +++ b/sdk/resourcemanager/mysql/armmysql/advisors_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -53,18 +52,21 @@ func NewAdvisorsClient(subscriptionID string, credential azcore.TokenCredential, // - advisorName - The advisor name for recommendation action. // - options - AdvisorsClientGetOptions contains the optional parameters for the AdvisorsClient.Get method. func (client *AdvisorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string, options *AdvisorsClientGetOptions) (AdvisorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, advisorName, options) if err != nil { return AdvisorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return AdvisorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AdvisorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AdvisorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/advisors_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/advisors_client_example_test.go deleted file mode 100644 index 5644d7b186b2..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/advisors_client_example_test.go +++ /dev/null @@ -1,80 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/AdvisorsGet.json -func ExampleAdvisorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdvisorsClient().Get(ctx, "testResourceGroupName", "testServerName", "Index", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Advisor = armmysql.Advisor{ - // Name: to.Ptr("Index"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/advisors"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/advisors/Index"), - // Properties: map[string]any{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/AdvisorsListByServer.json -func ExampleAdvisorsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAdvisorsClient().NewListByServerPager("testResourceGroupName", "testServerName", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AdvisorsResultList = armmysql.AdvisorsResultList{ - // Value: []*armmysql.Advisor{ - // { - // Name: to.Ptr("Index"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/advisors"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/advisors/Index"), - // Properties: map[string]any{ - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/autorest.md b/sdk/resourcemanager/mysql/armmysql/autorest.md index 558cfd99f9d5..2388896d4924 100644 --- a/sdk/resourcemanager/mysql/armmysql/autorest.md +++ b/sdk/resourcemanager/mysql/armmysql/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mysql/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/mysql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 +module-version: 1.1.2 package-singleservers: true directive: - from: Servers.json diff --git a/sdk/resourcemanager/mysql/armmysql/checknameavailability_client.go b/sdk/resourcemanager/mysql/armmysql/checknameavailability_client.go index c716374ca8c6..263fa72262df 100644 --- a/sdk/resourcemanager/mysql/armmysql/checknameavailability_client.go +++ b/sdk/resourcemanager/mysql/armmysql/checknameavailability_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -52,18 +51,21 @@ func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.Tok // - options - CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute // method. func (client *CheckNameAvailabilityClient) Execute(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *CheckNameAvailabilityClientExecuteOptions) (CheckNameAvailabilityClientExecuteResponse, error) { + var err error req, err := client.executeCreateRequest(ctx, nameAvailabilityRequest, options) if err != nil { return CheckNameAvailabilityClientExecuteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CheckNameAvailabilityClientExecuteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CheckNameAvailabilityClientExecuteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckNameAvailabilityClientExecuteResponse{}, err } - return client.executeHandleResponse(resp) + resp, err := client.executeHandleResponse(httpResp) + return resp, err } // executeCreateRequest creates the Execute request. @@ -81,7 +83,10 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) + if err := runtime.MarshalAsJSON(req, nameAvailabilityRequest); err != nil { + return nil, err + } + return req, nil } // executeHandleResponse handles the Execute response. diff --git a/sdk/resourcemanager/mysql/armmysql/checknameavailability_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/checknameavailability_client_example_test.go deleted file mode 100644 index 292c760c06f1..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/checknameavailability_client_example_test.go +++ /dev/null @@ -1,47 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/CheckNameAvailability.json -func ExampleCheckNameAvailabilityClient_Execute() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCheckNameAvailabilityClient().Execute(ctx, armmysql.NameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DBforMySQL"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NameAvailability = armmysql.NameAvailability{ - // Message: to.Ptr(""), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(""), - // } -} diff --git a/sdk/resourcemanager/mysql/armmysql/client_factory.go b/sdk/resourcemanager/mysql/armmysql/client_factory.go index 3e9f10ab16b0..c12a3125dc59 100644 --- a/sdk/resourcemanager/mysql/armmysql/client_factory.go +++ b/sdk/resourcemanager/mysql/armmysql/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -38,132 +37,132 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewServersClient() *ServersClient { - subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewAdvisorsClient() *AdvisorsClient { + subClient, _ := NewAdvisorsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewReplicasClient() *ReplicasClient { - subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { + subClient, _ := NewCheckNameAvailabilityClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { - subClient, _ := NewFirewallRulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewConfigurationsClient() *ConfigurationsClient { + subClient, _ := NewConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVirtualNetworkRulesClient() *VirtualNetworkRulesClient { - subClient, _ := NewVirtualNetworkRulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { + subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { - subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { + subClient, _ := NewFirewallRulesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewConfigurationsClient() *ConfigurationsClient { - subClient, _ := NewConfigurationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLocationBasedPerformanceTierClient() *LocationBasedPerformanceTierClient { + subClient, _ := NewLocationBasedPerformanceTierClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerParametersClient() *ServerParametersClient { - subClient, _ := NewServerParametersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLocationBasedRecommendedActionSessionsOperationStatusClient() *LocationBasedRecommendedActionSessionsOperationStatusClient { + subClient, _ := NewLocationBasedRecommendedActionSessionsOperationStatusClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLogFilesClient() *LogFilesClient { - subClient, _ := NewLogFilesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLocationBasedRecommendedActionSessionsResultClient() *LocationBasedRecommendedActionSessionsResultClient { + subClient, _ := NewLocationBasedRecommendedActionSessionsResultClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerAdministratorsClient() *ServerAdministratorsClient { - subClient, _ := NewServerAdministratorsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLogFilesClient() *LogFilesClient { + subClient, _ := NewLogFilesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRecoverableServersClient() *RecoverableServersClient { - subClient, _ := NewRecoverableServersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewManagementClient() *ManagementClient { + subClient, _ := NewManagementClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerBasedPerformanceTierClient() *ServerBasedPerformanceTierClient { - subClient, _ := NewServerBasedPerformanceTierClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewLocationBasedPerformanceTierClient() *LocationBasedPerformanceTierClient { - subClient, _ := NewLocationBasedPerformanceTierClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { - subClient, _ := NewCheckNameAvailabilityClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewQueryTextsClient() *QueryTextsClient { + subClient, _ := NewQueryTextsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerSecurityAlertPoliciesClient() *ServerSecurityAlertPoliciesClient { - subClient, _ := NewServerSecurityAlertPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRecommendedActionsClient() *RecommendedActionsClient { + subClient, _ := NewRecommendedActionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewQueryTextsClient() *QueryTextsClient { - subClient, _ := NewQueryTextsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewRecoverableServersClient() *RecoverableServersClient { + subClient, _ := NewRecoverableServersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewTopQueryStatisticsClient() *TopQueryStatisticsClient { - subClient, _ := NewTopQueryStatisticsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewReplicasClient() *ReplicasClient { + subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewWaitStatisticsClient() *WaitStatisticsClient { - subClient, _ := NewWaitStatisticsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerAdministratorsClient() *ServerAdministratorsClient { + subClient, _ := NewServerAdministratorsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewManagementClient() *ManagementClient { - subClient, _ := NewManagementClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerBasedPerformanceTierClient() *ServerBasedPerformanceTierClient { + subClient, _ := NewServerBasedPerformanceTierClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewAdvisorsClient() *AdvisorsClient { - subClient, _ := NewAdvisorsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerKeysClient() *ServerKeysClient { + subClient, _ := NewServerKeysClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewRecommendedActionsClient() *RecommendedActionsClient { - subClient, _ := NewRecommendedActionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerParametersClient() *ServerParametersClient { + subClient, _ := NewServerParametersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLocationBasedRecommendedActionSessionsOperationStatusClient() *LocationBasedRecommendedActionSessionsOperationStatusClient { - subClient, _ := NewLocationBasedRecommendedActionSessionsOperationStatusClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerSecurityAlertPoliciesClient() *ServerSecurityAlertPoliciesClient { + subClient, _ := NewServerSecurityAlertPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLocationBasedRecommendedActionSessionsResultClient() *LocationBasedRecommendedActionSessionsResultClient { - subClient, _ := NewLocationBasedRecommendedActionSessionsResultClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServersClient() *ServersClient { + subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewTopQueryStatisticsClient() *TopQueryStatisticsClient { + subClient, _ := NewTopQueryStatisticsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVirtualNetworkRulesClient() *VirtualNetworkRulesClient { + subClient, _ := NewVirtualNetworkRulesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerKeysClient() *ServerKeysClient { - subClient, _ := NewServerKeysClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewWaitStatisticsClient() *WaitStatisticsClient { + subClient, _ := NewWaitStatisticsClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/mysql/armmysql/configurations_client.go b/sdk/resourcemanager/mysql/armmysql/configurations_client.go index 80189d66d7ea..66c0a168170c 100644 --- a/sdk/resourcemanager/mysql/armmysql/configurations_client.go +++ b/sdk/resourcemanager/mysql/armmysql/configurations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -60,7 +59,8 @@ func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, res if err != nil { return nil, err } - return runtime.NewPoller[ConfigurationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ConfigurationsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ConfigurationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,18 +71,20 @@ func (client *ConfigurationsClient) BeginCreateOrUpdate(ctx context.Context, res // // Generated from API version 2017-12-01 func (client *ConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, configurationName string, parameters Configuration, options *ConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, configurationName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,7 +114,10 @@ func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Cont reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets information about a configuration of server. @@ -124,18 +129,21 @@ func (client *ConfigurationsClient) createOrUpdateCreateRequest(ctx context.Cont // - configurationName - The name of the server configuration. // - options - ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. func (client *ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverName string, configurationName string, options *ConfigurationsClientGetOptions) (ConfigurationsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, configurationName, options) if err != nil { return ConfigurationsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ConfigurationsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ConfigurationsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/configurations_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/configurations_client_example_test.go deleted file mode 100644 index 9c741fc4c748..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/configurations_client_example_test.go +++ /dev/null @@ -1,707 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json -func ExampleConfigurationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "event_scheduler", armmysql.Configuration{ - Properties: &armmysql.ConfigurationProperties{ - Source: to.Ptr("user-override"), - Value: to.Ptr("off"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Configuration = armmysql.Configuration{ - // Name: to.Ptr("event_scheduler"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/configurations/event_scheduler"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Indicates the status of the Event Scheduler."), - // AllowedValues: to.Ptr("ON,OFF,DISABLED"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("user-override"), - // Value: to.Ptr("ON"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationGet.json -func ExampleConfigurationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationsClient().Get(ctx, "TestGroup", "testserver", "event_scheduler", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Configuration = armmysql.Configuration{ - // Name: to.Ptr("event_scheduler"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/configurations/event_scheduler"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Indicates the status of the Event Scheduler."), - // AllowedValues: to.Ptr("ON,OFF,DISABLED"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("user-override"), - // Value: to.Ptr("ON"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationListByServer.json -func ExampleConfigurationsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationsClient().NewListByServerPager("testrg", "mysqltestsvc1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConfigurationListResult = armmysql.ConfigurationListResult{ - // Value: []*armmysql.Configuration{ - // { - // Name: to.Ptr("event_scheduler"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/event_scheduler"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Indicates the status of the Event Scheduler."), - // AllowedValues: to.Ptr("ON,OFF,DISABLED"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("div_precision_increment"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/div_precision_increment"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Number of digits by which to increase the scale of the result of division operations."), - // AllowedValues: to.Ptr("0-30"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("4"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("4"), - // }, - // }, - // { - // Name: to.Ptr("group_concat_max_len"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/group_concat_max_len"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Maximum allowed result length in bytes for the GROUP_CONCAT()."), - // AllowedValues: to.Ptr("4-16777216"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("1024"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1024"), - // }, - // }, - // { - // Name: to.Ptr("innodb_adaptive_hash_index"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_adaptive_hash_index"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Whether innodb adaptive hash indexes are enabled or disabled."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("ON"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("ON"), - // }, - // }, - // { - // Name: to.Ptr("innodb_lock_wait_timeout"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_lock_wait_timeout"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The length of time in seconds an InnoDB transaction waits for a row lock before giving up."), - // AllowedValues: to.Ptr("1-3600"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("50"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("50"), - // }, - // }, - // { - // Name: to.Ptr("interactive_timeout"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/interactive_timeout"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Number of seconds the server waits for activity on an interactive connection before closing it."), - // AllowedValues: to.Ptr("10-1800"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("1800"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1800"), - // }, - // }, - // { - // Name: to.Ptr("log_queries_not_using_indexes"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/log_queries_not_using_indexes"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Logs queries that are expected to retrieve all rows to slow query log."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("log_throttle_queries_not_using_indexes"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/log_throttle_queries_not_using_indexes"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Limits the number of such queries per minute that can be written to the slow query log."), - // AllowedValues: to.Ptr("0-4294967295"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("log_slow_admin_statements"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/log_slow_admin_statements"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Include slow administrative statements in the statements written to the slow query log."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("log_slow_slave_statements"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/log_slow_slave_statements"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("When the slow query log is enabled, this variable enables logging for queries that have taken more than long_query_time seconds to execute on the slave."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("log_bin_trust_function_creators"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/log_bin_trust_function_creators"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("This variable applies when binary logging is enabled. It controls whether stored function creators can be trusted not to create stored functions that will cause unsafe events to be written to the binary log."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("long_query_time"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/long_query_time"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("If a query takes longer than this many seconds, the server increments the Slow_queries status variable."), - // AllowedValues: to.Ptr("0-1E+100"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("10"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("10"), - // }, - // }, - // { - // Name: to.Ptr("min_examined_row_limit"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/min_examined_row_limit"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Can be used to cause queries which examine fewer than the stated number of rows not to be logged."), - // AllowedValues: to.Ptr("0-18446744073709551615"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("slow_query_log"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/slow_query_log"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Enable or disable the slow query log"), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("sql_mode"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/sql_mode"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The current server SQL mode."), - // AllowedValues: to.Ptr(",ALLOW_INVALID_DATES,ANSI_QUOTES,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE,IGNORE_SPACE,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION,NO_FIELD_OPTIONS,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_UNSIGNED_SUBTRACTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY,PAD_CHAR_TO_FULL_LENGTH,PIPES_AS_CONCAT,REAL_AS_FLOAT,STRICT_ALL_TABLES,STRICT_TRANS_TABLES"), - // DataType: to.Ptr("Set"), - // DefaultValue: to.Ptr(""), - // Source: to.Ptr("system-default"), - // Value: to.Ptr(""), - // }, - // }, - // { - // Name: to.Ptr("wait_timeout"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/wait_timeout"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The number of seconds the server waits for activity on a noninteractive connection before closing it."), - // AllowedValues: to.Ptr("60-86400"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("120"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("120"), - // }, - // }, - // { - // Name: to.Ptr("net_read_timeout"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/net_read_timeout"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The number of seconds the server waits for network reading action, especially for LOAD DATA LOCAL FILE."), - // AllowedValues: to.Ptr("10-3600"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("120"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("120"), - // }, - // }, - // { - // Name: to.Ptr("net_write_timeout"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/net_write_timeout"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The number of seconds the server waits for network writing action, especially for LOAD DATA LOCAL FILE."), - // AllowedValues: to.Ptr("10-3600"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("240"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("240"), - // }, - // }, - // { - // Name: to.Ptr("server_id"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/server_id"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The server ID, used in replication to give each master and slave a unique identity."), - // AllowedValues: to.Ptr("1000-4294967295"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("1000"), - // Source: to.Ptr("user-override"), - // Value: to.Ptr("1381286943"), - // }, - // }, - // { - // Name: to.Ptr("max_allowed_packet"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/max_allowed_packet"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The maximum size of one packet or any generated/intermediate string, or any parameter sent by the mysql_stmt_send_long_data() C API function."), - // AllowedValues: to.Ptr("1024-1073741824"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("536870912"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("536870912"), - // }, - // }, - // { - // Name: to.Ptr("slave_net_timeout"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/slave_net_timeout"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The number of seconds to wait for more data from the master before the slave considers the connection broken, aborts the read, and tries to reconnect."), - // AllowedValues: to.Ptr("30-3600"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("60"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("60"), - // }, - // }, - // { - // Name: to.Ptr("time_zone"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/time_zone"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The server time zone"), - // AllowedValues: to.Ptr("[+|-][0]{0,1}[0-9]:[0-5][0-9]|[+|-][1][0-2]:[0-5][0-9]|SYSTEM"), - // DataType: to.Ptr("String"), - // DefaultValue: to.Ptr("SYSTEM"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("SYSTEM"), - // }, - // }, - // { - // Name: to.Ptr("binlog_group_commit_sync_delay"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/binlog_group_commit_sync_delay"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Controls how many microseconds the binary log commit waits before synchronizing the binary log file to disk."), - // AllowedValues: to.Ptr("0,11-1000000"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("1000"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1000"), - // }, - // }, - // { - // Name: to.Ptr("binlog_group_commit_sync_no_delay_count"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/binlog_group_commit_sync_no_delay_count"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The maximum number of transactions to wait for before aborting the current delay as specified by binlog-group-commit-sync-delay."), - // AllowedValues: to.Ptr("0-1000000"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("character_set_server"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/character_set_server"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Use charset_name as the default server character set."), - // AllowedValues: to.Ptr("BIG5,DEC8,CP850,HP8,KOI8R,LATIN1,LATIN2,SWE7,ASCII,UJIS,SJIS,HEBREW,TIS620,EUCKR,KOI8U,GB2312,GREEK,CP1250,GBK,LATIN5,ARMSCII8,UTF8,UCS2,CP866,KEYBCS2,MACCE,MACROMAN,CP852,LATIN7,UTF8MB4,CP1251,UTF16,CP1256,CP1257,UTF32,BINARY,GEOSTD8,CP932,EUCJPMS"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("latin1"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("latin1"), - // }, - // }, - // { - // Name: to.Ptr("join_buffer_size"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/join_buffer_size"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans."), - // AllowedValues: to.Ptr("128-2097152"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("262144"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("262144"), - // }, - // }, - // { - // Name: to.Ptr("table_open_cache"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/table_open_cache"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The number of open tables for all threads."), - // AllowedValues: to.Ptr("1-4000"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("2000"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("2000"), - // }, - // }, - // { - // Name: to.Ptr("lower_case_table_names"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/lower_case_table_names"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("If set to 1, table names are stored in lowercase on disk and comparisons are not case sensitive. If set to 2, table names are stored as given but compared in lowercase."), - // AllowedValues: to.Ptr("1,2"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("1"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1"), - // }, - // }, - // { - // Name: to.Ptr("slave_compressed_protocol"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/slave_compressed_protocol"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("This option places an upper limit on the total size in bytes of all relay logs on the slave."), - // AllowedValues: to.Ptr("ON,OFF"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("innodb_io_capacity"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_io_capacity"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Sets an upper limit on I/O activity performed by InnoDB background tasks, such as flushing pages from the buffer pool and merging data from the change buffer."), - // AllowedValues: to.Ptr("100-1500"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("200"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("200"), - // }, - // }, - // { - // Name: to.Ptr("innodb_read_io_threads"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_read_io_threads"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The number of I/O threads for read operations in InnoDB."), - // AllowedValues: to.Ptr("1-64"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("4"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("4"), - // }, - // }, - // { - // Name: to.Ptr("innodb_thread_concurrency"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_thread_concurrency"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("InnoDB tries to keep the number of operating system threads concurrently inside InnoDB less than or equal to the limit given by this variable."), - // AllowedValues: to.Ptr("0-1000"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("innodb_write_io_threads"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_write_io_threads"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The number of I/O threads for write operations in InnoDB."), - // AllowedValues: to.Ptr("1-64"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("4"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("4"), - // }, - // }, - // { - // Name: to.Ptr("innodb_page_cleaners"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_page_cleaners"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The number of page cleaner threads that flush dirty pages from buffer pool instances."), - // AllowedValues: to.Ptr("1-64"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("4"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("4"), - // }, - // }, - // { - // Name: to.Ptr("innodb_online_alter_log_max_size"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_online_alter_log_max_size"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Specifies an upper limit on the size of the temporary log files used during online DDL operations for InnoDB tables."), - // AllowedValues: to.Ptr("65536-2147483648"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("134217728"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("134217728"), - // }, - // }, - // { - // Name: to.Ptr("init_connect"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/init_connect"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("A string to be executed by the server for each client that connects."), - // AllowedValues: to.Ptr(""), - // DataType: to.Ptr("String"), - // DefaultValue: to.Ptr(""), - // Source: to.Ptr("system-default"), - // Value: to.Ptr(""), - // }, - // }, - // { - // Name: to.Ptr("tx_isolation"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/tx_isolation"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The default transaction isolation level."), - // AllowedValues: to.Ptr("READ-UNCOMMITTED,READ-COMMITTED,REPEATABLE-READ,SERIALIZABLE"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("REPEATABLE-READ"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("REPEATABLE-READ"), - // }, - // }, - // { - // Name: to.Ptr("eq_range_index_dive_limit"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/eq_range_index_dive_limit"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("This variable indicates the number of equality ranges in an equality comparison condition when the optimizer should switch from using index dives to index statistics in estimating the number of qualifying rows."), - // AllowedValues: to.Ptr("0-4294967295"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("200"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("200"), - // }, - // }, - // { - // Name: to.Ptr("innodb_old_blocks_pct"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_old_blocks_pct"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Specifies the approximate percentage of the InnoDB buffer pool used for the old block sublist."), - // AllowedValues: to.Ptr("5-95"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("37"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("37"), - // }, - // }, - // { - // Name: to.Ptr("innodb_old_blocks_time"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_old_blocks_time"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Non-zero values protect against the buffer pool being filled by data that is referenced only for a brief period, such as during a full table scan."), - // AllowedValues: to.Ptr("0-4294967295"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("1000"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1000"), - // }, - // }, - // { - // Name: to.Ptr("innodb_read_ahead_threshold"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_read_ahead_threshold"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Controls the sensitivity of linear read-ahead that InnoDB uses to prefetch pages into the buffer pool."), - // AllowedValues: to.Ptr("0-64"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("56"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("56"), - // }, - // }, - // { - // Name: to.Ptr("max_length_for_sort_data"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/max_length_for_sort_data"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("The cutoff on the size of index values that determines which filesort algorithm to use."), - // AllowedValues: to.Ptr("4-8388608"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("1024"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1024"), - // }, - // }, - // { - // Name: to.Ptr("max_connect_errors"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/max_connect_errors"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("If more than this many successive connection requests from a host are interrupted without a successful connection, the server blocks that host from further connections."), - // AllowedValues: to.Ptr("1-18446744073709551615"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("100"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("100"), - // }, - // }, - // { - // Name: to.Ptr("innodb_thread_sleep_delay"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_thread_sleep_delay"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Defines how long InnoDB threads sleep before joining the InnoDB queue, in microseconds."), - // AllowedValues: to.Ptr("0-1000000"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("10000"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("10000"), - // }, - // }, - // { - // Name: to.Ptr("innodb_file_format"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/innodb_file_format"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Indicates the InnoDB file format for file-per-table tablespaces."), - // AllowedValues: to.Ptr("Antelope,Barracuda"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("Barracuda"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("Barracuda"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/constants.go b/sdk/resourcemanager/mysql/armmysql/constants.go index f8b5b8ca9253..22d5cc0097a4 100644 --- a/sdk/resourcemanager/mysql/armmysql/constants.go +++ b/sdk/resourcemanager/mysql/armmysql/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql const ( moduleName = "armmysql" - moduleVersion = "v1.1.1" + moduleVersion = "v1.1.2" ) // CreateMode - The mode to create a new server. @@ -233,15 +232,15 @@ func PossibleSKUTierValues() []SKUTier { type SSLEnforcementEnum string const ( - SSLEnforcementEnumEnabled SSLEnforcementEnum = "Enabled" SSLEnforcementEnumDisabled SSLEnforcementEnum = "Disabled" + SSLEnforcementEnumEnabled SSLEnforcementEnum = "Enabled" ) // PossibleSSLEnforcementEnumValues returns the possible values for the SSLEnforcementEnum const type. func PossibleSSLEnforcementEnumValues() []SSLEnforcementEnum { return []SSLEnforcementEnum{ - SSLEnforcementEnumEnabled, SSLEnforcementEnumDisabled, + SSLEnforcementEnumEnabled, } } @@ -276,15 +275,15 @@ func PossibleServerKeyTypeValues() []ServerKeyType { type ServerSecurityAlertPolicyState string const ( - ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled" ServerSecurityAlertPolicyStateDisabled ServerSecurityAlertPolicyState = "Disabled" + ServerSecurityAlertPolicyStateEnabled ServerSecurityAlertPolicyState = "Enabled" ) // PossibleServerSecurityAlertPolicyStateValues returns the possible values for the ServerSecurityAlertPolicyState const type. func PossibleServerSecurityAlertPolicyStateValues() []ServerSecurityAlertPolicyState { return []ServerSecurityAlertPolicyState{ - ServerSecurityAlertPolicyStateEnabled, ServerSecurityAlertPolicyStateDisabled, + ServerSecurityAlertPolicyStateEnabled, } } diff --git a/sdk/resourcemanager/mysql/armmysql/databases_client.go b/sdk/resourcemanager/mysql/armmysql/databases_client.go index 683729241ca9..863e3f57a21b 100644 --- a/sdk/resourcemanager/mysql/armmysql/databases_client.go +++ b/sdk/resourcemanager/mysql/armmysql/databases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -60,7 +59,8 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,18 +71,20 @@ func (client *DatabasesClient) BeginCreateOrUpdate(ctx context.Context, resource // // Generated from API version 2017-12-01 func (client *DatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,7 +114,10 @@ func (client *DatabasesClient) createOrUpdateCreateRequest(ctx context.Context, reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a database. @@ -129,7 +134,8 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller[DatabasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[DatabasesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,18 +146,20 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam // // Generated from API version 2017-12-01 func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -193,18 +201,21 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource // - databaseName - The name of the database. // - options - DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. func (client *DatabasesClient) Get(ctx context.Context, resourceGroupName string, serverName string, databaseName string, options *DatabasesClientGetOptions) (DatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, databaseName, options) if err != nil { return DatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/databases_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/databases_client_example_test.go deleted file mode 100644 index 061c00be4c0a..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/databases_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseCreate.json -func ExampleDatabasesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "db1", armmysql.Database{ - Properties: &armmysql.DatabaseProperties{ - Charset: to.Ptr("utf8"), - Collation: to.Ptr("utf8_general_ci"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armmysql.Database{ - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/databases/db1"), - // Properties: &armmysql.DatabaseProperties{ - // Charset: to.Ptr("utf8"), - // Collation: to.Ptr("utf8_general_ci"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseDelete.json -func ExampleDatabasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginDelete(ctx, "TestGroup", "testserver", "db1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseGet.json -func ExampleDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().Get(ctx, "TestGroup", "testserver", "db1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Database = armmysql.Database{ - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/databases/db1"), - // Properties: &armmysql.DatabaseProperties{ - // Charset: to.Ptr("utf8"), - // Collation: to.Ptr("utf8_general_ci"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/DatabaseListByServer.json -func ExampleDatabasesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListByServerPager("TestGroup", "testserver", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DatabaseListResult = armmysql.DatabaseListResult{ - // Value: []*armmysql.Database{ - // { - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/databases/db1"), - // Properties: &armmysql.DatabaseProperties{ - // Charset: to.Ptr("utf8"), - // Collation: to.Ptr("utf8_general_ci"), - // }, - // }, - // { - // Name: to.Ptr("db2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/databases/db2"), - // Properties: &armmysql.DatabaseProperties{ - // Charset: to.Ptr("utf8"), - // Collation: to.Ptr("utf8_general_ci"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/firewallrules_client.go b/sdk/resourcemanager/mysql/armmysql/firewallrules_client.go index 5eb49d335cff..8859d9cdb5ff 100644 --- a/sdk/resourcemanager/mysql/armmysql/firewallrules_client.go +++ b/sdk/resourcemanager/mysql/armmysql/firewallrules_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -60,7 +59,8 @@ func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller[FirewallRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FirewallRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FirewallRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,18 +71,20 @@ func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, reso // // Generated from API version 2017-12-01 func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,7 +114,10 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a server firewall rule. @@ -130,7 +135,8 @@ func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller[FirewallRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[FirewallRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[FirewallRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,18 +147,20 @@ func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGrou // // Generated from API version 2017-12-01 func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -194,18 +202,21 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso // - firewallRuleName - The name of the server firewall rule. // - options - FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, firewallRuleName, options) if err != nil { return FirewallRulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FirewallRulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FirewallRulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/firewallrules_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/firewallrules_client_example_test.go deleted file mode 100644 index f9e1bafc177c..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/firewallrules_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleCreate.json -func ExampleFirewallRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallRulesClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "rule1", armmysql.FirewallRule{ - Properties: &armmysql.FirewallRuleProperties{ - EndIPAddress: to.Ptr("255.255.255.255"), - StartIPAddress: to.Ptr("0.0.0.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallRule = armmysql.FirewallRule{ - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/firewallRules/rule1"), - // Properties: &armmysql.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleDelete.json -func ExampleFirewallRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallRulesClient().BeginDelete(ctx, "TestGroup", "testserver", "rule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleGet.json -func ExampleFirewallRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFirewallRulesClient().Get(ctx, "TestGroup", "testserver", "rule1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FirewallRule = armmysql.FirewallRule{ - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/firewallRules/rule1"), - // Properties: &armmysql.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/FirewallRuleListByServer.json -func ExampleFirewallRulesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFirewallRulesClient().NewListByServerPager("TestGroup", "testserver", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FirewallRuleListResult = armmysql.FirewallRuleListResult{ - // Value: []*armmysql.FirewallRule{ - // { - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/firewallRules/rule1"), - // Properties: &armmysql.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // }, - // { - // Name: to.Ptr("rule2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver/firewallRules/rule2"), - // Properties: &armmysql.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.0.0.0"), - // StartIPAddress: to.Ptr("1.0.0.0"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/go.mod b/sdk/resourcemanager/mysql/armmysql/go.mod index b2df71c63ef9..49cf9c1263d2 100644 --- a/sdk/resourcemanager/mysql/armmysql/go.mod +++ b/sdk/resourcemanager/mysql/armmysql/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/mysql/armmysql/go.sum b/sdk/resourcemanager/mysql/armmysql/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/mysql/armmysql/go.sum +++ b/sdk/resourcemanager/mysql/armmysql/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/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/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/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/mysql/armmysql/interfaces.go b/sdk/resourcemanager/mysql/armmysql/interfaces.go new file mode 100644 index 000000000000..04df0316449f --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysql/interfaces.go @@ -0,0 +1,19 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysql + +// ServerPropertiesForCreateClassification provides polymorphic access to related types. +// Call the interface's GetServerPropertiesForCreate() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ServerPropertiesForCreate, *ServerPropertiesForDefaultCreate, *ServerPropertiesForGeoRestore, *ServerPropertiesForReplica, +// - *ServerPropertiesForRestore +type ServerPropertiesForCreateClassification interface { + // GetServerPropertiesForCreate returns the ServerPropertiesForCreate content of the underlying type. + GetServerPropertiesForCreate() *ServerPropertiesForCreate +} diff --git a/sdk/resourcemanager/mysql/armmysql/locationbasedperformancetier_client.go b/sdk/resourcemanager/mysql/armmysql/locationbasedperformancetier_client.go index 12fa9a6bed55..2b2e4dbc8d42 100644 --- a/sdk/resourcemanager/mysql/armmysql/locationbasedperformancetier_client.go +++ b/sdk/resourcemanager/mysql/armmysql/locationbasedperformancetier_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql diff --git a/sdk/resourcemanager/mysql/armmysql/locationbasedperformancetier_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/locationbasedperformancetier_client_example_test.go deleted file mode 100644 index 8aa5bc724673..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/locationbasedperformancetier_client_example_test.go +++ /dev/null @@ -1,206 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json -func ExampleLocationBasedPerformanceTierClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLocationBasedPerformanceTierClient().NewListPager("WestUS", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PerformanceTierListResult = armmysql.PerformanceTierListResult{ - // Value: []*armmysql.PerformanceTierProperties{ - // { - // ID: to.Ptr("Basic"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxLargeStorageMB: to.Ptr[int32](0), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinLargeStorageMB: to.Ptr[int32](0), - // MinStorageMB: to.Ptr[int32](5120), - // ServiceLevelObjectives: []*armmysql.PerformanceTierServiceLevelObjectives{ - // { - // Edition: to.Ptr("Basic"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("B_Gen5_1"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](1048576), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](1), - // }, - // { - // Edition: to.Ptr("Basic"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("B_Gen5_2"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](1048576), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](2), - // }}, - // }, - // { - // ID: to.Ptr("GeneralPurpose"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxLargeStorageMB: to.Ptr[int32](16777216), - // MaxStorageMB: to.Ptr[int32](16777216), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinLargeStorageMB: to.Ptr[int32](0), - // MinStorageMB: to.Ptr[int32](5120), - // ServiceLevelObjectives: []*armmysql.PerformanceTierServiceLevelObjectives{ - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_2"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](2), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_4"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](4), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_8"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](8), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_16"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](16), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_32"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](32), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_64"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](32), - // }}, - // }, - // { - // ID: to.Ptr("MemoryOptimized"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxLargeStorageMB: to.Ptr[int32](16777216), - // MaxStorageMB: to.Ptr[int32](16777216), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinLargeStorageMB: to.Ptr[int32](0), - // MinStorageMB: to.Ptr[int32](5120), - // ServiceLevelObjectives: []*armmysql.PerformanceTierServiceLevelObjectives{ - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_2"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](2), - // }, - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_4"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](4), - // }, - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_8"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](8), - // }, - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_16"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](16), - // }, - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_32"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](32), - // }}, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsoperationstatus_client.go b/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsoperationstatus_client.go index b33abb0898af..d15bca98d6c5 100644 --- a/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsoperationstatus_client.go +++ b/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsoperationstatus_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -53,18 +52,21 @@ func NewLocationBasedRecommendedActionSessionsOperationStatusClient(subscription // - options - LocationBasedRecommendedActionSessionsOperationStatusClientGetOptions contains the optional parameters for the // LocationBasedRecommendedActionSessionsOperationStatusClient.Get method. func (client *LocationBasedRecommendedActionSessionsOperationStatusClient) Get(ctx context.Context, locationName string, operationID string, options *LocationBasedRecommendedActionSessionsOperationStatusClientGetOptions) (LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, locationName, operationID, options) if err != nil { return LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsoperationstatus_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsoperationstatus_client_example_test.go deleted file mode 100644 index feb7f25fcb94..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsoperationstatus_client_example_test.go +++ /dev/null @@ -1,43 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionOperationStatus.json -func ExampleLocationBasedRecommendedActionSessionsOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationBasedRecommendedActionSessionsOperationStatusClient().Get(ctx, "WestUS", "aaaabbbb-cccc-dddd-0000-111122223333", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecommendedActionSessionsOperationStatus = armmysql.RecommendedActionSessionsOperationStatus{ - // Name: to.Ptr("aaaabbbb-cccc-dddd-0000-111122223333"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T17:15:00Z"); return t}()), - // Status: to.Ptr("succeeded"), - // } -} diff --git a/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsresult_client.go b/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsresult_client.go index c16a44e95289..e6b88d946d64 100644 --- a/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsresult_client.go +++ b/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsresult_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql diff --git a/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsresult_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsresult_client_example_test.go deleted file mode 100644 index 40c90f5d226b..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/locationbasedrecommendedactionsessionsresult_client_example_test.go +++ /dev/null @@ -1,96 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionResult.json -func ExampleLocationBasedRecommendedActionSessionsResultClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLocationBasedRecommendedActionSessionsResultClient().NewListPager("WestUS", "aaaabbbb-cccc-dddd-0000-111122223333", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecommendationActionsResultList = armmysql.RecommendationActionsResultList{ - // Value: []*armmysql.RecommendationAction{ - // { - // Name: to.Ptr("Index-1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.Sql/servers/testServerName/advisors/Index/recommendedActions/Index-1"), - // Properties: &armmysql.RecommendationActionProperties{ - // ActionID: to.Ptr[int32](1), - // AdvisorName: to.Ptr("Index"), - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T23:43:24Z"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T23:43:24Z"); return t}()), - // Reason: to.Ptr("Column `movies_genres`.`movie_id` appear in Join On clause(s)."), - // RecommendationType: to.Ptr("Add"), - // SessionID: to.Ptr("c63c2114-e2a4-4c7a-98c1-85577d1a5d50"), - // Details: map[string]*string{ - // "engine": to.Ptr("InnoDB"), - // "indexColumns": to.Ptr("`movies_genres`.`movie_id`"), - // "indexName": to.Ptr("idx_movie_id"), - // "indexType": to.Ptr("BTREE"), - // "parentTableName": to.Ptr("movies_genres"), - // "queryIds": to.Ptr("779"), - // "schemaName": to.Ptr("movies"), - // "script": to.Ptr("alter table `movies`.`movies_genres` add index `idx_movie_id` (`movie_id`)"), - // "tableName": to.Ptr("movies_genres"), - // }, - // }, - // }, - // { - // Name: to.Ptr("Index-2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.Sql/servers/testServerName/advisors/Index/recommendedActions/Index-2"), - // Properties: &armmysql.RecommendationActionProperties{ - // ActionID: to.Ptr[int32](2), - // AdvisorName: to.Ptr("Index"), - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T23:43:24Z"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T23:43:24Z"); return t}()), - // Reason: to.Ptr("Column `movies_genres`.`genre` appear in Group By clause(s)."), - // RecommendationType: to.Ptr("Add"), - // SessionID: to.Ptr("c63c2114-e2a4-4c7a-98c1-85577d1a5d50"), - // Details: map[string]*string{ - // "engine": to.Ptr("InnoDB"), - // "indexColumns": to.Ptr("`movies_genres`.`genre`"), - // "indexName": to.Ptr("idx_genre"), - // "indexType": to.Ptr("BTREE"), - // "parentTableName": to.Ptr("movies_genres"), - // "queryIds": to.Ptr("779"), - // "schemaName": to.Ptr("movies"), - // "script": to.Ptr("alter table `movies`.`movies_genres` add index `idx_genre` (`genre`)"), - // "tableName": to.Ptr("movies_genres"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/logfiles_client.go b/sdk/resourcemanager/mysql/armmysql/logfiles_client.go index c3542acb31e8..2e1b154a8c41 100644 --- a/sdk/resourcemanager/mysql/armmysql/logfiles_client.go +++ b/sdk/resourcemanager/mysql/armmysql/logfiles_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql diff --git a/sdk/resourcemanager/mysql/armmysql/logfiles_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/logfiles_client_example_test.go deleted file mode 100644 index 93ac8283e600..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/logfiles_client_example_test.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/LogFileListByServer.json -func ExampleLogFilesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogFilesClient().NewListByServerPager("TestGroup", "testserver", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LogFileListResult = armmysql.LogFileListResult{ - // Value: []*armmysql.LogFile{ - // { - // Name: to.Ptr("mysql-slow-mysqltestsvc1-2018022823.log"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/logFiles"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/logFiles/mysql-slow-mysqltestsvc1-2018022823.log"), - // Properties: &armmysql.LogFileProperties{ - // Type: to.Ptr("slowlog"), - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "0001-01-01T00:00:00+00:00"); return t}()), - // LastModifiedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-01T06:09:20+00:00"); return t}()), - // SizeInKB: to.Ptr[int64](1), - // URL: to.Ptr("https://wasd2prodwus1afse42.file.core.windows.net/833c99b2f36c47349e5554b903fe0440/serverlogs/mysql-slow-mysqltestsvc1-2018022823.log?sv=2015-04-05&sr=f&sig=D9Ga4N5Pa%2BPe5Bmjpvs7A0TPD%2FF7IZpk9e4KWR0jgpM%3D&se=2018-03-01T07%3A12%3A13Z&sp=r"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/management_client.go b/sdk/resourcemanager/mysql/armmysql/management_client.go index b1b957c3c628..b76301b77742 100644 --- a/sdk/resourcemanager/mysql/armmysql/management_client.go +++ b/sdk/resourcemanager/mysql/armmysql/management_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -60,7 +59,8 @@ func (client *ManagementClient) BeginCreateRecommendedActionSession(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[ManagementClientCreateRecommendedActionSessionResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ManagementClientCreateRecommendedActionSessionResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ManagementClientCreateRecommendedActionSessionResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,18 +71,20 @@ func (client *ManagementClient) BeginCreateRecommendedActionSession(ctx context. // // Generated from API version 2018-06-01 func (client *ManagementClient) createRecommendedActionSession(ctx context.Context, resourceGroupName string, serverName string, advisorName string, databaseName string, options *ManagementClientBeginCreateRecommendedActionSessionOptions) (*http.Response, error) { + var err error req, err := client.createRecommendedActionSessionCreateRequest(ctx, resourceGroupName, serverName, advisorName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createRecommendedActionSessionCreateRequest creates the CreateRecommendedActionSession request. @@ -124,18 +126,21 @@ func (client *ManagementClient) createRecommendedActionSessionCreateRequest(ctx // - options - ManagementClientResetQueryPerformanceInsightDataOptions contains the optional parameters for the ManagementClient.ResetQueryPerformanceInsightData // method. func (client *ManagementClient) ResetQueryPerformanceInsightData(ctx context.Context, resourceGroupName string, serverName string, options *ManagementClientResetQueryPerformanceInsightDataOptions) (ManagementClientResetQueryPerformanceInsightDataResponse, error) { + var err error req, err := client.resetQueryPerformanceInsightDataCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ManagementClientResetQueryPerformanceInsightDataResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ManagementClientResetQueryPerformanceInsightDataResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ManagementClientResetQueryPerformanceInsightDataResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ManagementClientResetQueryPerformanceInsightDataResponse{}, err } - return client.resetQueryPerformanceInsightDataHandleResponse(resp) + resp, err := client.resetQueryPerformanceInsightDataHandleResponse(httpResp) + return resp, err } // resetQueryPerformanceInsightDataCreateRequest creates the ResetQueryPerformanceInsightData request. diff --git a/sdk/resourcemanager/mysql/armmysql/management_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/management_client_example_test.go deleted file mode 100644 index 09fa2c97507f..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/management_client_example_test.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryPerformanceInsightResetData.json -func ExampleManagementClient_ResetQueryPerformanceInsightData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewManagementClient().ResetQueryPerformanceInsightData(ctx, "testResourceGroupName", "testServerName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryPerformanceInsightResetDataResult = armmysql.QueryPerformanceInsightResetDataResult{ - // Message: to.Ptr("QPI reset data successful"), - // Status: to.Ptr(armmysql.QueryPerformanceInsightResetDataResultStateSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionSessionCreate.json -func ExampleManagementClient_BeginCreateRecommendedActionSession() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewManagementClient().BeginCreateRecommendedActionSession(ctx, "testResourceGroupName", "testServerName", "Index", "someDatabaseName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/models.go b/sdk/resourcemanager/mysql/armmysql/models.go index 2c82a22ad6e4..9a57e0cd84ae 100644 --- a/sdk/resourcemanager/mysql/armmysql/models.go +++ b/sdk/resourcemanager/mysql/armmysql/models.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -26,16 +25,6 @@ type Advisor struct { Type *string } -// AdvisorsClientGetOptions contains the optional parameters for the AdvisorsClient.Get method. -type AdvisorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AdvisorsClientListByServerOptions contains the optional parameters for the AdvisorsClient.NewListByServerPager method. -type AdvisorsClientListByServerOptions struct { - // placeholder for future optional parameters -} - // AdvisorsResultList - A list of query statistics. type AdvisorsResultList struct { // READ-ONLY; Link to retrieve next page of results. @@ -45,12 +34,6 @@ type AdvisorsResultList struct { Value []*Advisor } -// CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute -// method. -type CheckNameAvailabilityClientExecuteOptions struct { - // placeholder for future optional parameters -} - // Configuration - Represents a Configuration. type Configuration struct { // The properties of a configuration. @@ -93,24 +76,6 @@ type ConfigurationProperties struct { Description *string } -// ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate -// method. -type ConfigurationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. -type ConfigurationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.NewListByServerPager -// method. -type ConfigurationsClientListByServerOptions struct { - // placeholder for future optional parameters -} - // Database - Represents a Database. type Database struct { // The properties of a database. @@ -141,29 +106,6 @@ type DatabaseProperties struct { Collation *string } -// DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate -// method. -type DatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. -type DatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. -type DatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.NewListByServerPager method. -type DatabasesClientListByServerOptions struct { - // placeholder for future optional parameters -} - // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -222,48 +164,6 @@ type FirewallRuleProperties struct { StartIPAddress *string } -// FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate -// method. -type FirewallRulesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method. -type FirewallRulesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. -type FirewallRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.NewListByServerPager -// method. -type FirewallRulesClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// LocationBasedPerformanceTierClientListOptions contains the optional parameters for the LocationBasedPerformanceTierClient.NewListPager -// method. -type LocationBasedPerformanceTierClientListOptions struct { - // placeholder for future optional parameters -} - -// LocationBasedRecommendedActionSessionsOperationStatusClientGetOptions contains the optional parameters for the LocationBasedRecommendedActionSessionsOperationStatusClient.Get -// method. -type LocationBasedRecommendedActionSessionsOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// LocationBasedRecommendedActionSessionsResultClientListOptions contains the optional parameters for the LocationBasedRecommendedActionSessionsResultClient.NewListPager -// method. -type LocationBasedRecommendedActionSessionsResultClientListOptions struct { - // placeholder for future optional parameters -} - // LogFile - Represents a log file. type LogFile struct { // The properties of the log file. @@ -303,24 +203,6 @@ type LogFileProperties struct { LastModifiedTime *time.Time } -// LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.NewListByServerPager method. -type LogFilesClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// ManagementClientBeginCreateRecommendedActionSessionOptions contains the optional parameters for the ManagementClient.BeginCreateRecommendedActionSession -// method. -type ManagementClientBeginCreateRecommendedActionSessionOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ManagementClientResetQueryPerformanceInsightDataOptions contains the optional parameters for the ManagementClient.ResetQueryPerformanceInsightData -// method. -type ManagementClientResetQueryPerformanceInsightDataOptions struct { - // placeholder for future optional parameters -} - // NameAvailability - Represents a resource name availability. type NameAvailability struct { // Error Message. @@ -378,11 +260,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PerformanceTierListResult - A list of performance tiers. type PerformanceTierListResult struct { // The list of performance tiers @@ -479,39 +356,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *string } -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginUpdateTagsOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdateTags -// method. -type PrivateEndpointConnectionsClientBeginUpdateTagsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByServerOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByServerPager -// method. -type PrivateEndpointConnectionsClientListByServerOptions struct { - // placeholder for future optional parameters -} - type PrivateEndpointProperty struct { // Resource id of the private endpoint. ID *string @@ -550,17 +394,6 @@ type PrivateLinkResourceProperties struct { RequiredMembers []*string } -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListByServerOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByServerPager -// method. -type PrivateLinkResourcesClientListByServerOptions struct { - // placeholder for future optional parameters -} - type PrivateLinkServiceConnectionStateProperty struct { // REQUIRED; The private link service connection description. Description *string @@ -666,16 +499,6 @@ type QueryTextProperties struct { QueryText *string } -// QueryTextsClientGetOptions contains the optional parameters for the QueryTextsClient.Get method. -type QueryTextsClientGetOptions struct { - // placeholder for future optional parameters -} - -// QueryTextsClientListByServerOptions contains the optional parameters for the QueryTextsClient.NewListByServerPager method. -type QueryTextsClientListByServerOptions struct { - // placeholder for future optional parameters -} - // QueryTextsResultList - A list of query texts. type QueryTextsResultList struct { // READ-ONLY; Link to retrieve next page of results. @@ -748,18 +571,6 @@ type RecommendedActionSessionsOperationStatus struct { Status *string } -// RecommendedActionsClientGetOptions contains the optional parameters for the RecommendedActionsClient.Get method. -type RecommendedActionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// RecommendedActionsClientListByServerOptions contains the optional parameters for the RecommendedActionsClient.NewListByServerPager -// method. -type RecommendedActionsClientListByServerOptions struct { - // The recommendation action session identifier. - SessionID *string -} - // RecoverableServerProperties - The recoverable server's properties. type RecoverableServerProperties struct { // READ-ONLY; Edition of the performance tier. @@ -796,16 +607,6 @@ type RecoverableServerResource struct { Type *string } -// RecoverableServersClientGetOptions contains the optional parameters for the RecoverableServersClient.Get method. -type RecoverableServersClientGetOptions struct { - // placeholder for future optional parameters -} - -// ReplicasClientListByServerOptions contains the optional parameters for the ReplicasClient.NewListByServerPager method. -type ReplicasClientListByServerOptions struct { - // placeholder for future optional parameters -} - // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -938,37 +739,6 @@ type ServerAdministratorResourceListResult struct { Value []*ServerAdministratorResource } -// ServerAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerAdministratorsClient.BeginCreateOrUpdate -// method. -type ServerAdministratorsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerAdministratorsClientBeginDeleteOptions contains the optional parameters for the ServerAdministratorsClient.BeginDelete -// method. -type ServerAdministratorsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerAdministratorsClientGetOptions contains the optional parameters for the ServerAdministratorsClient.Get method. -type ServerAdministratorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerAdministratorsClientListOptions contains the optional parameters for the ServerAdministratorsClient.NewListPager -// method. -type ServerAdministratorsClientListOptions struct { - // placeholder for future optional parameters -} - -// ServerBasedPerformanceTierClientListOptions contains the optional parameters for the ServerBasedPerformanceTierClient.NewListPager -// method. -type ServerBasedPerformanceTierClientListOptions struct { - // placeholder for future optional parameters -} - // ServerForCreate - Represents a server to be created. type ServerForCreate struct { // REQUIRED; The location the resource resides in. @@ -1026,42 +796,12 @@ type ServerKeyProperties struct { CreationDate *time.Time } -// ServerKeysClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerKeysClient.BeginCreateOrUpdate -// method. -type ServerKeysClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerKeysClientBeginDeleteOptions contains the optional parameters for the ServerKeysClient.BeginDelete method. -type ServerKeysClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerKeysClientGetOptions contains the optional parameters for the ServerKeysClient.Get method. -type ServerKeysClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerKeysClientListOptions contains the optional parameters for the ServerKeysClient.NewListPager method. -type ServerKeysClientListOptions struct { - // placeholder for future optional parameters -} - // ServerListResult - A list of servers. type ServerListResult struct { // The list of servers Value []*Server } -// ServerParametersClientBeginListUpdateConfigurationsOptions contains the optional parameters for the ServerParametersClient.BeginListUpdateConfigurations -// method. -type ServerParametersClientBeginListUpdateConfigurationsOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - // ServerPrivateEndpointConnection - A private endpoint connection under a server type ServerPrivateEndpointConnection struct { // READ-ONLY; Resource Id of the private endpoint connection. @@ -1144,16 +884,6 @@ type ServerProperties struct { PrivateEndpointConnections []*ServerPrivateEndpointConnection } -// ServerPropertiesForCreateClassification provides polymorphic access to related types. -// Call the interface's GetServerPropertiesForCreate() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *ServerPropertiesForCreate, *ServerPropertiesForDefaultCreate, *ServerPropertiesForGeoRestore, *ServerPropertiesForReplica, -// - *ServerPropertiesForRestore -type ServerPropertiesForCreateClassification interface { - // GetServerPropertiesForCreate returns the ServerPropertiesForCreate content of the underlying type. - GetServerPropertiesForCreate() *ServerPropertiesForCreate -} - // ServerPropertiesForCreate - The properties used to create a new server. type ServerPropertiesForCreate struct { // REQUIRED; The mode to create a new server. @@ -1219,13 +949,13 @@ type ServerPropertiesForDefaultCreate struct { // GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForDefaultCreate. func (s *ServerPropertiesForDefaultCreate) GetServerPropertiesForCreate() *ServerPropertiesForCreate { return &ServerPropertiesForCreate{ - Version: s.Version, - SSLEnforcement: s.SSLEnforcement, - MinimalTLSVersion: s.MinimalTLSVersion, + CreateMode: s.CreateMode, InfrastructureEncryption: s.InfrastructureEncryption, + MinimalTLSVersion: s.MinimalTLSVersion, PublicNetworkAccess: s.PublicNetworkAccess, + SSLEnforcement: s.SSLEnforcement, StorageProfile: s.StorageProfile, - CreateMode: s.CreateMode, + Version: s.Version, } } @@ -1261,13 +991,13 @@ type ServerPropertiesForGeoRestore struct { // GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForGeoRestore. func (s *ServerPropertiesForGeoRestore) GetServerPropertiesForCreate() *ServerPropertiesForCreate { return &ServerPropertiesForCreate{ - Version: s.Version, - SSLEnforcement: s.SSLEnforcement, - MinimalTLSVersion: s.MinimalTLSVersion, + CreateMode: s.CreateMode, InfrastructureEncryption: s.InfrastructureEncryption, + MinimalTLSVersion: s.MinimalTLSVersion, PublicNetworkAccess: s.PublicNetworkAccess, + SSLEnforcement: s.SSLEnforcement, StorageProfile: s.StorageProfile, - CreateMode: s.CreateMode, + Version: s.Version, } } @@ -1302,13 +1032,13 @@ type ServerPropertiesForReplica struct { // GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForReplica. func (s *ServerPropertiesForReplica) GetServerPropertiesForCreate() *ServerPropertiesForCreate { return &ServerPropertiesForCreate{ - Version: s.Version, - SSLEnforcement: s.SSLEnforcement, - MinimalTLSVersion: s.MinimalTLSVersion, + CreateMode: s.CreateMode, InfrastructureEncryption: s.InfrastructureEncryption, + MinimalTLSVersion: s.MinimalTLSVersion, PublicNetworkAccess: s.PublicNetworkAccess, + SSLEnforcement: s.SSLEnforcement, StorageProfile: s.StorageProfile, - CreateMode: s.CreateMode, + Version: s.Version, } } @@ -1346,35 +1076,16 @@ type ServerPropertiesForRestore struct { // GetServerPropertiesForCreate implements the ServerPropertiesForCreateClassification interface for type ServerPropertiesForRestore. func (s *ServerPropertiesForRestore) GetServerPropertiesForCreate() *ServerPropertiesForCreate { return &ServerPropertiesForCreate{ - Version: s.Version, - SSLEnforcement: s.SSLEnforcement, - MinimalTLSVersion: s.MinimalTLSVersion, + CreateMode: s.CreateMode, InfrastructureEncryption: s.InfrastructureEncryption, + MinimalTLSVersion: s.MinimalTLSVersion, PublicNetworkAccess: s.PublicNetworkAccess, + SSLEnforcement: s.SSLEnforcement, StorageProfile: s.StorageProfile, - CreateMode: s.CreateMode, + Version: s.Version, } } -// ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate -// method. -type ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.Get -// method. -type ServerSecurityAlertPoliciesClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerSecurityAlertPoliciesClientListByServerOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.NewListByServerPager -// method. -type ServerSecurityAlertPoliciesClientListByServerOptions struct { - // placeholder for future optional parameters -} - // ServerSecurityAlertPolicy - A server security alert policy. type ServerSecurityAlertPolicy struct { // Resource properties. @@ -1450,64 +1161,6 @@ type ServerUpgradeParametersProperties struct { TargetServerVersion *string } -// ServersClientBeginCreateOptions contains the optional parameters for the ServersClient.BeginCreate method. -type ServersClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. -type ServersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginRestartOptions contains the optional parameters for the ServersClient.BeginRestart method. -type ServersClientBeginRestartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginStartOptions contains the optional parameters for the ServersClient.BeginStart method. -type ServersClientBeginStartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginStopOptions contains the optional parameters for the ServersClient.BeginStop method. -type ServersClientBeginStopOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. -type ServersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientBeginUpgradeOptions contains the optional parameters for the ServersClient.BeginUpgrade method. -type ServersClientBeginUpgradeOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. -type ServersClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager -// method. -type ServersClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. -type ServersClientListOptions struct { - // placeholder for future optional parameters -} - // StorageProfile - Storage Profile properties of a server type StorageProfile struct { // Backup retention days for the server. @@ -1529,17 +1182,6 @@ type TagsObject struct { Tags map[string]*string } -// TopQueryStatisticsClientGetOptions contains the optional parameters for the TopQueryStatisticsClient.Get method. -type TopQueryStatisticsClientGetOptions struct { - // placeholder for future optional parameters -} - -// TopQueryStatisticsClientListByServerOptions contains the optional parameters for the TopQueryStatisticsClient.NewListByServerPager -// method. -type TopQueryStatisticsClientListByServerOptions struct { - // placeholder for future optional parameters -} - // TopQueryStatisticsInput - Input to get top query statistics type TopQueryStatisticsInput struct { // REQUIRED; The properties of a wait statistics input. @@ -1631,31 +1273,6 @@ type VirtualNetworkRuleProperties struct { State *VirtualNetworkRuleState } -// VirtualNetworkRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginCreateOrUpdate -// method. -type VirtualNetworkRulesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualNetworkRulesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginDelete -// method. -type VirtualNetworkRulesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// VirtualNetworkRulesClientGetOptions contains the optional parameters for the VirtualNetworkRulesClient.Get method. -type VirtualNetworkRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// VirtualNetworkRulesClientListByServerOptions contains the optional parameters for the VirtualNetworkRulesClient.NewListByServerPager -// method. -type VirtualNetworkRulesClientListByServerOptions struct { - // placeholder for future optional parameters -} - // WaitStatistic - Represents a Wait Statistic. type WaitStatistic struct { // The properties of a wait statistic. @@ -1701,17 +1318,6 @@ type WaitStatisticProperties struct { UserID *int64 } -// WaitStatisticsClientGetOptions contains the optional parameters for the WaitStatisticsClient.Get method. -type WaitStatisticsClientGetOptions struct { - // placeholder for future optional parameters -} - -// WaitStatisticsClientListByServerOptions contains the optional parameters for the WaitStatisticsClient.NewListByServerPager -// method. -type WaitStatisticsClientListByServerOptions struct { - // placeholder for future optional parameters -} - // WaitStatisticsInput - Input to get wait statistics type WaitStatisticsInput struct { // REQUIRED; The properties of a wait statistics input. diff --git a/sdk/resourcemanager/mysql/armmysql/models_serde.go b/sdk/resourcemanager/mysql/armmysql/models_serde.go index 6867ea30a16c..3a5027476938 100644 --- a/sdk/resourcemanager/mysql/armmysql/models_serde.go +++ b/sdk/resourcemanager/mysql/armmysql/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql diff --git a/sdk/resourcemanager/mysql/armmysql/operations_client.go b/sdk/resourcemanager/mysql/armmysql/operations_client.go index 16ee8087e9b8..48efcb9bb52b 100644 --- a/sdk/resourcemanager/mysql/armmysql/operations_client.go +++ b/sdk/resourcemanager/mysql/armmysql/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -44,18 +43,21 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // Generated from API version 2017-12-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { + var err error req, err := client.listCreateRequest(ctx, options) if err != nil { return OperationsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationsClientListResponse{}, err } - return client.listHandleResponse(resp) + resp, err := client.listHandleResponse(httpResp) + return resp, err } // listCreateRequest creates the List request. diff --git a/sdk/resourcemanager/mysql/armmysql/operations_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/operations_client_example_test.go deleted file mode 100644 index cbd230ce15dd..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/operations_client_example_test.go +++ /dev/null @@ -1,245 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/OperationList.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().List(ctx, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationListResult = armmysql.OperationListResult{ - // Value: []*armmysql.Operation{ - // { - // Name: to.Ptr("Microsoft.DBforMySQL/locations/performanceTiers/read"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Returns the list of Performance Tiers available."), - // Operation: to.Ptr("List Performance Tiers"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Performance Tiers"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/firewallRules/read"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Return the list of firewall rules for a server or gets the properties for the specified firewall rule."), - // Operation: to.Ptr("List/Get Firewall Rules"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/firewallRules/write"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Creates a firewall rule with the specified parameters or update an existing rule."), - // Operation: to.Ptr("Create/Update Firewall Rule"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/firewallRules/delete"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Deletes an existing firewall rule."), - // Operation: to.Ptr("Delete Firewall Rule"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/read"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Return the list of servers or gets the properties for the specified server."), - // Operation: to.Ptr("List/Get MySQL Servers"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("MySQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/write"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Creates a server with the specified parameters or update the properties or tags for the specified server."), - // Operation: to.Ptr("Create/Update MySQL Server"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("MySQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/delete"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Deletes an existing server."), - // Operation: to.Ptr("Delete MySQL Server"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("MySQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/performanceTiers/read"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Returns the list of Performance Tiers available."), - // Operation: to.Ptr("List Performance Tiers"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Performance Tiers"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/recoverableServers/read"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Return the recoverable MySQL Server info"), - // Operation: to.Ptr("Get Recoverable MySQL Server info"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Recoverable MySQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Return types of metrics that are available for databases"), - // Operation: to.Ptr("Get database metric definitions"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Database Metric Definition"), - // }, - // Properties: map[string]any{ - // "serviceSpecification": map[string]any{ - // "metricSpecifications":[]any{ - // map[string]any{ - // "name": "cpu_percent", - // "aggregationType": "Average", - // "displayDescription": "CPU percent", - // "displayName": "CPU percent", - // "fillGapWithZero": true, - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "memory_percent", - // "aggregationType": "Average", - // "displayDescription": "Memory percent", - // "displayName": "Memory percent", - // "fillGapWithZero": true, - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "io_consumption_percent", - // "aggregationType": "Average", - // "displayDescription": "IO percent", - // "displayName": "IO percent", - // "fillGapWithZero": true, - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "storage_percent", - // "aggregationType": "Average", - // "displayDescription": "Storage percentage", - // "displayName": "Storage percentage", - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "storage_used", - // "aggregationType": "Average", - // "displayDescription": "Storage used", - // "displayName": "Storage used", - // "unit": "Bytes", - // }, - // map[string]any{ - // "name": "storage_limit", - // "aggregationType": "Average", - // "displayDescription": "Storage limit", - // "displayName": "Storage limit", - // "unit": "Bytes", - // }, - // map[string]any{ - // "name": "serverlog_storage_percent", - // "aggregationType": "Average", - // "displayDescription": "Server Log storage percent", - // "displayName": "Server Log storage percent", - // "unit": "Percent", - // }, - // map[string]any{ - // "name": "serverlog_storage_usage", - // "aggregationType": "Average", - // "displayDescription": "Server Log storage used", - // "displayName": "Server Log storage used", - // "unit": "Bytes", - // }, - // map[string]any{ - // "name": "serverlog_storage_limit", - // "aggregationType": "Average", - // "displayDescription": "Server Log storage limit", - // "displayName": "Server Log storage limit", - // "unit": "Bytes", - // }, - // map[string]any{ - // "name": "active_connections", - // "aggregationType": "Average", - // "displayDescription": "Total active connections", - // "displayName": "Total active connections", - // "fillGapWithZero": true, - // "unit": "Count", - // }, - // map[string]any{ - // "name": "connections_failed", - // "aggregationType": "Average", - // "displayDescription": "Total failed connections", - // "displayName": "Total failed connections", - // "fillGapWithZero": true, - // "unit": "Count", - // }, - // map[string]any{ - // "name": "seconds_behind_master", - // "aggregationType": "Average", - // "displayDescription": "Replication lag in seconds", - // "displayName": "Replication lag in seconds", - // "fillGapWithZero": true, - // "unit": "Count", - // }, - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/providers/Microsoft.Insights/diagnosticSettings/read"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Gets the disagnostic setting for the resource"), - // Operation: to.Ptr("Read diagnostic setting"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Database Metric Definition"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforMySQL/servers/providers/Microsoft.Insights/diagnosticSettings/write"), - // Display: &armmysql.OperationDisplay{ - // Description: to.Ptr("Creates or updates the diagnostic setting for the resource"), - // Operation: to.Ptr("Write diagnostic setting"), - // Provider: to.Ptr("Microsoft DB for MySQL"), - // Resource: to.Ptr("Database Metric Definition"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/mysql/armmysql/options.go b/sdk/resourcemanager/mysql/armmysql/options.go new file mode 100644 index 000000000000..71215c06bc6b --- /dev/null +++ b/sdk/resourcemanager/mysql/armmysql/options.go @@ -0,0 +1,392 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmysql + +// AdvisorsClientGetOptions contains the optional parameters for the AdvisorsClient.Get method. +type AdvisorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AdvisorsClientListByServerOptions contains the optional parameters for the AdvisorsClient.NewListByServerPager method. +type AdvisorsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// CheckNameAvailabilityClientExecuteOptions contains the optional parameters for the CheckNameAvailabilityClient.Execute +// method. +type CheckNameAvailabilityClientExecuteOptions struct { + // placeholder for future optional parameters +} + +// ConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginCreateOrUpdate +// method. +type ConfigurationsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. +type ConfigurationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.NewListByServerPager +// method. +type ConfigurationsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the DatabasesClient.BeginCreateOrUpdate +// method. +type DatabasesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. +type DatabasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. +type DatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientListByServerOptions contains the optional parameters for the DatabasesClient.NewListByServerPager method. +type DatabasesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate +// method. +type FirewallRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method. +type FirewallRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +type FirewallRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientListByServerOptions contains the optional parameters for the FirewallRulesClient.NewListByServerPager +// method. +type FirewallRulesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// LocationBasedPerformanceTierClientListOptions contains the optional parameters for the LocationBasedPerformanceTierClient.NewListPager +// method. +type LocationBasedPerformanceTierClientListOptions struct { + // placeholder for future optional parameters +} + +// LocationBasedRecommendedActionSessionsOperationStatusClientGetOptions contains the optional parameters for the LocationBasedRecommendedActionSessionsOperationStatusClient.Get +// method. +type LocationBasedRecommendedActionSessionsOperationStatusClientGetOptions struct { + // placeholder for future optional parameters +} + +// LocationBasedRecommendedActionSessionsResultClientListOptions contains the optional parameters for the LocationBasedRecommendedActionSessionsResultClient.NewListPager +// method. +type LocationBasedRecommendedActionSessionsResultClientListOptions struct { + // placeholder for future optional parameters +} + +// LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.NewListByServerPager method. +type LogFilesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ManagementClientBeginCreateRecommendedActionSessionOptions contains the optional parameters for the ManagementClient.BeginCreateRecommendedActionSession +// method. +type ManagementClientBeginCreateRecommendedActionSessionOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ManagementClientResetQueryPerformanceInsightDataOptions contains the optional parameters for the ManagementClient.ResetQueryPerformanceInsightData +// method. +type ManagementClientResetQueryPerformanceInsightDataOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginUpdateTagsOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginUpdateTags +// method. +type PrivateEndpointConnectionsClientBeginUpdateTagsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByServerOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByServerPager +// method. +type PrivateEndpointConnectionsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByServerOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByServerPager +// method. +type PrivateLinkResourcesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// QueryTextsClientGetOptions contains the optional parameters for the QueryTextsClient.Get method. +type QueryTextsClientGetOptions struct { + // placeholder for future optional parameters +} + +// QueryTextsClientListByServerOptions contains the optional parameters for the QueryTextsClient.NewListByServerPager method. +type QueryTextsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// RecommendedActionsClientGetOptions contains the optional parameters for the RecommendedActionsClient.Get method. +type RecommendedActionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RecommendedActionsClientListByServerOptions contains the optional parameters for the RecommendedActionsClient.NewListByServerPager +// method. +type RecommendedActionsClientListByServerOptions struct { + // The recommendation action session identifier. + SessionID *string +} + +// RecoverableServersClientGetOptions contains the optional parameters for the RecoverableServersClient.Get method. +type RecoverableServersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientListByServerOptions contains the optional parameters for the ReplicasClient.NewListByServerPager method. +type ReplicasClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServerAdministratorsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerAdministratorsClient.BeginCreateOrUpdate +// method. +type ServerAdministratorsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerAdministratorsClientBeginDeleteOptions contains the optional parameters for the ServerAdministratorsClient.BeginDelete +// method. +type ServerAdministratorsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerAdministratorsClientGetOptions contains the optional parameters for the ServerAdministratorsClient.Get method. +type ServerAdministratorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerAdministratorsClientListOptions contains the optional parameters for the ServerAdministratorsClient.NewListPager +// method. +type ServerAdministratorsClientListOptions struct { + // placeholder for future optional parameters +} + +// ServerBasedPerformanceTierClientListOptions contains the optional parameters for the ServerBasedPerformanceTierClient.NewListPager +// method. +type ServerBasedPerformanceTierClientListOptions struct { + // placeholder for future optional parameters +} + +// ServerKeysClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerKeysClient.BeginCreateOrUpdate +// method. +type ServerKeysClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerKeysClientBeginDeleteOptions contains the optional parameters for the ServerKeysClient.BeginDelete method. +type ServerKeysClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerKeysClientGetOptions contains the optional parameters for the ServerKeysClient.Get method. +type ServerKeysClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerKeysClientListOptions contains the optional parameters for the ServerKeysClient.NewListPager method. +type ServerKeysClientListOptions struct { + // placeholder for future optional parameters +} + +// ServerParametersClientBeginListUpdateConfigurationsOptions contains the optional parameters for the ServerParametersClient.BeginListUpdateConfigurations +// method. +type ServerParametersClientBeginListUpdateConfigurationsOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate +// method. +type ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.Get +// method. +type ServerSecurityAlertPoliciesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerSecurityAlertPoliciesClientListByServerOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.NewListByServerPager +// method. +type ServerSecurityAlertPoliciesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ServersClientBeginCreateOptions contains the optional parameters for the ServersClient.BeginCreate method. +type ServersClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginDeleteOptions contains the optional parameters for the ServersClient.BeginDelete method. +type ServersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginRestartOptions contains the optional parameters for the ServersClient.BeginRestart method. +type ServersClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginStartOptions contains the optional parameters for the ServersClient.BeginStart method. +type ServersClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginStopOptions contains the optional parameters for the ServersClient.BeginStop method. +type ServersClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. +type ServersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientBeginUpgradeOptions contains the optional parameters for the ServersClient.BeginUpgrade method. +type ServersClientBeginUpgradeOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. +type ServersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServersClientListByResourceGroupOptions contains the optional parameters for the ServersClient.NewListByResourceGroupPager +// method. +type ServersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ServersClientListOptions contains the optional parameters for the ServersClient.NewListPager method. +type ServersClientListOptions struct { + // placeholder for future optional parameters +} + +// TopQueryStatisticsClientGetOptions contains the optional parameters for the TopQueryStatisticsClient.Get method. +type TopQueryStatisticsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TopQueryStatisticsClientListByServerOptions contains the optional parameters for the TopQueryStatisticsClient.NewListByServerPager +// method. +type TopQueryStatisticsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginCreateOrUpdate +// method. +type VirtualNetworkRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkRulesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkRulesClient.BeginDelete +// method. +type VirtualNetworkRulesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// VirtualNetworkRulesClientGetOptions contains the optional parameters for the VirtualNetworkRulesClient.Get method. +type VirtualNetworkRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// VirtualNetworkRulesClientListByServerOptions contains the optional parameters for the VirtualNetworkRulesClient.NewListByServerPager +// method. +type VirtualNetworkRulesClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// WaitStatisticsClientGetOptions contains the optional parameters for the WaitStatisticsClient.Get method. +type WaitStatisticsClientGetOptions struct { + // placeholder for future optional parameters +} + +// WaitStatisticsClientListByServerOptions contains the optional parameters for the WaitStatisticsClient.NewListByServerPager +// method. +type WaitStatisticsClientListByServerOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/mysql/armmysql/polymorphic_helpers.go b/sdk/resourcemanager/mysql/armmysql/polymorphic_helpers.go index cde1cc20efdf..552b8139acb3 100644 --- a/sdk/resourcemanager/mysql/armmysql/polymorphic_helpers.go +++ b/sdk/resourcemanager/mysql/armmysql/polymorphic_helpers.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -32,5 +31,8 @@ func unmarshalServerPropertiesForCreateClassification(rawMsg json.RawMessage) (S default: b = &ServerPropertiesForCreate{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/privateendpointconnections_client.go b/sdk/resourcemanager/mysql/armmysql/privateendpointconnections_client.go index 34bd491471f6..0b16d3233711 100644 --- a/sdk/resourcemanager/mysql/armmysql/privateendpointconnections_client.go +++ b/sdk/resourcemanager/mysql/armmysql/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -58,7 +57,8 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,18 +69,20 @@ func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context. // // Generated from API version 2018-06-01 func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -110,7 +112,10 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx reqQP.Set("api-version", "2018-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a private endpoint connection with a given name. @@ -127,7 +132,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -138,18 +144,20 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // // Generated from API version 2018-06-01 func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -192,18 +200,21 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -330,7 +341,8 @@ func (client *PrivateEndpointConnectionsClient) BeginUpdateTags(ctx context.Cont if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientUpdateTagsResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientUpdateTagsResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientUpdateTagsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -341,18 +353,20 @@ func (client *PrivateEndpointConnectionsClient) BeginUpdateTags(ctx context.Cont // // Generated from API version 2018-06-01 func (client *PrivateEndpointConnectionsClient) updateTags(ctx context.Context, resourceGroupName string, serverName string, privateEndpointConnectionName string, parameters TagsObject, options *PrivateEndpointConnectionsClientBeginUpdateTagsOptions) (*http.Response, error) { + var err error req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, serverName, privateEndpointConnectionName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateTagsCreateRequest creates the UpdateTags request. @@ -382,5 +396,8 @@ func (client *PrivateEndpointConnectionsClient) updateTagsCreateRequest(ctx cont reqQP.Set("api-version", "2018-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/privateendpointconnections_client_example_test.go deleted file mode 100644 index 4284c6238efe..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,228 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "Default", "test-svr", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmysql.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforMySQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmysql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "Default", "test-svr", "private-endpoint-connection-name", armmysql.PrivateEndpointConnection{ - Properties: &armmysql.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armmysql.PrivateLinkServiceConnectionStateProperty{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr("Approved"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmysql.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforMySQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmysql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "Default", "test-svr", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json -func ExamplePrivateEndpointConnectionsClient_BeginUpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginUpdateTags(ctx, "Default", "test-svr", "private-endpoint-connection-name", armmysql.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - "key2": to.Ptr("val2"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmysql.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforMySQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmysql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListByServerPager("Default", "test-svr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionListResult = armmysql.PrivateEndpointConnectionListResult{ - // Value: []*armmysql.PrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforMySQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmysql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }, - // { - // Name: to.Ptr("private-endpoint-connection-name-2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforMySQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmysql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/privatelinkresources_client.go b/sdk/resourcemanager/mysql/armmysql/privatelinkresources_client.go index fc837d0b6c25..5fa67d0485f2 100644 --- a/sdk/resourcemanager/mysql/armmysql/privatelinkresources_client.go +++ b/sdk/resourcemanager/mysql/armmysql/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -54,18 +53,21 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get // method. func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, serverName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, groupName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/privatelinkresources_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/privatelinkresources_client_example_test.go deleted file mode 100644 index 7a8467abe516..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,86 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json -func ExamplePrivateLinkResourcesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListByServerPager("Default", "test-svr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceListResult = armmysql.PrivateLinkResourceListResult{ - // Value: []*armmysql.PrivateLinkResource{ - // { - // Name: to.Ptr("plr"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforMySQL/servers/test-svr/privateLinkResources/plr"), - // Properties: &armmysql.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("mysqlServer"), - // RequiredMembers: []*string{ - // to.Ptr("mysqlServer")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "Default", "test-svr", "plr", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateLinkResource = armmysql.PrivateLinkResource{ - // Name: to.Ptr("plr"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforMySQL/servers/test-svr/privateLinkResources/plr"), - // Properties: &armmysql.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("mysqlServer"), - // RequiredMembers: []*string{ - // to.Ptr("mysqlServer")}, - // }, - // } -} diff --git a/sdk/resourcemanager/mysql/armmysql/querytexts_client.go b/sdk/resourcemanager/mysql/armmysql/querytexts_client.go index 0864037a91ef..a3067736f244 100644 --- a/sdk/resourcemanager/mysql/armmysql/querytexts_client.go +++ b/sdk/resourcemanager/mysql/armmysql/querytexts_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -53,18 +52,21 @@ func NewQueryTextsClient(subscriptionID string, credential azcore.TokenCredentia // - queryID - The Query-Store query identifier. // - options - QueryTextsClientGetOptions contains the optional parameters for the QueryTextsClient.Get method. func (client *QueryTextsClient) Get(ctx context.Context, resourceGroupName string, serverName string, queryID string, options *QueryTextsClientGetOptions) (QueryTextsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, queryID, options) if err != nil { return QueryTextsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return QueryTextsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return QueryTextsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return QueryTextsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/querytexts_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/querytexts_client_example_test.go deleted file mode 100644 index 4a1e0529d307..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/querytexts_client_example_test.go +++ /dev/null @@ -1,95 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsGet.json -func ExampleQueryTextsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQueryTextsClient().Get(ctx, "testResourceGroupName", "testServerName", "1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryText = armmysql.QueryText{ - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/queryTexts"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryTexts/1"), - // Properties: &armmysql.QueryTextProperties{ - // QueryID: to.Ptr("1"), - // QueryText: to.Ptr("UPDATE `performance_schema`.`setup_instruments` SET `ENABLED` = ? , `TIMED` = ? WHERE NAME = ?"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/QueryTextsListByServer.json -func ExampleQueryTextsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewQueryTextsClient().NewListByServerPager("testResourceGroupName", "testServerName", []string{ - "1", - "2"}, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.QueryTextsResultList = armmysql.QueryTextsResultList{ - // Value: []*armmysql.QueryText{ - // { - // Name: to.Ptr("1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/queryTexts"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryTexts/1"), - // Properties: &armmysql.QueryTextProperties{ - // QueryID: to.Ptr("1"), - // QueryText: to.Ptr("UPDATE `performance_schema`.`setup_instruments` SET `ENABLED` = ? , `TIMED` = ? WHERE NAME = ?"), - // }, - // }, - // { - // Name: to.Ptr("2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/queryTexts"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryTexts/2"), - // Properties: &armmysql.QueryTextProperties{ - // QueryID: to.Ptr("2"), - // QueryText: to.Ptr("UPDATE `performance_schema`.`setup_instruments` SET `ENABLED` = ? , `TIMED` = ? WHERE NAME LIKE ?"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/recommendedactions_client.go b/sdk/resourcemanager/mysql/armmysql/recommendedactions_client.go index 30473fd5fa8e..ee9a61071b5e 100644 --- a/sdk/resourcemanager/mysql/armmysql/recommendedactions_client.go +++ b/sdk/resourcemanager/mysql/armmysql/recommendedactions_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -54,18 +53,21 @@ func NewRecommendedActionsClient(subscriptionID string, credential azcore.TokenC // - recommendedActionName - The recommended action name. // - options - RecommendedActionsClientGetOptions contains the optional parameters for the RecommendedActionsClient.Get method. func (client *RecommendedActionsClient) Get(ctx context.Context, resourceGroupName string, serverName string, advisorName string, recommendedActionName string, options *RecommendedActionsClientGetOptions) (RecommendedActionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, advisorName, recommendedActionName, options) if err != nil { return RecommendedActionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RecommendedActionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RecommendedActionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecommendedActionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/recommendedactions_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/recommendedactions_client_example_test.go deleted file mode 100644 index 84f646b7ab5a..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/recommendedactions_client_example_test.go +++ /dev/null @@ -1,141 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionsGet.json -func ExampleRecommendedActionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecommendedActionsClient().Get(ctx, "testResourceGroupName", "testServerName", "Index", "Index-1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecommendationAction = armmysql.RecommendationAction{ - // Name: to.Ptr("Index-1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.Sql/servers/testServerName/advisors/Index/recommendedActions/Index-1"), - // Properties: &armmysql.RecommendationActionProperties{ - // ActionID: to.Ptr[int32](1), - // AdvisorName: to.Ptr("Index"), - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T23:43:24Z"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T23:43:24Z"); return t}()), - // Reason: to.Ptr("Column `movies_genres`.`movie_id` appear in Join On clause(s)."), - // RecommendationType: to.Ptr("Add"), - // SessionID: to.Ptr("c63c2114-e2a4-4c7a-98c1-85577d1a5d50"), - // Details: map[string]*string{ - // "engine": to.Ptr("InnoDB"), - // "indexColumns": to.Ptr("`movies_genres`.`movie_id`"), - // "indexName": to.Ptr("idx_movie_id"), - // "indexType": to.Ptr("BTREE"), - // "parentTableName": to.Ptr("movies_genres"), - // "queryIds": to.Ptr("779"), - // "schemaName": to.Ptr("movies"), - // "script": to.Ptr("alter table `movies`.`movies_genres` add index `idx_movie_id` (`movie_id`)"), - // "tableName": to.Ptr("movies_genres"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/RecommendedActionsListByServer.json -func ExampleRecommendedActionsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecommendedActionsClient().NewListByServerPager("testResourceGroupName", "testServerName", "Index", &armmysql.RecommendedActionsClientListByServerOptions{SessionID: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RecommendationActionsResultList = armmysql.RecommendationActionsResultList{ - // Value: []*armmysql.RecommendationAction{ - // { - // Name: to.Ptr("Index-1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.Sql/servers/testServerName/advisors/Index/recommendedActions/Index-1"), - // Properties: &armmysql.RecommendationActionProperties{ - // ActionID: to.Ptr[int32](1), - // AdvisorName: to.Ptr("Index"), - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T23:43:24Z"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T23:43:24Z"); return t}()), - // Reason: to.Ptr("Column `movies_genres`.`movie_id` appear in Join On clause(s)."), - // RecommendationType: to.Ptr("Add"), - // SessionID: to.Ptr("c63c2114-e2a4-4c7a-98c1-85577d1a5d50"), - // Details: map[string]*string{ - // "engine": to.Ptr("InnoDB"), - // "indexColumns": to.Ptr("`movies_genres`.`movie_id`"), - // "indexName": to.Ptr("idx_movie_id"), - // "indexType": to.Ptr("BTREE"), - // "parentTableName": to.Ptr("movies_genres"), - // "queryIds": to.Ptr("779"), - // "schemaName": to.Ptr("movies"), - // "script": to.Ptr("alter table `movies`.`movies_genres` add index `idx_movie_id` (`movie_id`)"), - // "tableName": to.Ptr("movies_genres"), - // }, - // }, - // }, - // { - // Name: to.Ptr("Index-2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/advisors/recommendedActions"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.Sql/servers/testServerName/advisors/Index/recommendedActions/Index-2"), - // Properties: &armmysql.RecommendationActionProperties{ - // ActionID: to.Ptr[int32](2), - // AdvisorName: to.Ptr("Index"), - // CreatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T23:43:24Z"); return t}()), - // ExpirationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-08T23:43:24Z"); return t}()), - // Reason: to.Ptr("Column `movies_genres`.`genre` appear in Group By clause(s)."), - // RecommendationType: to.Ptr("Add"), - // SessionID: to.Ptr("c63c2114-e2a4-4c7a-98c1-85577d1a5d50"), - // Details: map[string]*string{ - // "engine": to.Ptr("InnoDB"), - // "indexColumns": to.Ptr("`movies_genres`.`genre`"), - // "indexName": to.Ptr("idx_genre"), - // "indexType": to.Ptr("BTREE"), - // "parentTableName": to.Ptr("movies_genres"), - // "queryIds": to.Ptr("779"), - // "schemaName": to.Ptr("movies"), - // "script": to.Ptr("alter table `movies`.`movies_genres` add index `idx_genre` (`genre`)"), - // "tableName": to.Ptr("movies_genres"), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/recoverableservers_client.go b/sdk/resourcemanager/mysql/armmysql/recoverableservers_client.go index fcf69eab48d2..17f7086f77e9 100644 --- a/sdk/resourcemanager/mysql/armmysql/recoverableservers_client.go +++ b/sdk/resourcemanager/mysql/armmysql/recoverableservers_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -52,18 +51,21 @@ func NewRecoverableServersClient(subscriptionID string, credential azcore.TokenC // - serverName - The name of the server. // - options - RecoverableServersClientGetOptions contains the optional parameters for the RecoverableServersClient.Get method. func (client *RecoverableServersClient) Get(ctx context.Context, resourceGroupName string, serverName string, options *RecoverableServersClientGetOptions) (RecoverableServersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return RecoverableServersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return RecoverableServersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RecoverableServersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return RecoverableServersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/recoverableservers_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/recoverableservers_client_example_test.go deleted file mode 100644 index b0e80c8428ad..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/recoverableservers_client_example_test.go +++ /dev/null @@ -1,51 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/RecoverableServersGet.json -func ExampleRecoverableServersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoverableServersClient().Get(ctx, "testrg", "testsvc4", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.RecoverableServerResource = armmysql.RecoverableServerResource{ - // Name: to.Ptr("recoverableServers"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/recoverableServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/testsvc4/recoverableServers"), - // Properties: &armmysql.RecoverableServerProperties{ - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // LastAvailableBackupDateTime: to.Ptr("2020-11-20T01:06:29.78Z"), - // ServiceLevelObjective: to.Ptr("GP_Gen5_2"), - // VCore: to.Ptr[int32](2), - // Version: to.Ptr("5.7"), - // }, - // } -} diff --git a/sdk/resourcemanager/mysql/armmysql/replicas_client.go b/sdk/resourcemanager/mysql/armmysql/replicas_client.go index 9b39415f5279..05a9985e00ec 100644 --- a/sdk/resourcemanager/mysql/armmysql/replicas_client.go +++ b/sdk/resourcemanager/mysql/armmysql/replicas_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql diff --git a/sdk/resourcemanager/mysql/armmysql/replicas_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/replicas_client_example_test.go deleted file mode 100644 index 98dea15dafe4..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/replicas_client_example_test.go +++ /dev/null @@ -1,139 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ReplicasListByServer.json -func ExampleReplicasClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReplicasClient().NewListByServerPager("TestGroup", "testmaster", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armmysql.ServerListResult{ - // Value: []*armmysql.Server{ - // { - // Name: to.Ptr("testserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver"), - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "elasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:56:54.3+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver.mysql.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](35), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](256000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive6), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("testserver1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver1"), - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "elasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:56:54.3+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver1.mysql.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](35), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](256000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive6), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("testserver2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testserver2"), - // Location: to.Ptr("northeurope"), - // Tags: map[string]*string{ - // "elasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-11T23:56:54.3+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver2.mysql.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/testmaster"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](35), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](256000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive6), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/response_types.go b/sdk/resourcemanager/mysql/armmysql/response_types.go index cdce43facd87..4e2f9fdb157c 100644 --- a/sdk/resourcemanager/mysql/armmysql/response_types.go +++ b/sdk/resourcemanager/mysql/armmysql/response_types.go @@ -3,44 +3,50 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql // AdvisorsClientGetResponse contains the response from method AdvisorsClient.Get. type AdvisorsClientGetResponse struct { + // Represents a recommendation action advisor. Advisor } // AdvisorsClientListByServerResponse contains the response from method AdvisorsClient.NewListByServerPager. type AdvisorsClientListByServerResponse struct { + // A list of query statistics. AdvisorsResultList } // CheckNameAvailabilityClientExecuteResponse contains the response from method CheckNameAvailabilityClient.Execute. type CheckNameAvailabilityClientExecuteResponse struct { + // Represents a resource name availability. NameAvailability } // ConfigurationsClientCreateOrUpdateResponse contains the response from method ConfigurationsClient.BeginCreateOrUpdate. type ConfigurationsClientCreateOrUpdateResponse struct { + // Represents a Configuration. Configuration } // ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. type ConfigurationsClientGetResponse struct { + // Represents a Configuration. Configuration } // ConfigurationsClientListByServerResponse contains the response from method ConfigurationsClient.NewListByServerPager. type ConfigurationsClientListByServerResponse struct { + // A list of server configurations. ConfigurationListResult } // DatabasesClientCreateOrUpdateResponse contains the response from method DatabasesClient.BeginCreateOrUpdate. type DatabasesClientCreateOrUpdateResponse struct { + // Represents a Database. Database } @@ -51,16 +57,19 @@ type DatabasesClientDeleteResponse struct { // DatabasesClientGetResponse contains the response from method DatabasesClient.Get. type DatabasesClientGetResponse struct { + // Represents a Database. Database } // DatabasesClientListByServerResponse contains the response from method DatabasesClient.NewListByServerPager. type DatabasesClientListByServerResponse struct { + // A List of databases. DatabaseListResult } // FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.BeginCreateOrUpdate. type FirewallRulesClientCreateOrUpdateResponse struct { + // Represents a server firewall rule. FirewallRule } @@ -71,31 +80,37 @@ type FirewallRulesClientDeleteResponse struct { // FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. type FirewallRulesClientGetResponse struct { + // Represents a server firewall rule. FirewallRule } // FirewallRulesClientListByServerResponse contains the response from method FirewallRulesClient.NewListByServerPager. type FirewallRulesClientListByServerResponse struct { + // A list of firewall rules. FirewallRuleListResult } // LocationBasedPerformanceTierClientListResponse contains the response from method LocationBasedPerformanceTierClient.NewListPager. type LocationBasedPerformanceTierClientListResponse struct { + // A list of performance tiers. PerformanceTierListResult } // LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse contains the response from method LocationBasedRecommendedActionSessionsOperationStatusClient.Get. type LocationBasedRecommendedActionSessionsOperationStatusClientGetResponse struct { + // Recommendation action session operation status. RecommendedActionSessionsOperationStatus } // LocationBasedRecommendedActionSessionsResultClientListResponse contains the response from method LocationBasedRecommendedActionSessionsResultClient.NewListPager. type LocationBasedRecommendedActionSessionsResultClientListResponse struct { + // A list of recommendation actions. RecommendationActionsResultList } // LogFilesClientListByServerResponse contains the response from method LogFilesClient.NewListByServerPager. type LogFilesClientListByServerResponse struct { + // A list of log files. LogFileListResult } @@ -106,16 +121,19 @@ type ManagementClientCreateRecommendedActionSessionResponse struct { // ManagementClientResetQueryPerformanceInsightDataResponse contains the response from method ManagementClient.ResetQueryPerformanceInsightData. type ManagementClientResetQueryPerformanceInsightDataResponse struct { + // Result of Query Performance Insight data reset. QueryPerformanceInsightResetDataResult } // OperationsClientListResponse contains the response from method OperationsClient.List. type OperationsClientListResponse struct { + // A list of resource provider operations. OperationListResult } // PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // A private endpoint connection PrivateEndpointConnection } @@ -126,61 +144,73 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // A private endpoint connection PrivateEndpointConnection } // PrivateEndpointConnectionsClientListByServerResponse contains the response from method PrivateEndpointConnectionsClient.NewListByServerPager. type PrivateEndpointConnectionsClientListByServerResponse struct { + // A list of private endpoint connections. PrivateEndpointConnectionListResult } // PrivateEndpointConnectionsClientUpdateTagsResponse contains the response from method PrivateEndpointConnectionsClient.BeginUpdateTags. type PrivateEndpointConnectionsClientUpdateTagsResponse struct { + // A private endpoint connection PrivateEndpointConnection } // PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. type PrivateLinkResourcesClientGetResponse struct { + // A private link resource PrivateLinkResource } // PrivateLinkResourcesClientListByServerResponse contains the response from method PrivateLinkResourcesClient.NewListByServerPager. type PrivateLinkResourcesClientListByServerResponse struct { + // A list of private link resources PrivateLinkResourceListResult } // QueryTextsClientGetResponse contains the response from method QueryTextsClient.Get. type QueryTextsClientGetResponse struct { + // Represents a Query Text. QueryText } // QueryTextsClientListByServerResponse contains the response from method QueryTextsClient.NewListByServerPager. type QueryTextsClientListByServerResponse struct { + // A list of query texts. QueryTextsResultList } // RecommendedActionsClientGetResponse contains the response from method RecommendedActionsClient.Get. type RecommendedActionsClientGetResponse struct { + // Represents a Recommendation Action. RecommendationAction } // RecommendedActionsClientListByServerResponse contains the response from method RecommendedActionsClient.NewListByServerPager. type RecommendedActionsClientListByServerResponse struct { + // A list of recommendation actions. RecommendationActionsResultList } // RecoverableServersClientGetResponse contains the response from method RecoverableServersClient.Get. type RecoverableServersClientGetResponse struct { + // A recoverable server resource. RecoverableServerResource } // ReplicasClientListByServerResponse contains the response from method ReplicasClient.NewListByServerPager. type ReplicasClientListByServerResponse struct { + // A list of servers. ServerListResult } // ServerAdministratorsClientCreateOrUpdateResponse contains the response from method ServerAdministratorsClient.BeginCreateOrUpdate. type ServerAdministratorsClientCreateOrUpdateResponse struct { + // Represents a and external administrator to be created. ServerAdministratorResource } @@ -191,21 +221,25 @@ type ServerAdministratorsClientDeleteResponse struct { // ServerAdministratorsClientGetResponse contains the response from method ServerAdministratorsClient.Get. type ServerAdministratorsClientGetResponse struct { + // Represents a and external administrator to be created. ServerAdministratorResource } // ServerAdministratorsClientListResponse contains the response from method ServerAdministratorsClient.NewListPager. type ServerAdministratorsClientListResponse struct { + // The response to a list Active Directory Administrators request. ServerAdministratorResourceListResult } // ServerBasedPerformanceTierClientListResponse contains the response from method ServerBasedPerformanceTierClient.NewListPager. type ServerBasedPerformanceTierClientListResponse struct { + // A list of performance tiers. PerformanceTierListResult } // ServerKeysClientCreateOrUpdateResponse contains the response from method ServerKeysClient.BeginCreateOrUpdate. type ServerKeysClientCreateOrUpdateResponse struct { + // A MySQL Server key. ServerKey } @@ -216,36 +250,43 @@ type ServerKeysClientDeleteResponse struct { // ServerKeysClientGetResponse contains the response from method ServerKeysClient.Get. type ServerKeysClientGetResponse struct { + // A MySQL Server key. ServerKey } // ServerKeysClientListResponse contains the response from method ServerKeysClient.NewListPager. type ServerKeysClientListResponse struct { + // A list of MySQL Server keys. ServerKeyListResult } // ServerParametersClientListUpdateConfigurationsResponse contains the response from method ServerParametersClient.BeginListUpdateConfigurations. type ServerParametersClientListUpdateConfigurationsResponse struct { + // A list of server configurations. ConfigurationListResult } // ServerSecurityAlertPoliciesClientCreateOrUpdateResponse contains the response from method ServerSecurityAlertPoliciesClient.BeginCreateOrUpdate. type ServerSecurityAlertPoliciesClientCreateOrUpdateResponse struct { + // A server security alert policy. ServerSecurityAlertPolicy } // ServerSecurityAlertPoliciesClientGetResponse contains the response from method ServerSecurityAlertPoliciesClient.Get. type ServerSecurityAlertPoliciesClientGetResponse struct { + // A server security alert policy. ServerSecurityAlertPolicy } // ServerSecurityAlertPoliciesClientListByServerResponse contains the response from method ServerSecurityAlertPoliciesClient.NewListByServerPager. type ServerSecurityAlertPoliciesClientListByServerResponse struct { + // A list of the server's security alert policies. ServerSecurityAlertPolicyListResult } // ServersClientCreateResponse contains the response from method ServersClient.BeginCreate. type ServersClientCreateResponse struct { + // Represents a server. Server } @@ -256,16 +297,19 @@ type ServersClientDeleteResponse struct { // ServersClientGetResponse contains the response from method ServersClient.Get. type ServersClientGetResponse struct { + // Represents a server. Server } // ServersClientListByResourceGroupResponse contains the response from method ServersClient.NewListByResourceGroupPager. type ServersClientListByResourceGroupResponse struct { + // A list of servers. ServerListResult } // ServersClientListResponse contains the response from method ServersClient.NewListPager. type ServersClientListResponse struct { + // A list of servers. ServerListResult } @@ -286,6 +330,7 @@ type ServersClientStopResponse struct { // ServersClientUpdateResponse contains the response from method ServersClient.BeginUpdate. type ServersClientUpdateResponse struct { + // Represents a server. Server } @@ -296,16 +341,19 @@ type ServersClientUpgradeResponse struct { // TopQueryStatisticsClientGetResponse contains the response from method TopQueryStatisticsClient.Get. type TopQueryStatisticsClientGetResponse struct { + // Represents a Query Statistic. QueryStatistic } // TopQueryStatisticsClientListByServerResponse contains the response from method TopQueryStatisticsClient.NewListByServerPager. type TopQueryStatisticsClientListByServerResponse struct { + // A list of query statistics. TopQueryStatisticsResultList } // VirtualNetworkRulesClientCreateOrUpdateResponse contains the response from method VirtualNetworkRulesClient.BeginCreateOrUpdate. type VirtualNetworkRulesClientCreateOrUpdateResponse struct { + // A virtual network rule. VirtualNetworkRule } @@ -316,20 +364,24 @@ type VirtualNetworkRulesClientDeleteResponse struct { // VirtualNetworkRulesClientGetResponse contains the response from method VirtualNetworkRulesClient.Get. type VirtualNetworkRulesClientGetResponse struct { + // A virtual network rule. VirtualNetworkRule } // VirtualNetworkRulesClientListByServerResponse contains the response from method VirtualNetworkRulesClient.NewListByServerPager. type VirtualNetworkRulesClientListByServerResponse struct { + // A list of virtual network rules. VirtualNetworkRuleListResult } // WaitStatisticsClientGetResponse contains the response from method WaitStatisticsClient.Get. type WaitStatisticsClientGetResponse struct { + // Represents a Wait Statistic. WaitStatistic } // WaitStatisticsClientListByServerResponse contains the response from method WaitStatisticsClient.NewListByServerPager. type WaitStatisticsClientListByServerResponse struct { + // A list of wait statistics. WaitStatisticsResultList } diff --git a/sdk/resourcemanager/mysql/armmysql/serveradministrators_client.go b/sdk/resourcemanager/mysql/armmysql/serveradministrators_client.go index 38b26a77a7bb..1b5ffce310ba 100644 --- a/sdk/resourcemanager/mysql/armmysql/serveradministrators_client.go +++ b/sdk/resourcemanager/mysql/armmysql/serveradministrators_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -60,7 +59,8 @@ func (client *ServerAdministratorsClient) BeginCreateOrUpdate(ctx context.Contex if err != nil { return nil, err } - return runtime.NewPoller[ServerAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerAdministratorsClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerAdministratorsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,18 +72,20 @@ func (client *ServerAdministratorsClient) BeginCreateOrUpdate(ctx context.Contex // // Generated from API version 2017-12-01 func (client *ServerAdministratorsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, properties ServerAdministratorResource, options *ServerAdministratorsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, properties, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -109,7 +111,10 @@ func (client *ServerAdministratorsClient) createOrUpdateCreateRequest(ctx contex reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes server active directory administrator. @@ -126,7 +131,8 @@ func (client *ServerAdministratorsClient) BeginDelete(ctx context.Context, resou if err != nil { return nil, err } - return runtime.NewPoller[ServerAdministratorsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerAdministratorsClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerAdministratorsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -137,18 +143,20 @@ func (client *ServerAdministratorsClient) BeginDelete(ctx context.Context, resou // // Generated from API version 2017-12-01 func (client *ServerAdministratorsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, options *ServerAdministratorsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -186,18 +194,21 @@ func (client *ServerAdministratorsClient) deleteCreateRequest(ctx context.Contex // - options - ServerAdministratorsClientGetOptions contains the optional parameters for the ServerAdministratorsClient.Get // method. func (client *ServerAdministratorsClient) Get(ctx context.Context, resourceGroupName string, serverName string, options *ServerAdministratorsClientGetOptions) (ServerAdministratorsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ServerAdministratorsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerAdministratorsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerAdministratorsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerAdministratorsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/serveradministrators_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/serveradministrators_client_example_test.go deleted file mode 100644 index ae8ffaa4078c..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/serveradministrators_client_example_test.go +++ /dev/null @@ -1,152 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminGet.json -func ExampleServerAdministratorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAdministratorsClient().Get(ctx, "testrg", "mysqltestsvc4", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAdministratorResource = armmysql.ServerAdministratorResource{ - // Name: to.Ptr("activeDirectory"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4/administrators/activeDirectory"), - // Properties: &armmysql.ServerAdministratorProperties{ - // AdministratorType: to.Ptr("ActiveDirectory"), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json -func ExampleServerAdministratorsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAdministratorsClient().BeginCreateOrUpdate(ctx, "testrg", "mysqltestsvc4", armmysql.ServerAdministratorResource{ - Properties: &armmysql.ServerAdministratorProperties{ - AdministratorType: to.Ptr("ActiveDirectory"), - Login: to.Ptr("bob@contoso.com"), - Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - TenantID: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerAdministratorResource = armmysql.ServerAdministratorResource{ - // Name: to.Ptr("activeDirectory"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4/administrators/activeDirectory"), - // Properties: &armmysql.ServerAdministratorProperties{ - // AdministratorType: to.Ptr("ActiveDirectory"), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminDelete.json -func ExampleServerAdministratorsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAdministratorsClient().BeginDelete(ctx, "testrg", "mysqltestsvc4", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerAdminList.json -func ExampleServerAdministratorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerAdministratorsClient().NewListPager("testrg", "mysqltestsvc4", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerAdministratorResourceListResult = armmysql.ServerAdministratorResourceListResult{ - // Value: []*armmysql.ServerAdministratorResource{ - // { - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4/administrators/activeDirectory"), - // Properties: &armmysql.ServerAdministratorProperties{ - // AdministratorType: to.Ptr("ActiveDirectory"), - // Login: to.Ptr("bob@contoso.com"), - // Sid: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // TenantID: to.Ptr("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/serverbasedperformancetier_client.go b/sdk/resourcemanager/mysql/armmysql/serverbasedperformancetier_client.go index 158898cf2998..876142d0c5eb 100644 --- a/sdk/resourcemanager/mysql/armmysql/serverbasedperformancetier_client.go +++ b/sdk/resourcemanager/mysql/armmysql/serverbasedperformancetier_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql diff --git a/sdk/resourcemanager/mysql/armmysql/serverbasedperformancetier_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/serverbasedperformancetier_client_example_test.go deleted file mode 100644 index 55bcb2464559..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/serverbasedperformancetier_client_example_test.go +++ /dev/null @@ -1,206 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json -func ExampleServerBasedPerformanceTierClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerBasedPerformanceTierClient().NewListPager("testrg", "mysqltestsvc1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PerformanceTierListResult = armmysql.PerformanceTierListResult{ - // Value: []*armmysql.PerformanceTierProperties{ - // { - // ID: to.Ptr("Basic"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxLargeStorageMB: to.Ptr[int32](0), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinLargeStorageMB: to.Ptr[int32](0), - // MinStorageMB: to.Ptr[int32](5120), - // ServiceLevelObjectives: []*armmysql.PerformanceTierServiceLevelObjectives{ - // { - // Edition: to.Ptr("Basic"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("B_Gen5_1"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](1048576), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](1), - // }, - // { - // Edition: to.Ptr("Basic"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("B_Gen5_2"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](1048576), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](2), - // }}, - // }, - // { - // ID: to.Ptr("GeneralPurpose"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxLargeStorageMB: to.Ptr[int32](16777216), - // MaxStorageMB: to.Ptr[int32](16777216), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinLargeStorageMB: to.Ptr[int32](0), - // MinStorageMB: to.Ptr[int32](5120), - // ServiceLevelObjectives: []*armmysql.PerformanceTierServiceLevelObjectives{ - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_2"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](2), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_4"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](4), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_8"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](8), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_16"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](16), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_32"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](32), - // }, - // { - // Edition: to.Ptr("GeneralPurpose"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("GP_Gen5_64"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](32), - // }}, - // }, - // { - // ID: to.Ptr("MemoryOptimized"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxLargeStorageMB: to.Ptr[int32](16777216), - // MaxStorageMB: to.Ptr[int32](16777216), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinLargeStorageMB: to.Ptr[int32](0), - // MinStorageMB: to.Ptr[int32](5120), - // ServiceLevelObjectives: []*armmysql.PerformanceTierServiceLevelObjectives{ - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_2"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](2), - // }, - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_4"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](4), - // }, - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_8"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](8), - // }, - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_16"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](16), - // }, - // { - // Edition: to.Ptr("MemoryOptimized"), - // HardwareGeneration: to.Ptr("Gen5"), - // ID: to.Ptr("MO_Gen5_32"), - // MaxBackupRetentionDays: to.Ptr[int32](35), - // MaxStorageMB: to.Ptr[int32](2097152), - // MinBackupRetentionDays: to.Ptr[int32](7), - // MinStorageMB: to.Ptr[int32](5120), - // VCore: to.Ptr[int32](32), - // }}, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/serverkeys_client.go b/sdk/resourcemanager/mysql/armmysql/serverkeys_client.go index e20a3eb9f434..ed9a4e6705b3 100644 --- a/sdk/resourcemanager/mysql/armmysql/serverkeys_client.go +++ b/sdk/resourcemanager/mysql/armmysql/serverkeys_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -60,7 +59,8 @@ func (client *ServerKeysClient) BeginCreateOrUpdate(ctx context.Context, serverN if err != nil { return nil, err } - return runtime.NewPoller[ServerKeysClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerKeysClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerKeysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,18 +71,20 @@ func (client *ServerKeysClient) BeginCreateOrUpdate(ctx context.Context, serverN // // Generated from API version 2020-01-01 func (client *ServerKeysClient) createOrUpdate(ctx context.Context, serverName string, keyName string, resourceGroupName string, parameters ServerKey, options *ServerKeysClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, serverName, keyName, resourceGroupName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,7 +114,10 @@ func (client *ServerKeysClient) createOrUpdateCreateRequest(ctx context.Context, reqQP.Set("api-version", "2020-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the MySQL Server key with the given name. @@ -129,7 +134,8 @@ func (client *ServerKeysClient) BeginDelete(ctx context.Context, serverName stri if err != nil { return nil, err } - return runtime.NewPoller[ServerKeysClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerKeysClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerKeysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,18 +146,20 @@ func (client *ServerKeysClient) BeginDelete(ctx context.Context, serverName stri // // Generated from API version 2020-01-01 func (client *ServerKeysClient) deleteOperation(ctx context.Context, serverName string, keyName string, resourceGroupName string, options *ServerKeysClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, serverName, keyName, resourceGroupName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -193,18 +201,21 @@ func (client *ServerKeysClient) deleteCreateRequest(ctx context.Context, serverN // - keyName - The name of the MySQL Server key to be retrieved. // - options - ServerKeysClientGetOptions contains the optional parameters for the ServerKeysClient.Get method. func (client *ServerKeysClient) Get(ctx context.Context, resourceGroupName string, serverName string, keyName string, options *ServerKeysClientGetOptions) (ServerKeysClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, keyName, options) if err != nil { return ServerKeysClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerKeysClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerKeysClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerKeysClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/serverkeys_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/serverkeys_client_example_test.go deleted file mode 100644 index 08bd1b9314a2..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/serverkeys_client_example_test.go +++ /dev/null @@ -1,150 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyList.json -func ExampleServerKeysClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerKeysClient().NewListPager("testrg", "testserver", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerKeyListResult = armmysql.ServerKeyListResult{ - // Value: []*armmysql.ServerKey{ - // { - // Name: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/keys"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/testserver/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armmysql.ServerKeyProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00.0Z"); return t}()), - // ServerKeyType: to.Ptr(armmysql.ServerKeyTypeAzureKeyVault), - // URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyGet.json -func ExampleServerKeysClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerKeysClient().Get(ctx, "testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerKey = armmysql.ServerKey{ - // Name: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/keys"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/testserver/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armmysql.ServerKeyProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00.0Z"); return t}()), - // ServerKeyType: to.Ptr(armmysql.ServerKeyTypeAzureKeyVault), - // URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json -func ExampleServerKeysClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerKeysClient().BeginCreateOrUpdate(ctx, "testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", armmysql.ServerKey{ - Properties: &armmysql.ServerKeyProperties{ - ServerKeyType: to.Ptr(armmysql.ServerKeyTypeAzureKeyVault), - URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerKey = armmysql.ServerKey{ - // Name: to.Ptr("omeVault_someKey_01234567890123456789012345678901"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/keys"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/testserver/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armmysql.ServerKeyProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-01T00:00:00.0Z"); return t}()), - // ServerKeyType: to.Ptr(armmysql.ServerKeyTypeAzureKeyVault), - // URI: to.Ptr("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerKeyDelete.json -func ExampleServerKeysClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerKeysClient().BeginDelete(ctx, "testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/serverparameters_client.go b/sdk/resourcemanager/mysql/armmysql/serverparameters_client.go index 876c8966153b..f585686c117e 100644 --- a/sdk/resourcemanager/mysql/armmysql/serverparameters_client.go +++ b/sdk/resourcemanager/mysql/armmysql/serverparameters_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -59,9 +58,10 @@ func (client *ServerParametersClient) BeginListUpdateConfigurations(ctx context. if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerParametersClientListUpdateConfigurationsResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerParametersClientListUpdateConfigurationsResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerParametersClientListUpdateConfigurationsResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -72,18 +72,20 @@ func (client *ServerParametersClient) BeginListUpdateConfigurations(ctx context. // // Generated from API version 2017-12-01 func (client *ServerParametersClient) listUpdateConfigurations(ctx context.Context, resourceGroupName string, serverName string, value ConfigurationListResult, options *ServerParametersClientBeginListUpdateConfigurationsOptions) (*http.Response, error) { + var err error req, err := client.listUpdateConfigurationsCreateRequest(ctx, resourceGroupName, serverName, value, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // listUpdateConfigurationsCreateRequest creates the ListUpdateConfigurations request. @@ -109,5 +111,8 @@ func (client *ServerParametersClient) listUpdateConfigurationsCreateRequest(ctx reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, value) + if err := runtime.MarshalAsJSON(req, value); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/serverparameters_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/serverparameters_client_example_test.go deleted file mode 100644 index aab222538142..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/serverparameters_client_example_test.go +++ /dev/null @@ -1,71 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json -func ExampleServerParametersClient_BeginListUpdateConfigurations() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerParametersClient().BeginListUpdateConfigurations(ctx, "testrg", "mysqltestsvc1", armmysql.ConfigurationListResult{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConfigurationListResult = armmysql.ConfigurationListResult{ - // Value: []*armmysql.Configuration{ - // { - // Name: to.Ptr("event_scheduler"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/event_scheduler"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Indicates the status of the Event Scheduler."), - // AllowedValues: to.Ptr("ON,OFF,DISABLED"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("OFF"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("OFF"), - // }, - // }, - // { - // Name: to.Ptr("div_precision_increment"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1/configurations/div_precision_increment"), - // Properties: &armmysql.ConfigurationProperties{ - // Description: to.Ptr("Number of digits by which to increase the scale of the result of division operations."), - // AllowedValues: to.Ptr("0-30"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("4"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("4"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/mysql/armmysql/servers_client.go b/sdk/resourcemanager/mysql/armmysql/servers_client.go index b551304d0a9f..15c04573cb94 100644 --- a/sdk/resourcemanager/mysql/armmysql/servers_client.go +++ b/sdk/resourcemanager/mysql/armmysql/servers_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -58,7 +57,8 @@ func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientCreateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientCreateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,18 +69,20 @@ func (client *ServersClient) BeginCreate(ctx context.Context, resourceGroupName // // Generated from API version 2017-12-01 func (client *ServersClient) create(ctx context.Context, resourceGroupName string, serverName string, parameters ServerForCreate, options *ServersClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -106,7 +108,10 @@ func (client *ServersClient) createCreateRequest(ctx context.Context, resourceGr reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a server. @@ -122,7 +127,8 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -133,18 +139,20 @@ func (client *ServersClient) BeginDelete(ctx context.Context, resourceGroupName // // Generated from API version 2017-12-01 func (client *ServersClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,18 +189,21 @@ func (client *ServersClient) deleteCreateRequest(ctx context.Context, resourceGr // - serverName - The name of the server. // - options - ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. func (client *ServersClient) Get(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientGetOptions) (ServersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return ServersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -355,7 +366,8 @@ func (client *ServersClient) BeginRestart(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientRestartResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientRestartResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -366,18 +378,20 @@ func (client *ServersClient) BeginRestart(ctx context.Context, resourceGroupName // // Generated from API version 2017-12-01 func (client *ServersClient) restart(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginRestartOptions) (*http.Response, error) { + var err error req, err := client.restartCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // restartCreateRequest creates the Restart request. @@ -419,7 +433,8 @@ func (client *ServersClient) BeginStart(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller[ServersClientStartResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientStartResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -430,18 +445,20 @@ func (client *ServersClient) BeginStart(ctx context.Context, resourceGroupName s // // Generated from API version 2020-01-01 func (client *ServersClient) start(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStartOptions) (*http.Response, error) { + var err error req, err := client.startCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // startCreateRequest creates the Start request. @@ -483,7 +500,8 @@ func (client *ServersClient) BeginStop(ctx context.Context, resourceGroupName st if err != nil { return nil, err } - return runtime.NewPoller[ServersClientStopResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientStopResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -494,18 +512,20 @@ func (client *ServersClient) BeginStop(ctx context.Context, resourceGroupName st // // Generated from API version 2020-01-01 func (client *ServersClient) stop(ctx context.Context, resourceGroupName string, serverName string, options *ServersClientBeginStopOptions) (*http.Response, error) { + var err error req, err := client.stopCreateRequest(ctx, resourceGroupName, serverName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // stopCreateRequest creates the Stop request. @@ -549,7 +569,8 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -561,18 +582,20 @@ func (client *ServersClient) BeginUpdate(ctx context.Context, resourceGroupName // // Generated from API version 2017-12-01 func (client *ServersClient) update(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpdateParameters, options *ServersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -598,7 +621,10 @@ func (client *ServersClient) updateCreateRequest(ctx context.Context, resourceGr reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginUpgrade - Upgrade server version. @@ -615,7 +641,8 @@ func (client *ServersClient) BeginUpgrade(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller[ServersClientUpgradeResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServersClientUpgradeResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServersClientUpgradeResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -626,18 +653,20 @@ func (client *ServersClient) BeginUpgrade(ctx context.Context, resourceGroupName // // Generated from API version 2020-01-01 func (client *ServersClient) upgrade(ctx context.Context, resourceGroupName string, serverName string, parameters ServerUpgradeParameters, options *ServersClientBeginUpgradeOptions) (*http.Response, error) { + var err error req, err := client.upgradeCreateRequest(ctx, resourceGroupName, serverName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // upgradeCreateRequest creates the Upgrade request. @@ -663,5 +692,8 @@ func (client *ServersClient) upgradeCreateRequest(ctx context.Context, resourceG reqQP.Set("api-version", "2020-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/servers_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/servers_client_example_test.go deleted file mode 100644 index 9dd68af9b8a6..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/servers_client_example_test.go +++ /dev/null @@ -1,759 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json -func ExampleServersClient_BeginCreate_createADatabaseAsAPointInTimeRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TargetResourceGroup", "targetserver", armmysql.ServerForCreate{ - Location: to.Ptr("brazilsouth"), - Properties: &armmysql.ServerPropertiesForRestore{ - CreateMode: to.Ptr(armmysql.CreateModePointInTimeRestore), - RestorePointInTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-14T00:00:37.467Z"); return t }()), - SourceServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver"), - }, - SKU: &armmysql.SKU{ - Name: to.Ptr("GP_Gen5_2"), - Capacity: to.Ptr[int32](2), - Family: to.Ptr("Gen5"), - Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - }, - Tags: map[string]*string{ - "ElasticServer": to.Ptr("1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysql.Server{ - // Name: to.Ptr("targetserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/targetserver"), - // Location: to.Ptr("brazilsouth"), - // Tags: map[string]*string{ - // "elasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T18:02:41.577+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("targetserver.mysql.database.azure.com"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreate.json -func ExampleServersClient_BeginCreate_createANewServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "testrg", "mysqltestsvc4", armmysql.ServerForCreate{ - Location: to.Ptr("westus"), - Properties: &armmysql.ServerPropertiesForDefaultCreate{ - CreateMode: to.Ptr(armmysql.CreateModeDefault), - SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - StorageProfile: &armmysql.StorageProfile{ - BackupRetentionDays: to.Ptr[int32](7), - GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - StorageMB: to.Ptr[int32](128000), - }, - AdministratorLogin: to.Ptr("cloudsa"), - AdministratorLoginPassword: to.Ptr(""), - }, - SKU: &armmysql.SKU{ - Name: to.Ptr("GP_Gen5_2"), - Capacity: to.Ptr[int32](2), - Family: to.Ptr("Gen5"), - Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - }, - Tags: map[string]*string{ - "ElasticServer": to.Ptr("1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysql.Server{ - // Name: to.Ptr("mysqltestsvc4"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "elasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T18:02:41.577+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("mysqltestsvc4.mysql.database.azure.com"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json -func ExampleServersClient_BeginCreate_createAReplicaServer() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TargetResourceGroup", "targetserver", armmysql.ServerForCreate{ - Location: to.Ptr("westus"), - Properties: &armmysql.ServerPropertiesForReplica{ - CreateMode: to.Ptr(armmysql.CreateModeReplica), - SourceServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysql.Server{ - // Name: to.Ptr("targetserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TargetResourceGroup/providers/Microsoft.DBforMySQL/servers/targetserver"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T18:02:41.577+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("targetserver.mysql.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/MasterResourceGroup/providers/Microsoft.DBforMySQL/servers/masterserver"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](14), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json -func ExampleServersClient_BeginCreate_createAServerAsAGeoRestore() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TargetResourceGroup", "targetserver", armmysql.ServerForCreate{ - Location: to.Ptr("westus"), - Properties: &armmysql.ServerPropertiesForGeoRestore{ - CreateMode: to.Ptr(armmysql.CreateModeGeoRestore), - SourceServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforMySQL/servers/sourceserver"), - }, - SKU: &armmysql.SKU{ - Name: to.Ptr("GP_Gen5_2"), - Capacity: to.Ptr[int32](2), - Family: to.Ptr("Gen5"), - Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - }, - Tags: map[string]*string{ - "ElasticServer": to.Ptr("1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysql.Server{ - // Name: to.Ptr("targetserver"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/targetserver"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "elasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T18:02:41.577+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("targetserver.mysql.database.azure.com"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](14), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerUpdate.json -func ExampleServersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "mysqltestsvc4", armmysql.ServerUpdateParameters{ - Properties: &armmysql.ServerUpdateParametersProperties{ - AdministratorLoginPassword: to.Ptr(""), - SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumDisabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysql.Server{ - // Name: to.Ptr("mysqltestsvc4"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T18:02:41.577+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("mysqltestsvc4.mysql.database.azure.com"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumDisabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerDelete.json -func ExampleServersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginDelete(ctx, "TestGroup", "testserver", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerGet.json -func ExampleServersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().Get(ctx, "testrg", "mysqltestsvc4", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Server = armmysql.Server{ - // Name: to.Ptr("mysqltestsvc4"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T18:02:41.577+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("mysqltestsvc4.mysql.database.azure.com"), - // MasterServerID: to.Ptr(""), - // PrivateEndpointConnections: []*armmysql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc4/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armmysql.ServerPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.ServerPrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armmysql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armmysql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmysql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armmysql.PublicNetworkAccessEnumEnabled), - // ReplicaCapacity: to.Ptr[int32](5), - // ReplicationRole: to.Ptr("None"), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerListByResourceGroup.json -func ExampleServersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListByResourceGroupPager("testrg", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armmysql.ServerListResult{ - // Value: []*armmysql.Server{ - // { - // Name: to.Ptr("mysqltestsvc1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1"), - // Location: to.Ptr("westus"), - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-07T18:17:35.729321+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("mysqltestsvc1.mysql.database.azure.com"), - // PrivateEndpointConnections: []*armmysql.ServerPrivateEndpointConnection{ - // }, - // PublicNetworkAccess: to.Ptr(armmysql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("B_Gen4_1"), - // Capacity: to.Ptr[int32](1), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierBasic), - // }, - // }, - // { - // Name: to.Ptr("mysqltstsvc2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltstsvc2"), - // Location: to.Ptr("westus"), - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-07T18:17:35.729321+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("mysqltstsvc2.mysql.database.azure.com"), - // PrivateEndpointConnections: []*armmysql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltstsvc2/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armmysql.ServerPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.ServerPrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armmysql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armmysql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmysql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armmysql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerList.json -func ExampleServersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerListResult = armmysql.ServerListResult{ - // Value: []*armmysql.Server{ - // { - // Name: to.Ptr("mysqltestsvc1"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc1"), - // Location: to.Ptr("westus"), - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-28T23:56:02.627+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("mysqltestsvc1.mysql.database.azure.com"), - // PrivateEndpointConnections: []*armmysql.ServerPrivateEndpointConnection{ - // }, - // PublicNetworkAccess: to.Ptr(armmysql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("B_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierBasic), - // }, - // }, - // { - // Name: to.Ptr("mysqltstsvc2"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltstsvc2"), - // Location: to.Ptr("westus"), - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-28T23:56:54.3+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("mysqltstsvc2.mysql.database.azure.com"), - // PrivateEndpointConnections: []*armmysql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltstsvc2/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armmysql.ServerPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.ServerPrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armmysql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armmysql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmysql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armmysql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("mysqltestsvc3"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg1/providers/Microsoft.DBforMySQL/servers/mysqltestsvc3"), - // Location: to.Ptr("westus"), - // Properties: &armmysql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-02-28T23:59:44.847+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("mysqltestsvc3.mysql.database.azure.com"), - // PrivateEndpointConnections: []*armmysql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforMySQL/servers/mysqltestsvc3/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armmysql.ServerPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmysql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmysql.ServerPrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armmysql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armmysql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmysql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armmysql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armmysql.SSLEnforcementEnumEnabled), - // StorageProfile: &armmysql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](35), - // GeoRedundantBackup: to.Ptr(armmysql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](102400), - // }, - // UserVisibleState: to.Ptr(armmysql.ServerStateReady), - // Version: to.Ptr(armmysql.ServerVersionFive7), - // }, - // SKU: &armmysql.SKU{ - // Name: to.Ptr("GP_Gen4_4"), - // Capacity: to.Ptr[int32](4), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armmysql.SKUTierGeneralPurpose), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerRestart.json -func ExampleServersClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginRestart(ctx, "TestGroup", "testserver", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerStart.json -func ExampleServersClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginStart(ctx, "TestGroup", "testserver", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerStop.json -func ExampleServersClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginStop(ctx, "TestGroup", "testserver", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2020-01-01/examples/ServerUpgrade.json -func ExampleServersClient_BeginUpgrade() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginUpgrade(ctx, "TestGroup", "testserver", armmysql.ServerUpgradeParameters{ - Properties: &armmysql.ServerUpgradeParametersProperties{ - TargetServerVersion: to.Ptr("5.7"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/serversecurityalertpolicies_client.go b/sdk/resourcemanager/mysql/armmysql/serversecurityalertpolicies_client.go index 9a821c79a467..e3ff91b66707 100644 --- a/sdk/resourcemanager/mysql/armmysql/serversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/mysql/armmysql/serversecurityalertpolicies_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -60,7 +59,8 @@ func (client *ServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context if err != nil { return nil, err } - return runtime.NewPoller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[ServerSecurityAlertPoliciesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,18 +71,20 @@ func (client *ServerSecurityAlertPoliciesClient) BeginCreateOrUpdate(ctx context // // Generated from API version 2017-12-01 func (client *ServerSecurityAlertPoliciesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, parameters ServerSecurityAlertPolicy, options *ServerSecurityAlertPoliciesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, securityAlertPolicyName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,7 +114,10 @@ func (client *ServerSecurityAlertPoliciesClient) createOrUpdateCreateRequest(ctx reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Get a server's security alert policy. @@ -125,18 +130,21 @@ func (client *ServerSecurityAlertPoliciesClient) createOrUpdateCreateRequest(ctx // - options - ServerSecurityAlertPoliciesClientGetOptions contains the optional parameters for the ServerSecurityAlertPoliciesClient.Get // method. func (client *ServerSecurityAlertPoliciesClient) Get(ctx context.Context, resourceGroupName string, serverName string, securityAlertPolicyName SecurityAlertPolicyName, options *ServerSecurityAlertPoliciesClientGetOptions) (ServerSecurityAlertPoliciesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, securityAlertPolicyName, options) if err != nil { return ServerSecurityAlertPoliciesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ServerSecurityAlertPoliciesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerSecurityAlertPoliciesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ServerSecurityAlertPoliciesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/serversecurityalertpolicies_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/serversecurityalertpolicies_client_example_test.go deleted file mode 100644 index 099dd353220c..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/serversecurityalertpolicies_client_example_test.go +++ /dev/null @@ -1,194 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json -func ExampleServerSecurityAlertPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerSecurityAlertPoliciesClient().Get(ctx, "securityalert-4799", "securityalert-6440", armmysql.SecurityAlertPolicyNameDefault, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerSecurityAlertPolicy = armmysql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforMySQL/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armmysql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@microsoft.com;user@microsoft.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armmysql.ServerSecurityAlertPolicyStateDisabled), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json -func ExampleServerSecurityAlertPoliciesClient_BeginCreateOrUpdate_updateAServersThreatDetectionPolicyWithAllParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerSecurityAlertPoliciesClient().BeginCreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", armmysql.SecurityAlertPolicyNameDefault, armmysql.ServerSecurityAlertPolicy{ - Properties: &armmysql.SecurityAlertPolicyProperties{ - DisabledAlerts: []*string{ - to.Ptr("Access_Anomaly"), - to.Ptr("Usage_Anomaly")}, - EmailAccountAdmins: to.Ptr(true), - EmailAddresses: []*string{ - to.Ptr("testSecurityAlert@microsoft.com")}, - RetentionDays: to.Ptr[int32](5), - State: to.Ptr(armmysql.ServerSecurityAlertPolicyStateEnabled), - StorageAccountAccessKey: to.Ptr("sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD=="), - StorageEndpoint: to.Ptr("https://mystorage.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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerSecurityAlertPolicy = armmysql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforMySQL/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armmysql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly"), - // to.Ptr("Usage_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("testSecurityAlert@microsoft.com")}, - // RetentionDays: to.Ptr[int32](5), - // State: to.Ptr(armmysql.ServerSecurityAlertPolicyStateEnabled), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json -func ExampleServerSecurityAlertPoliciesClient_BeginCreateOrUpdate_updateAServersThreatDetectionPolicyWithMinimalParameters() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerSecurityAlertPoliciesClient().BeginCreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", armmysql.SecurityAlertPolicyNameDefault, armmysql.ServerSecurityAlertPolicy{ - Properties: &armmysql.SecurityAlertPolicyProperties{ - EmailAccountAdmins: to.Ptr(true), - State: to.Ptr(armmysql.ServerSecurityAlertPolicyStateDisabled), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ServerSecurityAlertPolicy = armmysql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforMySQL/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armmysql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // }, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // }, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armmysql.ServerSecurityAlertPolicyStateEnabled), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json -func ExampleServerSecurityAlertPoliciesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerSecurityAlertPoliciesClient().NewListByServerPager("securityalert-4799", "securityalert-6440", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ServerSecurityAlertPolicyListResult = armmysql.ServerSecurityAlertPolicyListResult{ - // Value: []*armmysql.ServerSecurityAlertPolicy{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforMySQL/servers/securityalert-6440/securityAlertPolicies"), - // Properties: &armmysql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("Access_Anomaly")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("test@microsoft.com;user@microsoft.com")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armmysql.ServerSecurityAlertPolicyStateDisabled), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/time_rfc3339.go b/sdk/resourcemanager/mysql/armmysql/time_rfc3339.go index 0d6635ee4703..203a12a267bd 100644 --- a/sdk/resourcemanager/mysql/armmysql/time_rfc3339.go +++ b/sdk/resourcemanager/mysql/armmysql/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql diff --git a/sdk/resourcemanager/mysql/armmysql/topquerystatistics_client.go b/sdk/resourcemanager/mysql/armmysql/topquerystatistics_client.go index 31ee12404320..7f860cf51808 100644 --- a/sdk/resourcemanager/mysql/armmysql/topquerystatistics_client.go +++ b/sdk/resourcemanager/mysql/armmysql/topquerystatistics_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -53,18 +52,21 @@ func NewTopQueryStatisticsClient(subscriptionID string, credential azcore.TokenC // - queryStatisticID - The Query Statistic identifier. // - options - TopQueryStatisticsClientGetOptions contains the optional parameters for the TopQueryStatisticsClient.Get method. func (client *TopQueryStatisticsClient) Get(ctx context.Context, resourceGroupName string, serverName string, queryStatisticID string, options *TopQueryStatisticsClientGetOptions) (TopQueryStatisticsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, queryStatisticID, options) if err != nil { return TopQueryStatisticsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return TopQueryStatisticsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TopQueryStatisticsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TopQueryStatisticsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -165,7 +167,10 @@ func (client *TopQueryStatisticsClient) listByServerCreateRequest(ctx context.Co reqQP.Set("api-version", "2018-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // listByServerHandleResponse handles the ListByServer response. diff --git a/sdk/resourcemanager/mysql/armmysql/topquerystatistics_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/topquerystatistics_client_example_test.go deleted file mode 100644 index 307f9cbd06c9..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/topquerystatistics_client_example_test.go +++ /dev/null @@ -1,132 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/TopQueryStatisticsGet.json -func ExampleTopQueryStatisticsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTopQueryStatisticsClient().Get(ctx, "testResourceGroupName", "testServerName", "66-636923268000000000-636923277000000000-avg-duration", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.QueryStatistic = armmysql.QueryStatistic{ - // Name: to.Ptr("66-636923268000000000-636923277000000000-avg-duration"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/queryStatistics"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryStatistic/66-636923268000000000-636923277000000000-avg-duration"), - // Properties: &armmysql.QueryStatisticProperties{ - // AggregationFunction: to.Ptr("avg"), - // DatabaseNames: []*string{ - // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/databases/mysql")}, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T17:15:00Z"); return t}()), - // MetricDisplayName: to.Ptr("Query duration"), - // MetricName: to.Ptr("duration"), - // MetricValue: to.Ptr[float64](123.301446136), - // MetricValueUnit: to.Ptr("milliseconds"), - // QueryExecutionCount: to.Ptr[int64](1), - // QueryID: to.Ptr("66"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T17:00:00Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/TopQueryStatisticsListByServer.json -func ExampleTopQueryStatisticsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTopQueryStatisticsClient().NewListByServerPager("testResourceGroupName", "testServerName", armmysql.TopQueryStatisticsInput{ - Properties: &armmysql.TopQueryStatisticsInputProperties{ - AggregationFunction: to.Ptr("avg"), - AggregationWindow: to.Ptr("PT15M"), - NumberOfTopQueries: to.Ptr[int32](5), - ObservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T20:00:00.000Z"); return t }()), - ObservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T20:00:00.000Z"); return t }()), - ObservedMetric: to.Ptr("duration"), - }, - }, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TopQueryStatisticsResultList = armmysql.TopQueryStatisticsResultList{ - // Value: []*armmysql.QueryStatistic{ - // { - // Name: to.Ptr("66-636923268000000000-636923277000000000-avg-duration"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/queryStatistics"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryStatistic/66-636923268000000000-636923277000000000-avg-duration"), - // Properties: &armmysql.QueryStatisticProperties{ - // AggregationFunction: to.Ptr("avg"), - // DatabaseNames: []*string{ - // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/databases/mysql")}, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T17:15:00Z"); return t}()), - // MetricDisplayName: to.Ptr("Query duration"), - // MetricName: to.Ptr("duration"), - // MetricValue: to.Ptr[float64](123.301446136), - // MetricValueUnit: to.Ptr("milliseconds"), - // QueryExecutionCount: to.Ptr[int64](1), - // QueryID: to.Ptr("66"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T17:00:00Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("66-636924483000000000-636924492000000000-avg-duration"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/queryStatistics"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/queryStatistic/66-636924483000000000-636924492000000000-avg-duration"), - // Properties: &armmysql.QueryStatisticProperties{ - // AggregationFunction: to.Ptr("avg"), - // DatabaseNames: []*string{ - // to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/databases/mysql")}, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-03T03:00:00Z"); return t}()), - // MetricDisplayName: to.Ptr("Query duration"), - // MetricName: to.Ptr("duration"), - // MetricValue: to.Ptr[float64](1712.301446136), - // MetricValueUnit: to.Ptr("milliseconds"), - // QueryExecutionCount: to.Ptr[int64](1), - // QueryID: to.Ptr("66"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-03T02:45:00Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/virtualnetworkrules_client.go b/sdk/resourcemanager/mysql/armmysql/virtualnetworkrules_client.go index 09dd1b26c68b..4ed4c3fc5ad7 100644 --- a/sdk/resourcemanager/mysql/armmysql/virtualnetworkrules_client.go +++ b/sdk/resourcemanager/mysql/armmysql/virtualnetworkrules_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -60,7 +59,8 @@ func (client *VirtualNetworkRulesClient) BeginCreateOrUpdate(ctx context.Context if err != nil { return nil, err } - return runtime.NewPoller[VirtualNetworkRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VirtualNetworkRulesClientCreateOrUpdateResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualNetworkRulesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,18 +71,20 @@ func (client *VirtualNetworkRulesClient) BeginCreateOrUpdate(ctx context.Context // // Generated from API version 2017-12-01 func (client *VirtualNetworkRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, parameters VirtualNetworkRule, options *VirtualNetworkRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverName, virtualNetworkRuleName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -112,7 +114,10 @@ func (client *VirtualNetworkRulesClient) createOrUpdateCreateRequest(ctx context reqQP.Set("api-version", "2017-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes the virtual network rule with the given name. @@ -130,7 +135,8 @@ func (client *VirtualNetworkRulesClient) BeginDelete(ctx context.Context, resour if err != nil { return nil, err } - return runtime.NewPoller[VirtualNetworkRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[VirtualNetworkRulesClientDeleteResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[VirtualNetworkRulesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,18 +147,20 @@ func (client *VirtualNetworkRulesClient) BeginDelete(ctx context.Context, resour // // Generated from API version 2017-12-01 func (client *VirtualNetworkRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, options *VirtualNetworkRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverName, virtualNetworkRuleName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -193,18 +201,21 @@ func (client *VirtualNetworkRulesClient) deleteCreateRequest(ctx context.Context // - virtualNetworkRuleName - The name of the virtual network rule. // - options - VirtualNetworkRulesClientGetOptions contains the optional parameters for the VirtualNetworkRulesClient.Get method. func (client *VirtualNetworkRulesClient) Get(ctx context.Context, resourceGroupName string, serverName string, virtualNetworkRuleName string, options *VirtualNetworkRulesClientGetOptions) (VirtualNetworkRulesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, virtualNetworkRuleName, options) if err != nil { return VirtualNetworkRulesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return VirtualNetworkRulesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VirtualNetworkRulesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return VirtualNetworkRulesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. diff --git a/sdk/resourcemanager/mysql/armmysql/virtualnetworkrules_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/virtualnetworkrules_client_example_test.go deleted file mode 100644 index 7400195e62f7..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/virtualnetworkrules_client_example_test.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_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/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json -func ExampleVirtualNetworkRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkRulesClient().Get(ctx, "TestGroup", "vnet-test-svr", "vnet-firewall-rule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkRule = armmysql.VirtualNetworkRule{ - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armmysql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armmysql.VirtualNetworkRuleStateReady), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json -func ExampleVirtualNetworkRulesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkRulesClient().BeginCreateOrUpdate(ctx, "TestGroup", "vnet-test-svr", "vnet-firewall-rule", armmysql.VirtualNetworkRule{ - Properties: &armmysql.VirtualNetworkRuleProperties{ - IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - VirtualNetworkSubnetID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VirtualNetworkRule = armmysql.VirtualNetworkRule{ - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armmysql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json -func ExampleVirtualNetworkRulesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkRulesClient().BeginDelete(ctx, "TestGroup", "vnet-test-svr", "vnet-firewall-rule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json -func ExampleVirtualNetworkRulesClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkRulesClient().NewListByServerPager("TestGroup", "vnet-test-svr", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VirtualNetworkRuleListResult = armmysql.VirtualNetworkRuleListResult{ - // Value: []*armmysql.VirtualNetworkRule{ - // { - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armmysql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armmysql.VirtualNetworkRuleStateReady), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // }, - // { - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforMySQL/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armmysql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armmysql.VirtualNetworkRuleStateReady), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/mysql/armmysql/waitstatistics_client.go b/sdk/resourcemanager/mysql/armmysql/waitstatistics_client.go index 3b3098a3b45c..edf8afa1df74 100644 --- a/sdk/resourcemanager/mysql/armmysql/waitstatistics_client.go +++ b/sdk/resourcemanager/mysql/armmysql/waitstatistics_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armmysql @@ -53,18 +52,21 @@ func NewWaitStatisticsClient(subscriptionID string, credential azcore.TokenCrede // - waitStatisticsID - The Wait Statistic identifier. // - options - WaitStatisticsClientGetOptions contains the optional parameters for the WaitStatisticsClient.Get method. func (client *WaitStatisticsClient) Get(ctx context.Context, resourceGroupName string, serverName string, waitStatisticsID string, options *WaitStatisticsClientGetOptions) (WaitStatisticsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, serverName, waitStatisticsID, options) if err != nil { return WaitStatisticsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return WaitStatisticsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return WaitStatisticsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WaitStatisticsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -165,7 +167,10 @@ func (client *WaitStatisticsClient) listByServerCreateRequest(ctx context.Contex reqQP.Set("api-version", "2018-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // listByServerHandleResponse handles the ListByServer response. diff --git a/sdk/resourcemanager/mysql/armmysql/waitstatistics_client_example_test.go b/sdk/resourcemanager/mysql/armmysql/waitstatistics_client_example_test.go deleted file mode 100644 index 532219aa37c5..000000000000 --- a/sdk/resourcemanager/mysql/armmysql/waitstatistics_client_example_test.go +++ /dev/null @@ -1,123 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmysql_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/WaitStatisticsGet.json -func ExampleWaitStatisticsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWaitStatisticsClient().Get(ctx, "testResourceGroupName", "testServerName", "636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WaitStatistic = armmysql.WaitStatistic{ - // Name: to.Ptr("636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/waitStatistics"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/waitStatistics/636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0"), - // Properties: &armmysql.WaitStatisticProperties{ - // Count: to.Ptr[int64](3), - // DatabaseName: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/databases/mysql"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-06T17:45:00Z"); return t}()), - // EventName: to.Ptr("wait/io/socket/sql/client_connection"), - // EventTypeName: to.Ptr("send"), - // QueryID: to.Ptr[int64](2), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-06T17:30:00Z"); return t}()), - // TotalTimeInMs: to.Ptr[float64](12.345), - // UserID: to.Ptr[int64](0), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/mysql/resource-manager/Microsoft.DBforMySQL/stable/2018-06-01/examples/WaitStatisticsListByServer.json -func ExampleWaitStatisticsClient_NewListByServerPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmysql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWaitStatisticsClient().NewListByServerPager("testResourceGroupName", "testServerName", armmysql.WaitStatisticsInput{ - Properties: &armmysql.WaitStatisticsInputProperties{ - AggregationWindow: to.Ptr("PT15M"), - ObservationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-07T20:00:00.000Z"); return t }()), - ObservationStartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-01T20:00:00.000Z"); return t }()), - }, - }, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WaitStatisticsResultList = armmysql.WaitStatisticsResultList{ - // Value: []*armmysql.WaitStatistic{ - // { - // Name: to.Ptr("636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/waitStatistics"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/waitStatistics/636927606000000000-636927615000000000-send-wait/io/socket/sql/client_connection-2--0"), - // Properties: &armmysql.WaitStatisticProperties{ - // Count: to.Ptr[int64](2), - // DatabaseName: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testResourceGroupName/providers/Microsoft.DBforMySQL/servers/testServerName/databases/mysql"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-06T17:45:00Z"); return t}()), - // EventName: to.Ptr("wait/io/socket/sql/client_connection"), - // EventTypeName: to.Ptr("send"), - // QueryID: to.Ptr[int64](2), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-06T17:30:00Z"); return t}()), - // TotalTimeInMs: to.Ptr[float64](12.345), - // UserID: to.Ptr[int64](0), - // }, - // }, - // { - // Name: to.Ptr("636927606000000000-636927615000000000-lock-wait/synch/mutex/mysys/THR_LOCK::mutex-2--0"), - // Type: to.Ptr("Microsoft.DBforMySQL/servers/waitStatistics"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/hyshim-test/providers/Microsoft.DBforMySQL/servers/hyshim-wait-stats-fix/waitStatistics/636927606000000000-636927615000000000-lock-wait/synch/mutex/mysys/THR_LOCK::mutex-2--0"), - // Properties: &armmysql.WaitStatisticProperties{ - // Count: to.Ptr[int64](4), - // DatabaseName: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/hyshim-test/providers/Microsoft.DBforMySQL/servers/hyshim-wait-stats-fix/databases/"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-06T17:45:00Z"); return t}()), - // EventName: to.Ptr("wait/synch/mutex/mysys/THR_LOCK::mutex"), - // EventTypeName: to.Ptr("lock"), - // QueryID: to.Ptr[int64](2), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-05-06T17:30:00Z"); return t}()), - // TotalTimeInMs: to.Ptr[float64](56.789), - // UserID: to.Ptr[int64](0), - // }, - // }}, - // } - } -}