diff --git a/sdk/resourcemanager/postgresql/armpostgresql/CHANGELOG.md b/sdk/resourcemanager/postgresql/armpostgresql/CHANGELOG.md index d146322dde39..38bd86a2a40a 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/CHANGELOG.md +++ b/sdk/resourcemanager/postgresql/armpostgresql/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.1.2 (2023-10-30) +### Other Changes + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/postgresql/armpostgresql/autorest.md b/sdk/resourcemanager/postgresql/armpostgresql/autorest.md index c69fdd8d867f..2d26493fb80c 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/autorest.md +++ b/sdk/resourcemanager/postgresql/armpostgresql/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/postgresql/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/postgresql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 +module-version: 1.1.2 package-singleservers: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/postgresql/armpostgresql/checknameavailability_client.go b/sdk/resourcemanager/postgresql/armpostgresql/checknameavailability_client.go index 253b5735bd03..a730d504f9cc 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/checknameavailability_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/checknameavailability_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/checknameavailability_client_example_test.go deleted file mode 100644 index c68c35f20b31..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCheckNameAvailabilityClient().Execute(ctx, armpostgresql.NameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DBforPostgreSQL"), - }, 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 = armpostgresql.NameAvailability{ - // Message: to.Ptr(""), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(""), - // } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/client_factory.go b/sdk/resourcemanager/postgresql/armpostgresql/client_factory.go index 0713180fe6fd..d7770112afb7 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/client_factory.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -38,48 +37,48 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewServersClient() *ServersClient { - subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { + subClient, _ := NewCheckNameAvailabilityClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewReplicasClient() *ReplicasClient { - subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewConfigurationsClient() *ConfigurationsClient { + subClient, _ := NewConfigurationsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { - subClient, _ := NewFirewallRulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { + subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewVirtualNetworkRulesClient() *VirtualNetworkRulesClient { - subClient, _ := NewVirtualNetworkRulesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { + subClient, _ := NewFirewallRulesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { - subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLocationBasedPerformanceTierClient() *LocationBasedPerformanceTierClient { + subClient, _ := NewLocationBasedPerformanceTierClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewConfigurationsClient() *ConfigurationsClient { - subClient, _ := NewConfigurationsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewLogFilesClient() *LogFilesClient { + subClient, _ := NewLogFilesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerParametersClient() *ServerParametersClient { - subClient, _ := NewServerParametersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewLogFilesClient() *LogFilesClient { - subClient, _ := NewLogFilesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerAdministratorsClient() *ServerAdministratorsClient { - subClient, _ := NewServerAdministratorsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -88,42 +87,42 @@ func (c *ClientFactory) NewRecoverableServersClient() *RecoverableServersClient return subClient } -func (c *ClientFactory) NewServerBasedPerformanceTierClient() *ServerBasedPerformanceTierClient { - subClient, _ := NewServerBasedPerformanceTierClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewReplicasClient() *ReplicasClient { + subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewLocationBasedPerformanceTierClient() *LocationBasedPerformanceTierClient { - subClient, _ := NewLocationBasedPerformanceTierClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerAdministratorsClient() *ServerAdministratorsClient { + subClient, _ := NewServerAdministratorsClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { - subClient, _ := NewCheckNameAvailabilityClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerBasedPerformanceTierClient() *ServerBasedPerformanceTierClient { + subClient, _ := NewServerBasedPerformanceTierClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewServerKeysClient() *ServerKeysClient { + subClient, _ := NewServerKeysClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerSecurityAlertPoliciesClient() *ServerSecurityAlertPoliciesClient { - subClient, _ := NewServerSecurityAlertPoliciesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerParametersClient() *ServerParametersClient { + subClient, _ := NewServerParametersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServerSecurityAlertPoliciesClient() *ServerSecurityAlertPoliciesClient { + subClient, _ := NewServerSecurityAlertPoliciesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewServersClient() *ServersClient { + subClient, _ := NewServersClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewServerKeysClient() *ServerKeysClient { - subClient, _ := NewServerKeysClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewVirtualNetworkRulesClient() *VirtualNetworkRulesClient { + subClient, _ := NewVirtualNetworkRulesClient(c.subscriptionID, c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/configurations_client.go b/sdk/resourcemanager/postgresql/armpostgresql/configurations_client.go index b0c815073e9b..fa521dd30c05 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/configurations_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/configurations_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/configurations_client_example_test.go deleted file mode 100644 index 3e46cc0d9482..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/configurations_client_example_test.go +++ /dev/null @@ -1,1162 +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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewConfigurationsClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "array_nulls", armpostgresql.Configuration{ - Properties: &armpostgresql.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 = armpostgresql.Configuration{ - // Name: to.Ptr("array_nulls"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/array_nulls"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enable input of NULL elements in arrays."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("user-override"), - // Value: to.Ptr("off"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewConfigurationsClient().Get(ctx, "TestGroup", "testserver", "array_nulls", 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 = armpostgresql.Configuration{ - // Name: to.Ptr("array_nulls"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/array_nulls"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enable input of NULL elements in arrays."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewConfigurationsClient().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.ConfigurationListResult = armpostgresql.ConfigurationListResult{ - // Value: []*armpostgresql.Configuration{ - // { - // Name: to.Ptr("array_nulls"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/array_nulls"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enable input of NULL elements in arrays."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("backslash_quote"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/backslash_quote"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets whether \"\\'\" is allowed in string literals."), - // AllowedValues: to.Ptr("safe_encoding,on,off"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("safe_encoding"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("safe_encoding"), - // }, - // }, - // { - // Name: to.Ptr("bytea_output"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/bytea_output"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the output format for bytea."), - // AllowedValues: to.Ptr("escape,hex"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("hex"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("hex"), - // }, - // }, - // { - // Name: to.Ptr("check_function_bodies"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/check_function_bodies"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Check function bodies during CREATE FUNCTION."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("client_encoding"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/client_encoding"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the client's character set encoding."), - // AllowedValues: to.Ptr("BIG5,EUC_CN,EUC_JP,EUC_JIS_2004,EUC_KR,EUC_TW,GB18030,GBK,ISO_8859_5,ISO_8859_6,ISO_8859_7,ISO_8859_8,JOHAB,KOI8R,KOI8U,LATIN1,LATIN2,LATIN3,LATIN4,LATIN5,LATIN6,LATIN7,LATIN8,LATIN9,LATIN10,MULE_INTERNAL,SJIS,SHIFT_JIS_2004,SQL_ASCII,UHC,UTF8,WIN866,WIN874,WIN1250,WIN1251,WIN1252,WIN1253,WIN1254,WIN1255,WIN1256,WIN1257,WIN1258"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("sql_ascii"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("sql_ascii"), - // }, - // }, - // { - // Name: to.Ptr("client_min_messages"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/client_min_messages"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the message levels that are sent to the client."), - // AllowedValues: to.Ptr("debug5,debug4,debug3,debug2,debug1,log,notice,warning,error"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("notice"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("notice"), - // }, - // }, - // { - // Name: to.Ptr("constraint_exclusion"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/constraint_exclusion"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner to use constraints to optimize queries."), - // AllowedValues: to.Ptr("partition,on,off"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("partition"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("partition"), - // }, - // }, - // { - // Name: to.Ptr("cpu_index_tuple_cost"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/cpu_index_tuple_cost"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the planner's estimate of the cost of processing each index entry during an index scan."), - // AllowedValues: to.Ptr("0-1.79769e+308"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("0.005"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0.005"), - // }, - // }, - // { - // Name: to.Ptr("cpu_operator_cost"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/cpu_operator_cost"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the planner's estimate of the cost of processing each operator or function call."), - // AllowedValues: to.Ptr("0-1.79769e+308"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("0.0025"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0.0025"), - // }, - // }, - // { - // Name: to.Ptr("cpu_tuple_cost"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/cpu_tuple_cost"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the planner's estimate of the cost of processing each tuple (row)."), - // AllowedValues: to.Ptr("0-1.79769e+308"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("0.01"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0.01"), - // }, - // }, - // { - // Name: to.Ptr("cursor_tuple_fraction"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/cursor_tuple_fraction"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the planner's estimate of the fraction of a cursor's rows that will be retrieved."), - // AllowedValues: to.Ptr("0-1"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("0.1"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0.1"), - // }, - // }, - // { - // Name: to.Ptr("datestyle"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/datestyle"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the display format for date and time values."), - // AllowedValues: to.Ptr("(iso|postgres|sql|german)\\,\\s(dmy|mdy|ymd)"), - // DataType: to.Ptr("String"), - // DefaultValue: to.Ptr("iso, mdy"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("iso, mdy"), - // }, - // }, - // { - // Name: to.Ptr("deadlock_timeout"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/deadlock_timeout"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the amount of time, in milliseconds, to wait on a lock before checking for deadlock."), - // AllowedValues: to.Ptr("1-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("1000"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1000"), - // }, - // }, - // { - // Name: to.Ptr("debug_print_parse"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/debug_print_parse"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Logs each query's parse tree."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("debug_print_plan"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/debug_print_plan"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Logs each query's execution plan."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("debug_print_rewritten"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/debug_print_rewritten"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Logs each query's rewritten parse tree."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("default_statistics_target"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/default_statistics_target"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the default statistics target."), - // AllowedValues: to.Ptr("1-10000"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("100"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("100"), - // }, - // }, - // { - // Name: to.Ptr("default_text_search_config"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/default_text_search_config"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets default text search configuration."), - // AllowedValues: to.Ptr("[A-Za-z\\._]+"), - // DataType: to.Ptr("String"), - // DefaultValue: to.Ptr("pg_catalog.english"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("pg_catalog.english"), - // }, - // }, - // { - // Name: to.Ptr("default_transaction_deferrable"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/default_transaction_deferrable"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the default deferrable status of new transactions."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("default_transaction_isolation"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/default_transaction_isolation"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the transaction isolation level of each new transaction."), - // AllowedValues: to.Ptr("serializable,repeatable read,read committed,read uncommitted"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("read committed"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("read committed"), - // }, - // }, - // { - // Name: to.Ptr("default_transaction_read_only"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/default_transaction_read_only"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the default read-only status of new transactions."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("default_with_oids"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/default_with_oids"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Create new tables with OIDs by default."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("enable_bitmapscan"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_bitmapscan"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of bitmap-scan plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_hashagg"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_hashagg"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of hashed aggregation plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_hashjoin"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_hashjoin"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of hash join plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_indexonlyscan"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_indexonlyscan"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of index-only-scan plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_indexscan"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_indexscan"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of index-scan plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_material"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_material"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of materialization."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_mergejoin"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_mergejoin"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of merge join plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_nestloop"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_nestloop"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of nested-loop join plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_seqscan"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_seqscan"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of sequential-scan plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_sort"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_sort"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of explicit sort steps."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("enable_tidscan"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/enable_tidscan"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables the planner's use of TID scan plans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("escape_string_warning"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/escape_string_warning"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Warn about backslash escapes in ordinary string literals."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("exit_on_error"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/exit_on_error"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Terminate session on any error."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("extra_float_digits"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/extra_float_digits"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the number of digits displayed for floating-point values."), - // AllowedValues: to.Ptr("-15-3"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("from_collapse_limit"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/from_collapse_limit"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the FROM-list size beyond which subqueries are not collapsed."), - // AllowedValues: to.Ptr("1-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("8"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("8"), - // }, - // }, - // { - // Name: to.Ptr("geqo"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/geqo"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enables genetic query optimization."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("geqo_effort"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/geqo_effort"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("GEQO: effort is used to set the default for other GEQO parameters."), - // AllowedValues: to.Ptr("1-10"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("5"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("5"), - // }, - // }, - // { - // Name: to.Ptr("geqo_generations"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/geqo_generations"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("GEQO: number of iterations of the algorithm."), - // AllowedValues: to.Ptr("0-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("geqo_pool_size"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/geqo_pool_size"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("GEQO: number of individuals in the population."), - // AllowedValues: to.Ptr("0-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("geqo_seed"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/geqo_seed"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("GEQO: seed for random path selection."), - // AllowedValues: to.Ptr("0-1"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("0.0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0.0"), - // }, - // }, - // { - // Name: to.Ptr("geqo_selection_bias"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/geqo_selection_bias"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("GEQO: selective pressure within the population."), - // AllowedValues: to.Ptr("1.5-2"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("2.0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("2.0"), - // }, - // }, - // { - // Name: to.Ptr("geqo_threshold"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/geqo_threshold"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the threshold of FROM items beyond which GEQO is used."), - // AllowedValues: to.Ptr("2-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("12"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("12"), - // }, - // }, - // { - // Name: to.Ptr("gin_fuzzy_search_limit"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/gin_fuzzy_search_limit"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the maximum allowed result for exact search by GIN."), - // AllowedValues: to.Ptr("0-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("intervalstyle"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/intervalstyle"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the display format for interval values."), - // AllowedValues: to.Ptr("postgres,postgres_verbose,sql_standard,iso_8601"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("postgres"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("postgres"), - // }, - // }, - // { - // Name: to.Ptr("join_collapse_limit"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/join_collapse_limit"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the FROM-list size beyond which JOIN constructs are not flattened."), - // AllowedValues: to.Ptr("1-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("8"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("8"), - // }, - // }, - // { - // Name: to.Ptr("lock_timeout"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/lock_timeout"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the maximum allowed duration (in milliseconds) of any wait for a lock. 0 turns this off."), - // AllowedValues: to.Ptr("0-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("log_checkpoints"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_checkpoints"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Logs each checkpoint."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("log_connections"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_connections"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Logs each successful connection."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("log_disconnections"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_disconnections"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Logs end of a session, including duration."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("log_duration"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_duration"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Logs the duration of each completed SQL statement."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("log_error_verbosity"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_error_verbosity"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the verbosity of logged messages."), - // AllowedValues: to.Ptr("terse,default,verbose"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("default"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("default"), - // }, - // }, - // { - // Name: to.Ptr("log_lock_waits"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_lock_waits"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Logs long lock waits."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("log_min_duration_statement"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_min_duration_statement"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the minimum execution time (in milliseconds) above which statements will be logged. -1 disables logging statement durations."), - // AllowedValues: to.Ptr("-1-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("-1"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("-1"), - // }, - // }, - // { - // Name: to.Ptr("log_min_error_statement"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_min_error_statement"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Causes all statements generating error at or above this level to be logged."), - // AllowedValues: to.Ptr("debug5,debug4,debug3,debug2,debug1,info,notice,warning,error,log,fatal,panic"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("error"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("error"), - // }, - // }, - // { - // Name: to.Ptr("log_min_messages"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_min_messages"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the message levels that are logged."), - // AllowedValues: to.Ptr("debug5,debug4,debug3,debug2,debug1,info,notice,warning,error,log,fatal,panic"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("warning"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("warning"), - // }, - // }, - // { - // Name: to.Ptr("log_statement"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_statement"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the type of statements logged."), - // AllowedValues: to.Ptr("none,ddl,mod,all"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("none"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("none"), - // }, - // }, - // { - // Name: to.Ptr("max_locks_per_transaction"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/max_locks_per_transaction"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the maximum number of locks per transaction."), - // AllowedValues: to.Ptr("10-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("64"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("64"), - // }, - // }, - // { - // Name: to.Ptr("max_pred_locks_per_transaction"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/max_pred_locks_per_transaction"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the maximum number of predicate locks per transaction."), - // AllowedValues: to.Ptr("10-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("64"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("64"), - // }, - // }, - // { - // Name: to.Ptr("max_prepared_transactions"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/max_prepared_transactions"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the maximum number of simultaneously prepared transactions."), - // AllowedValues: to.Ptr("0-8388607"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("quote_all_identifiers"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/quote_all_identifiers"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("When generating SQL fragments, quote all identifiers."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("random_page_cost"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/random_page_cost"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the planner's estimate of the cost of a nonsequentially fetched disk page."), - // AllowedValues: to.Ptr("0-1.79769e+308"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("4.0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("4.0"), - // }, - // }, - // { - // Name: to.Ptr("search_path"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/search_path"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the schema search order for names that are not schema-qualified."), - // AllowedValues: to.Ptr("[A-Za-z.\"$, ]+"), - // DataType: to.Ptr("String"), - // DefaultValue: to.Ptr("\"$user\", public"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("\"$user\", public"), - // }, - // }, - // { - // Name: to.Ptr("seq_page_cost"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/seq_page_cost"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the planner's estimate of the cost of a sequentially fetched disk page."), - // AllowedValues: to.Ptr("0-1.79769e+308"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("1.0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1.0"), - // }, - // }, - // { - // Name: to.Ptr("sql_inheritance"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/sql_inheritance"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Causes subtables to be included by default in various commands."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("standard_conforming_strings"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/standard_conforming_strings"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Causes '...' strings to treat backslashes literally."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("statement_timeout"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/statement_timeout"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the maximum allowed duration (in milliseconds) of any statement. 0 turns this off."), - // AllowedValues: to.Ptr("0-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("synchronize_seqscans"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/synchronize_seqscans"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enable synchronized sequential scans."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("synchronous_commit"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/synchronous_commit"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the current transaction's synchronization level."), - // AllowedValues: to.Ptr("local,remote_write,on,off"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("transform_null_equals"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/transform_null_equals"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Treats \"expr=NULL\" as \"expr IS NULL\"."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("xmlbinary"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/xmlbinary"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets how binary values are to be encoded in XML."), - // AllowedValues: to.Ptr("base64,hex"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("base64"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("base64"), - // }, - // }, - // { - // Name: to.Ptr("xmloption"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/xmloption"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments."), - // AllowedValues: to.Ptr("content,document"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("content"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("content"), - // }, - // }, - // { - // Name: to.Ptr("force_parallel_mode"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/force_parallel_mode"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Forces use of parallel query facilities."), - // AllowedValues: to.Ptr("off,on,regress"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("off"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("off"), - // }, - // }, - // { - // Name: to.Ptr("idle_in_transaction_session_timeout"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/idle_in_transaction_session_timeout"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the maximum allowed duration of any idling transaction."), - // AllowedValues: to.Ptr("0-2147483647"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("max_parallel_workers_per_gather"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/max_parallel_workers_per_gather"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the maximum number of parallel processes per executor node."), - // AllowedValues: to.Ptr("0-1024"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("0"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0"), - // }, - // }, - // { - // Name: to.Ptr("min_parallel_relation_size"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/min_parallel_relation_size"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the minimum size of relations to be considered for parallel scan."), - // AllowedValues: to.Ptr("0-715827882"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("8388608"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("8388608"), - // }, - // }, - // { - // Name: to.Ptr("parallel_setup_cost"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/parallel_setup_cost"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the planner's estimate of the cost of starting up worker processes for parallel query."), - // AllowedValues: to.Ptr("0-1.79769e+308"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("1000"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("1000"), - // }, - // }, - // { - // Name: to.Ptr("parallel_tuple_cost"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/parallel_tuple_cost"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets the planner's estimate of the cost of passing each tuple (row) from worker to master backend."), - // AllowedValues: to.Ptr("0-1.79769e+308"), - // DataType: to.Ptr("Numeric"), - // DefaultValue: to.Ptr("0.1"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("0.1"), - // }, - // }, - // { - // Name: to.Ptr("log_retention_days"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/log_retention_days"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets how many days a log file is saved for."), - // AllowedValues: to.Ptr("1-7"), - // DataType: to.Ptr("Integer"), - // DefaultValue: to.Ptr("3"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("3"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/constants.go b/sdk/resourcemanager/postgresql/armpostgresql/constants.go index fa19beb2911d..602bbcc21c25 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/constants.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql const ( moduleName = "armpostgresql" - moduleVersion = "v1.1.1" + moduleVersion = "v1.1.2" ) // CreateMode - The mode to create a new server. @@ -217,15 +216,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, } } @@ -260,15 +259,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/postgresql/armpostgresql/databases_client.go b/sdk/resourcemanager/postgresql/armpostgresql/databases_client.go index 5f100440ef08..dc919ba317a7 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/databases_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/databases_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/databases_client_example_test.go deleted file mode 100644 index deff297d9722..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "db1", armpostgresql.Database{ - Properties: &armpostgresql.DatabaseProperties{ - Charset: to.Ptr("UTF8"), - Collation: to.Ptr("English_United States.1252"), - }, - }, 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 = armpostgresql.Database{ - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/databases/db1"), - // Properties: &armpostgresql.DatabaseProperties{ - // Charset: to.Ptr("UTF8"), - // Collation: to.Ptr("English_United States.1252"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.Database{ - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/databases/db1"), - // Properties: &armpostgresql.DatabaseProperties{ - // Charset: to.Ptr("UTF8"), - // Collation: to.Ptr("English_United States.1252"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.DatabaseListResult{ - // Value: []*armpostgresql.Database{ - // { - // Name: to.Ptr("db1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/databases/db1"), - // Properties: &armpostgresql.DatabaseProperties{ - // Charset: to.Ptr("UTF8"), - // Collation: to.Ptr("English_United States.1252"), - // }, - // }, - // { - // Name: to.Ptr("db2"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/databases"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/databases/db2"), - // Properties: &armpostgresql.DatabaseProperties{ - // Charset: to.Ptr("UTF8"), - // Collation: to.Ptr("English_United States.1252"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/firewallrules_client.go b/sdk/resourcemanager/postgresql/armpostgresql/firewallrules_client.go index ff8b63040d1a..e71054c73cc7 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/firewallrules_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/firewallrules_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/firewallrules_client_example_test.go deleted file mode 100644 index e11f98ddaf7c..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFirewallRulesClient().BeginCreateOrUpdate(ctx, "TestGroup", "testserver", "rule1", armpostgresql.FirewallRule{ - Properties: &armpostgresql.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 = armpostgresql.FirewallRule{ - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/firewallRules/rule1"), - // Properties: &armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.FirewallRule{ - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/firewallRules/rule1"), - // Properties: &armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.FirewallRuleListResult{ - // Value: []*armpostgresql.FirewallRule{ - // { - // Name: to.Ptr("rule1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/firewallRules/rule1"), - // Properties: &armpostgresql.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.255.255.255"), - // StartIPAddress: to.Ptr("0.0.0.0"), - // }, - // }, - // { - // Name: to.Ptr("rule2"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/firewallRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/firewallRules/rule2"), - // Properties: &armpostgresql.FirewallRuleProperties{ - // EndIPAddress: to.Ptr("255.0.0.0"), - // StartIPAddress: to.Ptr("1.0.0.0"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/go.mod b/sdk/resourcemanager/postgresql/armpostgresql/go.mod index 6bee1418c0f5..75f9149fb03c 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/go.mod +++ b/sdk/resourcemanager/postgresql/armpostgresql/go.mod @@ -3,15 +3,15 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostg 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 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 github.com/stretchr/testify v1.7.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.1.0 // indirect @@ -21,9 +21,9 @@ require ( github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect github.com/pmezard/go-difflib v1.0.0 // 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 + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/postgresql/armpostgresql/go.sum b/sdk/resourcemanager/postgresql/armpostgresql/go.sum index 6e2c77825a2c..93fdfc2850cd 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/go.sum +++ b/sdk/resourcemanager/postgresql/armpostgresql/go.sum @@ -1,9 +1,9 @@ -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/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/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/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/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2 h1:mLY+pNLjCUeKhgnAJWAKhEUQM+RJQo2H1fuGSw1Ky1E= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.1.2/go.mod h1:FbdwsQ2EzwvXxOPcMFYO8ogEc9uMMIj3YkmCdXdAFmk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= @@ -31,13 +31,13 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 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/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.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= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/sdk/resourcemanager/postgresql/armpostgresql/interfaces.go b/sdk/resourcemanager/postgresql/armpostgresql/interfaces.go new file mode 100644 index 000000000000..24c5bd26672e --- /dev/null +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql + +// 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/postgresql/armpostgresql/locationbasedperformancetier_client.go b/sdk/resourcemanager/postgresql/armpostgresql/locationbasedperformancetier_client.go index 39532ab7cb33..da5094660097 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/locationbasedperformancetier_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql diff --git a/sdk/resourcemanager/postgresql/armpostgresql/locationbasedperformancetier_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/locationbasedperformancetier_client_example_test.go deleted file mode 100644 index ec07a5fe6dfb..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.PerformanceTierListResult{ - // Value: []*armpostgresql.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: []*armpostgresql.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: []*armpostgresql.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: []*armpostgresql.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/postgresql/armpostgresql/logfiles_client.go b/sdk/resourcemanager/postgresql/armpostgresql/logfiles_client.go index cc1c31fbc367..f595380b7ede 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/logfiles_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql diff --git a/sdk/resourcemanager/postgresql/armpostgresql/logfiles_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/logfiles_client_example_test.go deleted file mode 100644 index 72fcda42be3b..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/logfiles_client_example_test.go +++ /dev/null @@ -1,70 +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 armpostgresql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.LogFileListResult{ - // Value: []*armpostgresql.LogFile{ - // { - // Name: to.Ptr("postgresql-2017-06-22_010000.log"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/logFiles"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/logFiles/postgresql-2017-06-22_010000.log"), - // Properties: &armpostgresql.LogFileProperties{ - // Type: to.Ptr("text"), - // 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, "2017-06-22T01:59:36+00:00"); return t}()), - // SizeInKB: to.Ptr[int64](4), - // URL: to.Ptr("https://wasd2stageneu1btlm4.file.core.windows.net/42679871f6cc4302b39ab9c2e3044df3/pg_log/postgresql-2017-06-22_010000.log?sv=2015-04-05&sr=f&sig=gqIQsa6VyGyUNpzYYPWLP5gM%2BeF1so9GYbHKu6Zs0DM%3D&se=2017-06-22T03%3A21%3A09Z&sp=r"), - // }, - // }, - // { - // Name: to.Ptr("postgresql-2017-06-22_020000.log"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/logFiles"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/logFiles/postgresql-2017-06-22_020000.log"), - // Properties: &armpostgresql.LogFileProperties{ - // Type: to.Ptr("text"), - // 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, "2017-06-22T02:19:36+00:00"); return t}()), - // SizeInKB: to.Ptr[int64](1), - // URL: to.Ptr("https://wasd2stageneu1btlm4.file.core.windows.net/42679871f6cc4302b39ab9c2e3044df3/pg_log/postgresql-2017-06-22_020000.log?sv=2015-04-05&sr=f&sig=i99UWBlYfR0tKaxix8yHAOnfym4HV9Auto6BbZogyRs%3D&se=2017-06-22T03%3A21%3A09Z&sp=r"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/models.go b/sdk/resourcemanager/postgresql/armpostgresql/models.go index 7a06144b3835..c1a2daad6619 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/models.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/models.go @@ -3,20 +3,13 @@ // 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 armpostgresql import "time" -// 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. @@ -59,24 +52,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. @@ -107,29 +82,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. @@ -188,36 +140,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 -} - // LogFile - Represents a log file. type LogFile struct { // The properties of the log file. @@ -257,11 +179,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 -} - // NameAvailability - Represents a resource name availability. type NameAvailability struct { // Error Message. @@ -319,11 +236,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 @@ -420,39 +332,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 @@ -491,17 +370,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 @@ -562,16 +430,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} @@ -704,37 +562,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. @@ -792,42 +619,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. @@ -910,16 +707,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. @@ -985,13 +772,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, } } @@ -1027,13 +814,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, } } @@ -1068,13 +855,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, } } @@ -1112,35 +899,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. @@ -1205,46 +973,6 @@ type ServerUpdateParametersProperties struct { Version *ServerVersion } -// 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 -} - -// ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. -type ServersClientBeginUpdateOptions 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. @@ -1320,28 +1048,3 @@ type VirtualNetworkRuleProperties struct { // READ-ONLY; Virtual Network Rule State 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 -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/models_serde.go b/sdk/resourcemanager/postgresql/armpostgresql/models_serde.go index 45671823cc39..8a7dfba311ff 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/models_serde.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql diff --git a/sdk/resourcemanager/postgresql/armpostgresql/operations_client.go b/sdk/resourcemanager/postgresql/armpostgresql/operations_client.go index 43b8f9e98dd1..24c771fa719e 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/operations_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/operations_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/operations_client_example_test.go deleted file mode 100644 index ab1081e3bc84..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/operations_client_example_test.go +++ /dev/null @@ -1,207 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armpostgresql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.OperationListResult{ - // Value: []*armpostgresql.Operation{ - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/locations/performanceTiers/read"), - // Display: &armpostgresql.OperationDisplay{ - // Description: to.Ptr("Returns the list of Performance Tiers available."), - // Operation: to.Ptr("List Performance Tiers"), - // Provider: to.Ptr("Microsoft DB for PostgreSQL"), - // Resource: to.Ptr("Performance Tiers"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/read"), - // Display: &armpostgresql.OperationDisplay{ - // Description: to.Ptr("Return the list of servers or gets the properties for the specified server."), - // Operation: to.Ptr("List/Get PostgreSQL Servers"), - // Provider: to.Ptr("Microsoft DB for PostgreSQL"), - // Resource: to.Ptr("PostgreSQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/write"), - // Display: &armpostgresql.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 PostgreSQL Server"), - // Provider: to.Ptr("Microsoft DB for PostgreSQL"), - // Resource: to.Ptr("PostgreSQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/delete"), - // Display: &armpostgresql.OperationDisplay{ - // Description: to.Ptr("Deletes an existing server."), - // Operation: to.Ptr("Delete PostgreSQL Server"), - // Provider: to.Ptr("Microsoft DB for PostgreSQL"), - // Resource: to.Ptr("PostgreSQL Server"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/performanceTiers/read"), - // Display: &armpostgresql.OperationDisplay{ - // Description: to.Ptr("Returns the list of Performance Tiers available."), - // Operation: to.Ptr("List Performance Tiers"), - // Provider: to.Ptr("Microsoft DB for PostgreSQL"), - // Resource: to.Ptr("Performance Tiers"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/firewallRules/read"), - // Display: &armpostgresql.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 PostgreSQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/firewallRules/write"), - // Display: &armpostgresql.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 PostgreSQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/firewallRules/delete"), - // Display: &armpostgresql.OperationDisplay{ - // Description: to.Ptr("Deletes an existing firewall rule."), - // Operation: to.Ptr("Delete Firewall Rule"), - // Provider: to.Ptr("Microsoft DB for PostgreSQL"), - // Resource: to.Ptr("Firewall Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/providers/Microsoft.Insights/metricDefinitions/read"), - // Display: &armpostgresql.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 PostgreSQL"), - // 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": "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", - // }, - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/providers/Microsoft.Insights/diagnosticSettings/read"), - // Display: &armpostgresql.OperationDisplay{ - // Description: to.Ptr("Gets the disagnostic setting for the resource"), - // Operation: to.Ptr("Read diagnostic setting"), - // Provider: to.Ptr("Microsoft DB for PostgreSQL"), - // Resource: to.Ptr("Database Metric Definition"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.DBforPostgreSQL/servers/providers/Microsoft.Insights/diagnosticSettings/write"), - // Display: &armpostgresql.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 PostgreSQL"), - // Resource: to.Ptr("Database Metric Definition"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/options.go b/sdk/resourcemanager/postgresql/armpostgresql/options.go new file mode 100644 index 000000000000..04a3103ccd01 --- /dev/null +++ b/sdk/resourcemanager/postgresql/armpostgresql/options.go @@ -0,0 +1,295 @@ +//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 armpostgresql + +// 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 +} + +// LogFilesClientListByServerOptions contains the optional parameters for the LogFilesClient.NewListByServerPager method. +type LogFilesClientListByServerOptions 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 +} + +// 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 +} + +// ServersClientBeginUpdateOptions contains the optional parameters for the ServersClient.BeginUpdate method. +type ServersClientBeginUpdateOptions 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 +} + +// 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 +} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/polymorphic_helpers.go b/sdk/resourcemanager/postgresql/armpostgresql/polymorphic_helpers.go index 28d9d2573988..3f00b67c170c 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/polymorphic_helpers.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/privateendpointconnections_client.go b/sdk/resourcemanager/postgresql/armpostgresql/privateendpointconnections_client.go index 23473325a888..41719f6e0b40 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/privateendpointconnections_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/privateendpointconnections_client_example_test.go deleted file mode 100644 index 68842d2c0caa..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,229 +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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforPostgreSQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armpostgresql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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", armpostgresql.PrivateEndpointConnection{ - Properties: &armpostgresql.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armpostgresql.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 = armpostgresql.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforPostgreSQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armpostgresql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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", armpostgresql.TagsObject{ - Tags: map[string]*string{ - "key1": to.Ptr("val1"), - "key2": to.Ptr("val2"), - "key3": to.Ptr("val3"), - }, - }, 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 = armpostgresql.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforPostgreSQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armpostgresql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.PrivateEndpointConnectionListResult{ - // Value: []*armpostgresql.PrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforPostgreSQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armpostgresql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.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.DBforPostgreSQL/servers/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforPostgreSQL/servers/test-svr/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armpostgresql.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.PrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr("Approved"), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/privatelinkresources_client.go b/sdk/resourcemanager/postgresql/armpostgresql/privatelinkresources_client.go index beec1e8f6d1d..1726b3456656 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/privatelinkresources_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/privatelinkresources_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/privatelinkresources_client_example_test.go deleted file mode 100644 index 8004a48c2c68..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.PrivateLinkResourceListResult{ - // Value: []*armpostgresql.PrivateLinkResource{ - // { - // Name: to.Ptr("plr"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforPostgreSQL/servers/test-svr/privateLinkResources/plr"), - // Properties: &armpostgresql.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("postgresqlServer"), - // RequiredMembers: []*string{ - // to.Ptr("postgresqlServer")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.PrivateLinkResource{ - // Name: to.Ptr("plr"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/privateLinkResources"), - // ID: to.Ptr("subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.DBforPostgreSQL/servers/test-svr/privateLinkResources/plr"), - // Properties: &armpostgresql.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("postgresqlServer"), - // RequiredMembers: []*string{ - // to.Ptr("postgresqlServer")}, - // }, - // } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/recoverableservers_client.go b/sdk/resourcemanager/postgresql/armpostgresql/recoverableservers_client.go index 8b7074fe27a8..b4dd29bf68ea 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/recoverableservers_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/recoverableservers_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/recoverableservers_client_example_test.go deleted file mode 100644 index 54a7b75c8c90..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoverableServersClient().Get(ctx, "testrg", "pgtestsvc4", 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 = armpostgresql.RecoverableServerResource{ - // Name: to.Ptr("recoverableServers"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/recoverableServers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4/recoverableServers"), - // Properties: &armpostgresql.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("9.6"), - // }, - // } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/replicas_client.go b/sdk/resourcemanager/postgresql/armpostgresql/replicas_client.go index a76acfc5d174..117412148017 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/replicas_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql diff --git a/sdk/resourcemanager/postgresql/armpostgresql/replicas_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/replicas_client_example_test.go deleted file mode 100644 index 0197da7d3cdd..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/replicas_client_example_test.go +++ /dev/null @@ -1,186 +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 armpostgresql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReplicasClient().NewListByServerPager("TestGroup_WestCentralUS", "testserver-master", 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 = armpostgresql.ServerListResult{ - // Value: []*armpostgresql.Server{ - // { - // Name: to.Ptr("testserver-replica1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica1"), - // Location: to.Ptr("westcentralus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("postgres"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T00:05:03.2695756+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver-replica1.postgres.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumDisabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](2048000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen4_16"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("testserver-replica2"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica2"), - // Location: to.Ptr("westcentralus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("postgres"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T00:05:03.2695756+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver-replica2.postgres.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumDisabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](2048000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen4_16"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("testserver-replica3"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica3"), - // Location: to.Ptr("westcentralus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("postgres"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T00:05:03.2695756+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver-replica3.postgres.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumDisabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](2048000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen4_16"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("testserver-replica4"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica4"), - // Location: to.Ptr("westcentralus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("postgres"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T00:05:03.2695756+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver-replica4.postgres.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumDisabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](2048000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen4_16"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("testserver-replica5"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica5"), - // Location: to.Ptr("westcentralus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("postgres"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-12T00:05:03.2695756+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver-replica5.postgres.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumDisabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](2048000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen4_16"), - // Capacity: to.Ptr[int32](16), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/response_types.go b/sdk/resourcemanager/postgresql/armpostgresql/response_types.go index 1e6854462928..421b665576a0 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/response_types.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/response_types.go @@ -3,34 +3,38 @@ // 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 armpostgresql // 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 } @@ -41,16 +45,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 } @@ -61,31 +68,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 } // LogFilesClientListByServerResponse contains the response from method LogFilesClient.NewListByServerPager. type LogFilesClientListByServerResponse struct { + // A list of log files. LogFileListResult } // 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 } @@ -96,41 +109,49 @@ 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 } // 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 } @@ -141,21 +162,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 PostgreSQL Server key. ServerKey } @@ -166,36 +191,43 @@ type ServerKeysClientDeleteResponse struct { // ServerKeysClientGetResponse contains the response from method ServerKeysClient.Get. type ServerKeysClientGetResponse struct { + // A PostgreSQL Server key. ServerKey } // ServerKeysClientListResponse contains the response from method ServerKeysClient.NewListPager. type ServerKeysClientListResponse struct { + // A list of PostgreSQL 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 } @@ -206,16 +238,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 } @@ -226,11 +261,13 @@ type ServersClientRestartResponse struct { // ServersClientUpdateResponse contains the response from method ServersClient.BeginUpdate. type ServersClientUpdateResponse struct { + // Represents a server. Server } // VirtualNetworkRulesClientCreateOrUpdateResponse contains the response from method VirtualNetworkRulesClient.BeginCreateOrUpdate. type VirtualNetworkRulesClientCreateOrUpdateResponse struct { + // A virtual network rule. VirtualNetworkRule } @@ -241,10 +278,12 @@ 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 } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/serveradministrators_client.go b/sdk/resourcemanager/postgresql/armpostgresql/serveradministrators_client.go index 6779eb4f4c25..7cc99c372d49 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/serveradministrators_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/serveradministrators_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/serveradministrators_client_example_test.go deleted file mode 100644 index 7c219bc773a9..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerAdministratorsClient().Get(ctx, "testrg", "pgtestsvc4", 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 = armpostgresql.ServerAdministratorResource{ - // Name: to.Ptr("activeDirectory"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4/administrators/activeDirectory"), - // Properties: &armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAdministratorsClient().BeginCreateOrUpdate(ctx, "testrg", "pgtestsvc4", armpostgresql.ServerAdministratorResource{ - Properties: &armpostgresql.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 = armpostgresql.ServerAdministratorResource{ - // Name: to.Ptr("activeDirectory"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4/administrators/activeDirectory"), - // Properties: &armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerAdministratorsClient().BeginDelete(ctx, "testrg", "pgtestsvc4", 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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerAdministratorsClient().NewListPager("testrg", "pgtestsvc4", 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 = armpostgresql.ServerAdministratorResourceListResult{ - // Value: []*armpostgresql.ServerAdministratorResource{ - // { - // Name: to.Ptr("ActiveDirectory"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/administrators"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4/administrators/activeDirectory"), - // Properties: &armpostgresql.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/postgresql/armpostgresql/serverbasedperformancetier_client.go b/sdk/resourcemanager/postgresql/armpostgresql/serverbasedperformancetier_client.go index 2c58b78418af..d8329575b6b6 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/serverbasedperformancetier_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql diff --git a/sdk/resourcemanager/postgresql/armpostgresql/serverbasedperformancetier_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/serverbasedperformancetier_client_example_test.go deleted file mode 100644 index ff7046752d7a..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerBasedPerformanceTierClient().NewListPager("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.PerformanceTierListResult = armpostgresql.PerformanceTierListResult{ - // Value: []*armpostgresql.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: []*armpostgresql.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: []*armpostgresql.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: []*armpostgresql.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/postgresql/armpostgresql/serverkeys_client.go b/sdk/resourcemanager/postgresql/armpostgresql/serverkeys_client.go index 08f0b8a9ecf9..37837188d554 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/serverkeys_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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 PostgreSQL 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 PostgreSQL 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/postgresql/armpostgresql/serverkeys_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/serverkeys_client_example_test.go deleted file mode 100644 index 42cb8ec87ae7..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.ServerKeyListResult{ - // Value: []*armpostgresql.ServerKey{ - // { - // Name: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/keys"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/testserver/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armpostgresql.ServerKeyProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00.0Z"); return t}()), - // ServerKeyType: to.Ptr(armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.ServerKey{ - // Name: to.Ptr("someVault_someKey_01234567890123456789012345678901"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/keys"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/testserver/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armpostgresql.ServerKeyProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T00:00:00.0Z"); return t}()), - // ServerKeyType: to.Ptr(armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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", armpostgresql.ServerKey{ - Properties: &armpostgresql.ServerKeyProperties{ - ServerKeyType: to.Ptr(armpostgresql.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 = armpostgresql.ServerKey{ - // Name: to.Ptr("omeVault_someKey_01234567890123456789012345678901"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/keys"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/testserver/keys/someVault_someKey_01234567890123456789012345678901"), - // Kind: to.Ptr("azurekeyvault"), - // Properties: &armpostgresql.ServerKeyProperties{ - // CreationDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-05-01T00:00:00.0Z"); return t}()), - // ServerKeyType: to.Ptr(armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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/postgresql/armpostgresql/serverparameters_client.go b/sdk/resourcemanager/postgresql/armpostgresql/serverparameters_client.go index 554f64bc0343..e259c0688c19 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/serverparameters_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/serverparameters_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/serverparameters_client_example_test.go deleted file mode 100644 index b9407efbfb1d..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerParametersClient().BeginListUpdateConfigurations(ctx, "TestGroup", "testserver", armpostgresql.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 = armpostgresql.ConfigurationListResult{ - // Value: []*armpostgresql.Configuration{ - // { - // Name: to.Ptr("array_nulls"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/array_nulls"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Enable input of NULL elements in arrays."), - // AllowedValues: to.Ptr("on,off"), - // DataType: to.Ptr("Boolean"), - // DefaultValue: to.Ptr("on"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("on"), - // }, - // }, - // { - // Name: to.Ptr("backslash_quote"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/configurations"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/testserver/configurations/backslash_quote"), - // Properties: &armpostgresql.ConfigurationProperties{ - // Description: to.Ptr("Sets whether \"\\'\" is allowed in string literals."), - // AllowedValues: to.Ptr("safe_encoding,on,off"), - // DataType: to.Ptr("Enumeration"), - // DefaultValue: to.Ptr("safe_encoding"), - // Source: to.Ptr("system-default"), - // Value: to.Ptr("safe_encoding"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/servers_client.go b/sdk/resourcemanager/postgresql/armpostgresql/servers_client.go index 4a4277619882..d4ef84b0192d 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/servers_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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. @@ -421,7 +435,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) } @@ -433,18 +448,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. @@ -470,5 +487,8 @@ 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 } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/servers_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/servers_client_example_test.go deleted file mode 100644 index 63cb0986bd33..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/servers_client_example_test.go +++ /dev/null @@ -1,761 +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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TargetResourceGroup", "targetserver", armpostgresql.ServerForCreate{ - Location: to.Ptr("brazilsouth"), - Properties: &armpostgresql.ServerPropertiesForRestore{ - CreateMode: to.Ptr(armpostgresql.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.DBforPostgreSQL/servers/sourceserver"), - }, - SKU: &armpostgresql.SKU{ - Name: to.Ptr("B_Gen5_2"), - Capacity: to.Ptr[int32](2), - Family: to.Ptr("Gen5"), - Tier: to.Ptr(armpostgresql.SKUTierBasic), - }, - 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 = armpostgresql.Server{ - // Name: to.Ptr("targetserver"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver"), - // Location: to.Ptr("brazilsouth"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-12-14T21:08:24.637+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("targetserver.postgres.database.azure.com"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("B_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr(armpostgresql.SKUTierBasic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TestGroup", "pgtestsvc4", armpostgresql.ServerForCreate{ - Location: to.Ptr("westus"), - Properties: &armpostgresql.ServerPropertiesForDefaultCreate{ - CreateMode: to.Ptr(armpostgresql.CreateModeDefault), - MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS12), - SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - StorageProfile: &armpostgresql.StorageProfile{ - BackupRetentionDays: to.Ptr[int32](7), - GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - StorageMB: to.Ptr[int32](128000), - }, - AdministratorLogin: to.Ptr("cloudsa"), - AdministratorLoginPassword: to.Ptr(""), - }, - SKU: &armpostgresql.SKU{ - Name: to.Ptr("B_Gen5_2"), - Capacity: to.Ptr[int32](2), - Family: to.Ptr("Gen5"), - Tier: to.Ptr(armpostgresql.SKUTierBasic), - }, - 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 = armpostgresql.Server{ - // Name: to.Ptr("pgtestsvc4"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T21:08:24.637+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc4.postgres.database.azure.com"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("B_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr(armpostgresql.SKUTierBasic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TestGroup_WestCentralUS", "testserver-replica1", armpostgresql.ServerForCreate{ - Location: to.Ptr("westcentralus"), - Properties: &armpostgresql.ServerPropertiesForReplica{ - CreateMode: to.Ptr(armpostgresql.CreateModeReplica), - SourceServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"), - }, - SKU: &armpostgresql.SKU{ - Name: to.Ptr("GP_Gen5_2"), - Capacity: to.Ptr[int32](2), - Family: to.Ptr("Gen5"), - Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - }, - }, 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 = armpostgresql.Server{ - // Name: to.Ptr("testserver-replica1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-replica1"), - // Location: to.Ptr("westcentralus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("postgres"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-06-20T00:17:56.677+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("testserver-replica1.postgres.database.azure.com"), - // MasterServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master"), - // ReplicaCapacity: to.Ptr[int32](0), - // ReplicationRole: to.Ptr("Replica"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumDisabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](2048000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginCreate(ctx, "TargetResourceGroup", "targetserver", armpostgresql.ServerForCreate{ - Location: to.Ptr("westus"), - Properties: &armpostgresql.ServerPropertiesForGeoRestore{ - CreateMode: to.Ptr(armpostgresql.CreateModeGeoRestore), - SourceServerID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"), - }, - SKU: &armpostgresql.SKU{ - Name: to.Ptr("GP_Gen5_2"), - Capacity: to.Ptr[int32](2), - Family: to.Ptr("Gen5"), - Tier: to.Ptr(armpostgresql.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 = armpostgresql.Server{ - // Name: to.Ptr("targetserver"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/targetserver"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T21:08:24.637+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("targetserver.postgres.database.azure.com"), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen5_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen5"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServersClient().BeginUpdate(ctx, "testrg", "pgtestsvc4", armpostgresql.ServerUpdateParameters{ - Properties: &armpostgresql.ServerUpdateParametersProperties{ - AdministratorLoginPassword: to.Ptr(""), - MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS12), - SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - }, - }, 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 = armpostgresql.Server{ - // Name: to.Ptr("pgtestsvc4"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T21:08:24.637+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc4.postgres.database.azure.com"), - // MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS12), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("B_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierBasic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServersClient().Get(ctx, "testrg", "pgtestsvc1", 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 = armpostgresql.Server{ - // Name: to.Ptr("pgtestsvc1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc1"), - // Location: to.Ptr("westus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-04T21:00:58.9243541+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc1.postgres.database.azure.com"), - // MasterServerID: to.Ptr(""), - // MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS12), - // PrivateEndpointConnections: []*armpostgresql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc1/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armpostgresql.ServerPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.ServerPrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armpostgresql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armpostgresql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armpostgresql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armpostgresql.PublicNetworkAccessEnumEnabled), - // ReplicationRole: to.Ptr(""), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](10), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine5), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("B_Gen4_1"), - // Capacity: to.Ptr[int32](1), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierBasic), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServersClient().NewListByResourceGroupPager("TestGroup", 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 = armpostgresql.ServerListResult{ - // Value: []*armpostgresql.Server{ - // { - // Name: to.Ptr("pgtestsvc1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc1"), - // Location: to.Ptr("westus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-04T21:01:55.1498475+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc1.postgres.database.azure.com"), - // PrivateEndpointConnections: []*armpostgresql.ServerPrivateEndpointConnection{ - // }, - // PublicNetworkAccess: to.Ptr(armpostgresql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](10), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine5), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("B_Gen4_1"), - // Capacity: to.Ptr[int32](1), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierBasic), - // }, - // }, - // { - // Name: to.Ptr("pgtestsvc2"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc2"), - // Location: to.Ptr("westus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-07T21:01:55.1498475+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc2.postgres.database.azure.com"), - // PrivateEndpointConnections: []*armpostgresql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc2/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armpostgresql.ServerPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.ServerPrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armpostgresql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armpostgresql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armpostgresql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armpostgresql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("pgtestsvc4"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T21:08:24.637+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc4.postgres.database.azure.com"), - // PrivateEndpointConnections: []*armpostgresql.ServerPrivateEndpointConnection{ - // }, - // PublicNetworkAccess: to.Ptr(armpostgresql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("B_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierBasic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.ServerListResult{ - // Value: []*armpostgresql.Server{ - // { - // Name: to.Ptr("pgtestsvc1"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc1"), - // Location: to.Ptr("westus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-04T21:01:55.1498475+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc1.postgres.database.azure.com"), - // MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS11), - // PrivateEndpointConnections: []*armpostgresql.ServerPrivateEndpointConnection{ - // }, - // PublicNetworkAccess: to.Ptr(armpostgresql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](10), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine5), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("B_Gen4_1"), - // Capacity: to.Ptr[int32](1), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierBasic), - // }, - // }, - // { - // Name: to.Ptr("pgtestsvc2"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc2"), - // Location: to.Ptr("westus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-07T21:01:55.1498475+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc2.postgres.database.azure.com"), - // MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS12), - // PrivateEndpointConnections: []*armpostgresql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc2/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armpostgresql.ServerPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.ServerPrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armpostgresql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armpostgresql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armpostgresql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armpostgresql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](5120), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("pgtestsvc3"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg1/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc3"), - // Location: to.Ptr("westus"), - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("testuser"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-01T00:11:08.55+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc3.postgres.database.azure.com"), - // MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS10), - // PrivateEndpointConnections: []*armpostgresql.ServerPrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc3/privateEndpointConnections/private-endpoint-name-00000000-1111-2222-3333-444444444444"), - // Properties: &armpostgresql.ServerPrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armpostgresql.PrivateEndpointProperty{ - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armpostgresql.ServerPrivateLinkServiceConnectionStateProperty{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr(armpostgresql.PrivateLinkServiceConnectionStateActionsRequireNone), - // Status: to.Ptr(armpostgresql.PrivateLinkServiceConnectionStateStatusApproved), - // }, - // ProvisioningState: to.Ptr(armpostgresql.PrivateEndpointProvisioningState("Succeeded")), - // }, - // }}, - // PublicNetworkAccess: to.Ptr(armpostgresql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](35), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupEnabled), - // StorageMB: to.Ptr[int32](204800), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("GP_Gen4_4"), - // Capacity: to.Ptr[int32](4), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierGeneralPurpose), - // }, - // }, - // { - // Name: to.Ptr("pgtestsvc4"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/servers/pgtestsvc4"), - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "ElasticServer": to.Ptr("1"), - // }, - // Properties: &armpostgresql.ServerProperties{ - // AdministratorLogin: to.Ptr("cloudsa"), - // EarliestRestoreDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-03-14T21:08:24.637+00:00"); return t}()), - // FullyQualifiedDomainName: to.Ptr("pgtestsvc4.postgres.database.azure.com"), - // MinimalTLSVersion: to.Ptr(armpostgresql.MinimalTLSVersionEnumTLS10), - // PrivateEndpointConnections: []*armpostgresql.ServerPrivateEndpointConnection{ - // }, - // PublicNetworkAccess: to.Ptr(armpostgresql.PublicNetworkAccessEnumEnabled), - // SSLEnforcement: to.Ptr(armpostgresql.SSLEnforcementEnumEnabled), - // StorageProfile: &armpostgresql.StorageProfile{ - // BackupRetentionDays: to.Ptr[int32](7), - // GeoRedundantBackup: to.Ptr(armpostgresql.GeoRedundantBackupDisabled), - // StorageMB: to.Ptr[int32](128000), - // }, - // UserVisibleState: to.Ptr(armpostgresql.ServerStateReady), - // Version: to.Ptr(armpostgresql.ServerVersionNine6), - // }, - // SKU: &armpostgresql.SKU{ - // Name: to.Ptr("B_Gen4_2"), - // Capacity: to.Ptr[int32](2), - // Family: to.Ptr("Gen4"), - // Tier: to.Ptr(armpostgresql.SKUTierBasic), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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) - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/serversecurityalertpolicies_client.go b/sdk/resourcemanager/postgresql/armpostgresql/serversecurityalertpolicies_client.go index 5d9a7677c8f4..6a17cfef4ba2 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/serversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/serversecurityalertpolicies_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/serversecurityalertpolicies_client_example_test.go deleted file mode 100644 index 2e2a832da058..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerSecurityAlertPoliciesClient().Get(ctx, "securityalert-4799", "securityalert-6440", armpostgresql.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 = armpostgresql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforPostgreSQL/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armpostgresql.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(armpostgresql.ServerSecurityAlertPolicyStateDisabled), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerSecurityAlertPoliciesClient().BeginCreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", armpostgresql.SecurityAlertPolicyNameDefault, armpostgresql.ServerSecurityAlertPolicy{ - Properties: &armpostgresql.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(armpostgresql.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 = armpostgresql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforPostgreSQL/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armpostgresql.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(armpostgresql.ServerSecurityAlertPolicyStateEnabled), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerSecurityAlertPoliciesClient().BeginCreateOrUpdate(ctx, "securityalert-4799", "securityalert-6440", armpostgresql.SecurityAlertPolicyNameDefault, armpostgresql.ServerSecurityAlertPolicy{ - Properties: &armpostgresql.SecurityAlertPolicyProperties{ - EmailAccountAdmins: to.Ptr(true), - State: to.Ptr(armpostgresql.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 = armpostgresql.ServerSecurityAlertPolicy{ - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforPostgreSQL/servers/securityalert-6440/securityAlertPolicies/default"), - // Properties: &armpostgresql.SecurityAlertPolicyProperties{ - // DisabledAlerts: []*string{ - // to.Ptr("")}, - // EmailAccountAdmins: to.Ptr(true), - // EmailAddresses: []*string{ - // to.Ptr("")}, - // RetentionDays: to.Ptr[int32](0), - // State: to.Ptr(armpostgresql.ServerSecurityAlertPolicyStateEnabled), - // StorageEndpoint: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.ServerSecurityAlertPolicyListResult{ - // Value: []*armpostgresql.ServerSecurityAlertPolicy{ - // { - // Name: to.Ptr("Default"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/securityAlertPolicies"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/securityalert-4799/providers/Microsoft.DBforPostgreSQL/servers/securityalert-6440/securityAlertPolicies"), - // Properties: &armpostgresql.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(armpostgresql.ServerSecurityAlertPolicyStateDisabled), - // StorageEndpoint: to.Ptr("https://mystorage.blob.core.windows.net"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/time_rfc3339.go b/sdk/resourcemanager/postgresql/armpostgresql/time_rfc3339.go index 4643060060b7..b4c56076e550 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/time_rfc3339.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql diff --git a/sdk/resourcemanager/postgresql/armpostgresql/virtualnetworkrules_client.go b/sdk/resourcemanager/postgresql/armpostgresql/virtualnetworkrules_client.go index 5f135d73f3e2..001b5dbc3ddd 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/virtualnetworkrules_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql @@ -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/postgresql/armpostgresql/virtualnetworkrules_client_example_test.go b/sdk/resourcemanager/postgresql/armpostgresql/virtualnetworkrules_client_example_test.go deleted file mode 100644 index 547a41d821c9..000000000000 --- a/sdk/resourcemanager/postgresql/armpostgresql/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 armpostgresql_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/postgresql/armpostgresql" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.VirtualNetworkRule{ - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armpostgresql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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", armpostgresql.VirtualNetworkRule{ - Properties: &armpostgresql.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 = armpostgresql.VirtualNetworkRule{ - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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/c767823fdfd9d5e96bad245e3ea4d14d94a716bb/specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/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 := armpostgresql.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 = armpostgresql.VirtualNetworkRuleListResult{ - // Value: []*armpostgresql.VirtualNetworkRule{ - // { - // Name: to.Ptr("vnet-firewall-rule"), - // Type: to.Ptr("Microsoft.DBforPostgreSQL/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armpostgresql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armpostgresql.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.DBforPostgreSQL/servers/virtualNetworkRules"), - // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.DBforPostgreSQL/servers/vnet-test-svr/virtualNetworkRules/vnet-firewall-rule"), - // Properties: &armpostgresql.VirtualNetworkRuleProperties{ - // IgnoreMissingVnetServiceEndpoint: to.Ptr(false), - // State: to.Ptr(armpostgresql.VirtualNetworkRuleStateReady), - // VirtualNetworkSubnetID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"), - // }, - // }}, - // } - } -}