From 66716d39e65257adb595b0f034643f7bf6b556e1 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 10 Jan 2023 08:05:12 +0000 Subject: [PATCH] CodeGen from PR 22025 in Azure/azure-rest-api-specs Merge 709a3447130b05989091667e0c9d07f5870086d2 into af278a72acb702e898d22311fb002a7fcff6f07e --- .../armpostgresqlhsc/CHANGELOG.md | 148 ++ .../armpostgresqlhsc/autorest.md | 6 +- .../armpostgresqlhsc/clusters_client.go | 703 ++++++ .../armpostgresqlhsc/configurations_client.go | 387 +++ .../armpostgresqlhsc/constants.go | 89 + ...ules_client.go => firewallrules_client.go} | 160 +- .../postgresqlhsc/armpostgresqlhsc/go.mod | 14 +- .../postgresqlhsc/armpostgresqlhsc/go.sum | 24 +- .../postgresqlhsc/armpostgresqlhsc/models.go | 1064 ++++++++ .../armpostgresqlhsc/models_serde.go | 2196 +++++++++++++++++ ...rations_client.go => operations_client.go} | 8 +- .../privateendpointconnections_client.go | 308 +++ .../privatelinkresources_client.go | 175 ++ .../armpostgresqlhsc/response_types.go | 175 ++ ...erated_roles_client.go => roles_client.go} | 133 +- ...ed_servers_client.go => servers_client.go} | 85 +- ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...ated_example_configurations_client_test.go | 134 - ...rated_example_firewallrules_client_test.go | 125 - ...enerated_example_operations_client_test.go | 41 - .../ze_generated_example_roles_client_test.go | 101 - ...erated_example_servergroups_client_test.go | 314 --- ...e_generated_example_servers_client_test.go | 66 - .../zz_generated_configurations_client.go | 330 --- .../zz_generated_constants.go | 234 -- .../armpostgresqlhsc/zz_generated_models.go | 775 ------ .../zz_generated_models_serde.go | 290 --- .../zz_generated_response_types.go | 129 - .../zz_generated_servergroups_client.go | 663 ----- 29 files changed, 5438 insertions(+), 3440 deletions(-) create mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/clusters_client.go create mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/configurations_client.go create mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/constants.go rename sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/{zz_generated_firewallrules_client.go => firewallrules_client.go} (58%) create mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/models.go create mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/models_serde.go rename sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/{zz_generated_operations_client.go => operations_client.go} (93%) create mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/privateendpointconnections_client.go create mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/privatelinkresources_client.go create mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/response_types.go rename sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/{zz_generated_roles_client.go => roles_client.go} (56%) rename sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/{zz_generated_servers_client.go => servers_client.go} (57%) rename sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_configurations_client_test.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_firewallrules_client_test.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_roles_client_test.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_servergroups_client_test.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_servers_client_test.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_configurations_client.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_constants.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_models.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_models_serde.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_response_types.go delete mode 100644 sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_servergroups_client.go diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/CHANGELOG.md b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/CHANGELOG.md index 6cd070bf7ad5..a7d74df4cb61 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/CHANGELOG.md +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/CHANGELOG.md @@ -1,5 +1,153 @@ # Release History +## 1.0.0 (2023-01-10) +### Breaking Changes + +- Type of `ServerProperties.ServerEdition` has been changed from `*ServerEdition` to `*string` +- Type alias `CitusVersion` has been removed +- Type alias `CreateMode` has been removed +- Type alias `PostgreSQLVersion` has been removed +- Type alias `ResourceProviderType` has been removed +- Type alias `ServerEdition` has been removed +- Type alias `ServerHaState` has been removed +- Type alias `ServerState` has been removed +- Function `*ConfigurationsClient.NewListByServerGroupPager` has been removed +- Function `*ConfigurationsClient.BeginUpdate` has been removed +- Function `*FirewallRulesClient.NewListByServerGroupPager` has been removed +- Function `*RolesClient.NewListByServerGroupPager` has been removed +- Function `NewServerGroupsClient` has been removed +- Function `*ServerGroupsClient.CheckNameAvailability` has been removed +- Function `*ServerGroupsClient.BeginCreateOrUpdate` has been removed +- Function `*ServerGroupsClient.BeginDelete` has been removed +- Function `*ServerGroupsClient.Get` has been removed +- Function `*ServerGroupsClient.NewListByResourceGroupPager` has been removed +- Function `*ServerGroupsClient.NewListPager` has been removed +- Function `*ServerGroupsClient.BeginRestart` has been removed +- Function `*ServerGroupsClient.BeginStart` has been removed +- Function `*ServerGroupsClient.BeginStop` has been removed +- Function `*ServerGroupsClient.BeginUpdate` has been removed +- Function `*ServersClient.NewListByServerGroupPager` has been removed +- Struct `CloudError` has been removed +- Struct `CloudErrorBody` has been removed +- Struct `ConfigurationsClientListByServerGroupResponse` has been removed +- Struct `ConfigurationsClientUpdateResponse` has been removed +- Struct `FirewallRulesClientListByServerGroupResponse` has been removed +- Struct `RolesClientListByServerGroupResponse` has been removed +- Struct `ServerGroup` has been removed +- Struct `ServerGroupConfiguration` has been removed +- Struct `ServerGroupConfigurationListResult` has been removed +- Struct `ServerGroupConfigurationProperties` has been removed +- Struct `ServerGroupForUpdate` has been removed +- Struct `ServerGroupListResult` has been removed +- Struct `ServerGroupProperties` has been removed +- Struct `ServerGroupPropertiesDelegatedSubnetArguments` has been removed +- Struct `ServerGroupPropertiesForUpdate` has been removed +- Struct `ServerGroupPropertiesPrivateDNSZoneArguments` has been removed +- Struct `ServerGroupServer` has been removed +- Struct `ServerGroupServerListResult` has been removed +- Struct `ServerGroupServerProperties` has been removed +- Struct `ServerGroupsClient` has been removed +- Struct `ServerGroupsClientCreateOrUpdateResponse` has been removed +- Struct `ServerGroupsClientDeleteResponse` has been removed +- Struct `ServerGroupsClientListByResourceGroupResponse` has been removed +- Struct `ServerGroupsClientListResponse` has been removed +- Struct `ServerGroupsClientRestartResponse` has been removed +- Struct `ServerGroupsClientStartResponse` has been removed +- Struct `ServerGroupsClientStopResponse` has been removed +- Struct `ServerGroupsClientUpdateResponse` has been removed +- Struct `ServerRoleGroup` has been removed +- Struct `ServersClientListByServerGroupResponse` has been removed +- Field `ServerGroupConfiguration` of struct `ConfigurationsClientGetResponse` has been removed +- Field `ServerGroupServer` of struct `ServersClientGetResponse` has been removed + +### Features Added + +- New function `NewClustersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ClustersClient, error)` +- New function `*ClustersClient.CheckNameAvailability(context.Context, NameAvailabilityRequest, *ClustersClientCheckNameAvailabilityOptions) (ClustersClientCheckNameAvailabilityResponse, error)` +- New function `*ClustersClient.BeginCreateOrUpdate(context.Context, string, string, Cluster, *ClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClustersClientCreateOrUpdateResponse], error)` +- New function `*ClustersClient.BeginDelete(context.Context, string, string, *ClustersClientBeginDeleteOptions) (*runtime.Poller[ClustersClientDeleteResponse], error)` +- New function `*ClustersClient.Get(context.Context, string, string, *ClustersClientGetOptions) (ClustersClientGetResponse, error)` +- New function `*ClustersClient.NewListByResourceGroupPager(string, *ClustersClientListByResourceGroupOptions) *runtime.Pager[ClustersClientListByResourceGroupResponse]` +- New function `*ClustersClient.NewListPager(*ClustersClientListOptions) *runtime.Pager[ClustersClientListResponse]` +- New function `*ClustersClient.BeginPromoteReadReplica(context.Context, string, string, *ClustersClientBeginPromoteReadReplicaOptions) (*runtime.Poller[ClustersClientPromoteReadReplicaResponse], error)` +- New function `*ClustersClient.BeginRestart(context.Context, string, string, *ClustersClientBeginRestartOptions) (*runtime.Poller[ClustersClientRestartResponse], error)` +- New function `*ClustersClient.BeginStart(context.Context, string, string, *ClustersClientBeginStartOptions) (*runtime.Poller[ClustersClientStartResponse], error)` +- New function `*ClustersClient.BeginStop(context.Context, string, string, *ClustersClientBeginStopOptions) (*runtime.Poller[ClustersClientStopResponse], error)` +- New function `*ClustersClient.BeginUpdate(context.Context, string, string, ClusterForUpdate, *ClustersClientBeginUpdateOptions) (*runtime.Poller[ClustersClientUpdateResponse], error)` +- New function `*ConfigurationsClient.NewListByClusterPager(string, string, *ConfigurationsClientListByClusterOptions) *runtime.Pager[ConfigurationsClientListByClusterResponse]` +- New function `*ConfigurationsClient.BeginUpdateCoordinator(context.Context, string, string, string, ServerConfigurationRequest, *ConfigurationsClientBeginUpdateCoordinatorOptions) (*runtime.Poller[ConfigurationsClientUpdateCoordinatorResponse], error)` +- New function `*ConfigurationsClient.BeginUpdateNode(context.Context, string, string, string, ServerConfigurationRequest, *ConfigurationsClientBeginUpdateNodeOptions) (*runtime.Poller[ConfigurationsClientUpdateNodeResponse], error)` +- New function `*FirewallRulesClient.NewListByClusterPager(string, string, *FirewallRulesClientListByClusterOptions) *runtime.Pager[FirewallRulesClientListByClusterResponse]` +- New function `NewPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)` +- New function `*PrivateEndpointConnectionsClient.CreateOrUpdate(context.Context, string, string, string, PrivateEndpointConnectionActionRequest, *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error)` +- New function `*PrivateEndpointConnectionsClient.BeginDelete(context.Context, string, string, string, *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` +- New function `*PrivateEndpointConnectionsClient.Get(context.Context, string, string, string, *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error)` +- New function `*PrivateEndpointConnectionsClient.NewListByClusterPager(string, string, *PrivateEndpointConnectionsClientListByClusterOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByClusterResponse]` +- New function `NewPrivateLinkResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateLinkResourcesClient, error)` +- New function `*PrivateLinkResourcesClient.Get(context.Context, string, string, string, *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error)` +- New function `*PrivateLinkResourcesClient.NewListByClusterPager(string, string, *PrivateLinkResourcesClientListByClusterOptions) *runtime.Pager[PrivateLinkResourcesClientListByClusterResponse]` +- New function `*RolesClient.NewListByClusterPager(string, string, *RolesClientListByClusterOptions) *runtime.Pager[RolesClientListByClusterResponse]` +- New function `*ServersClient.NewListByClusterPager(string, string, *ServersClientListByClusterOptions) *runtime.Pager[ServersClientListByClusterResponse]` +- New struct `Cluster` +- New struct `ClusterConfigurationListResult` +- New struct `ClusterForUpdate` +- New struct `ClusterListResult` +- New struct `ClusterProperties` +- New struct `ClusterPropertiesForUpdate` +- New struct `ClusterResponse` +- New struct `ClusterResponseProperties` +- New struct `ClusterServer` +- New struct `ClusterServerListResult` +- New struct `ClusterServerProperties` +- New struct `ClustersClient` +- New struct `ClustersClientCreateOrUpdateResponse` +- New struct `ClustersClientDeleteResponse` +- New struct `ClustersClientListByResourceGroupResponse` +- New struct `ClustersClientListResponse` +- New struct `ClustersClientPromoteReadReplicaResponse` +- New struct `ClustersClientRestartResponse` +- New struct `ClustersClientStartResponse` +- New struct `ClustersClientStopResponse` +- New struct `ClustersClientUpdateResponse` +- New struct `Configuration` +- New struct `ConfigurationProperties` +- New struct `ConfigurationsClientListByClusterResponse` +- New struct `ConfigurationsClientUpdateCoordinatorResponse` +- New struct `ConfigurationsClientUpdateNodeResponse` +- New struct `ErrorAdditionalInfo` +- New struct `ErrorDetail` +- New struct `ErrorResponse` +- New struct `FirewallRulesClientListByClusterResponse` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionActionRequest` +- New struct `PrivateEndpointConnectionActionRequestProperties` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionProperties` +- New struct `PrivateEndpointConnectionProperty` +- New struct `PrivateEndpointConnectionSimpleProperties` +- New struct `PrivateEndpointConnectionsClient` +- New struct `PrivateEndpointConnectionsClientDeleteResponse` +- New struct `PrivateEndpointConnectionsClientListByClusterResponse` +- New struct `PrivateEndpointProperty` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceListResult` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkResourcesClient` +- New struct `PrivateLinkResourcesClientListByClusterResponse` +- New struct `PrivateLinkServiceConnectionState` +- New struct `PrivateLinkServiceConnectionStateProperty` +- New struct `RolesClientListByClusterResponse` +- New struct `ServerConfigurationRequest` +- New struct `ServerConfigurationRequestProperties` +- New struct `ServersClientListByClusterResponse` +- New anonymous field `Configuration` in struct `ConfigurationsClientGetResponse` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `RequiresRestart` in struct `ServerConfigurationProperties` +- New anonymous field `ClusterServer` in struct `ServersClientGetResponse` +- New field `SystemData` in struct `TrackedResource` + + ## 0.5.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/autorest.md b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/autorest.md index 24e95c1b0045..c6d46ffa82df 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/autorest.md +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/postgresqlhsc/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/postgresqlhsc/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/postgresqlhsc/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/postgresqlhsc/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/clusters_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/clusters_client.go new file mode 100644 index 000000000000..6c5a0f52d411 --- /dev/null +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/clusters_client.go @@ -0,0 +1,703 @@ +//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 armpostgresqlhsc + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ClustersClient contains the methods for the Clusters group. +// Don't use this type directly, use NewClustersClient() instead. +type ClustersClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewClustersClient creates a new instance of ClustersClient with the specified values. +// subscriptionID - The ID of the target subscription. The value must be an UUID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClustersClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ClustersClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CheckNameAvailability - Check the availability of name for resource +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// nameAvailabilityRequest - The required parameters for checking if resource name is available. +// options - ClustersClientCheckNameAvailabilityOptions contains the optional parameters for the ClustersClient.CheckNameAvailability +// method. +func (client *ClustersClient) CheckNameAvailability(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *ClustersClientCheckNameAvailabilityOptions) (ClustersClientCheckNameAvailabilityResponse, error) { + req, err := client.checkNameAvailabilityCreateRequest(ctx, nameAvailabilityRequest, options) + if err != nil { + return ClustersClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClustersClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + } + return client.checkNameAvailabilityHandleResponse(resp) +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *ClustersClient) checkNameAvailabilityCreateRequest(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *ClustersClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *ClustersClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ClustersClientCheckNameAvailabilityResponse, error) { + result := ClustersClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { + return ClustersClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + +// BeginCreateOrUpdate - Creates a new cluster with servers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// parameters - The required parameters for creating or updating a cluster. +// options - ClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ClustersClient.BeginCreateOrUpdate +// method. +func (client *ClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClustersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClustersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ClustersClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Creates a new cluster with servers. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusCreated) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginDelete - Deletes a cluster together with servers in it. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. +func (client *ClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*runtime.Poller[ClustersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClustersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ClustersClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a cluster together with servers in it. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets information about a cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +func (client *ClustersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetOptions) (ClustersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return ClustersClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersClientGetResponse, error) { + result := ClustersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterResponse); err != nil { + return ClustersClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all the clusters in a given subscription. +// Generated from API version 2022-11-08 +// options - ClustersClientListOptions contains the optional parameters for the ClustersClient.List method. +func (client *ClustersClient) NewListPager(options *ClustersClientListOptions) *runtime.Pager[ClustersClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ClustersClientListResponse]{ + More: func(page ClustersClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClustersClientListResponse) (ClustersClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClustersClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClustersClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ClustersClient) listCreateRequest(ctx context.Context, options *ClustersClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersClientListResponse, error) { + result := ClustersClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { + return ClustersClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List all the clusters in a given resource group. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// options - ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.ListByResourceGroup +// method. +func (client *ClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *ClustersClientListByResourceGroupOptions) *runtime.Pager[ClustersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ClustersClientListByResourceGroupResponse]{ + More: func(page ClustersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ClustersClientListByResourceGroupResponse) (ClustersClientListByResourceGroupResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ClustersClientListByResourceGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ClustersClientListByResourceGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ClustersClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByResourceGroupHandleResponse(resp) + }, + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClustersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ClustersClientListByResourceGroupResponse, error) { + result := ClustersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { + return ClustersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginPromoteReadReplica - Promote the read replica cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - ClustersClientBeginPromoteReadReplicaOptions contains the optional parameters for the ClustersClient.BeginPromoteReadReplica +// method. +func (client *ClustersClient) BeginPromoteReadReplica(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginPromoteReadReplicaOptions) (*runtime.Poller[ClustersClientPromoteReadReplicaResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.promoteReadReplica(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClustersClientPromoteReadReplicaResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ClustersClientPromoteReadReplicaResponse](options.ResumeToken, client.pl, nil) + } +} + +// PromoteReadReplica - Promote the read replica cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ClustersClient) promoteReadReplica(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginPromoteReadReplicaOptions) (*http.Response, error) { + req, err := client.promoteReadReplicaCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// promoteReadReplicaCreateRequest creates the PromoteReadReplica request. +func (client *ClustersClient) promoteReadReplicaCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginPromoteReadReplicaOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/promote" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginRestart - Restarts the cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - ClustersClientBeginRestartOptions contains the optional parameters for the ClustersClient.BeginRestart method. +func (client *ClustersClient) BeginRestart(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginRestartOptions) (*runtime.Poller[ClustersClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClustersClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ClustersClientRestartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Restart - Restarts the cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ClustersClient) restart(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// restartCreateRequest creates the Restart request. +func (client *ClustersClient) restartCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/restart" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStart - Starts the cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - ClustersClientBeginStartOptions contains the optional parameters for the ClustersClient.BeginStart method. +func (client *ClustersClient) BeginStart(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStartOptions) (*runtime.Poller[ClustersClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClustersClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ClustersClientStartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Start - Starts the cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ClustersClient) start(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *ClustersClient) startCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/start" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - Stops the cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - ClustersClientBeginStopOptions contains the optional parameters for the ClustersClient.BeginStop method. +func (client *ClustersClient) BeginStop(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStopOptions) (*runtime.Poller[ClustersClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClustersClientStopResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ClustersClientStopResponse](options.ResumeToken, client.pl, nil) + } +} + +// Stop - Stops the cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ClustersClient) stop(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ClustersClient) stopCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ClustersClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/stop" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Updates an existing cluster. The request body can contain one to many of the properties present in the normal +// cluster definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// parameters - The parameters for updating a cluster. +// options - ClustersClientBeginUpdateOptions contains the optional parameters for the ClustersClient.BeginUpdate method. +func (client *ClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterForUpdate, options *ClustersClientBeginUpdateOptions) (*runtime.Poller[ClustersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, clusterName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClustersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ClustersClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Updates an existing cluster. The request body can contain one to many of the properties present in the normal +// cluster definition. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ClustersClient) update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterForUpdate, options *ClustersClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterForUpdate, options *ClustersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/configurations_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/configurations_client.go new file mode 100644 index 000000000000..31722daac100 --- /dev/null +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/configurations_client.go @@ -0,0 +1,387 @@ +//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 armpostgresqlhsc + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ConfigurationsClient contains the methods for the Configurations group. +// Don't use this type directly, use NewConfigurationsClient() instead. +type ConfigurationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values. +// subscriptionID - The ID of the target subscription. The value must be an UUID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConfigurationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets information of a configuration for coordinator and nodes. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// configurationName - The name of the cluster configuration. +// options - ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. +func (client *ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, options *ConfigurationsClientGetOptions) (ConfigurationsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, configurationName, options) + if err != nil { + return ConfigurationsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, options *ConfigurationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/configurations/{configurationName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsClientGetResponse, error) { + result := ConfigurationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { + return ConfigurationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - List all the configurations of a cluster. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - ConfigurationsClientListByClusterOptions contains the optional parameters for the ConfigurationsClient.ListByCluster +// method. +func (client *ConfigurationsClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *ConfigurationsClientListByClusterOptions) *runtime.Pager[ConfigurationsClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[ConfigurationsClientListByClusterResponse]{ + More: func(page ConfigurationsClientListByClusterResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConfigurationsClientListByClusterResponse) (ConfigurationsClientListByClusterResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConfigurationsClientListByClusterResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationsClientListByClusterResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationsClientListByClusterResponse{}, runtime.NewResponseError(resp) + } + return client.listByClusterHandleResponse(resp) + }, + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *ConfigurationsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ConfigurationsClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/configurations" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *ConfigurationsClient) listByClusterHandleResponse(resp *http.Response) (ConfigurationsClientListByClusterResponse, error) { + result := ConfigurationsClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterConfigurationListResult); err != nil { + return ConfigurationsClientListByClusterResponse{}, err + } + return result, nil +} + +// NewListByServerPager - List all the configurations of a server in cluster. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// serverName - The name of the server. +// options - ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.ListByServer +// method. +func (client *ConfigurationsClient) NewListByServerPager(resourceGroupName string, clusterName string, serverName string, options *ConfigurationsClientListByServerOptions) *runtime.Pager[ConfigurationsClientListByServerResponse] { + return runtime.NewPager(runtime.PagingHandler[ConfigurationsClientListByServerResponse]{ + More: func(page ConfigurationsClientListByServerResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConfigurationsClientListByServerResponse) (ConfigurationsClientListByServerResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByServerCreateRequest(ctx, resourceGroupName, clusterName, serverName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConfigurationsClientListByServerResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConfigurationsClientListByServerResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConfigurationsClientListByServerResponse{}, runtime.NewResponseError(resp) + } + return client.listByServerHandleResponse(resp) + }, + }) +} + +// listByServerCreateRequest creates the ListByServer request. +func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, serverName string, options *ConfigurationsClientListByServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/servers/{serverName}/configurations" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if serverName == "" { + return nil, errors.New("parameter serverName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByServerHandleResponse handles the ListByServer response. +func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Response) (ConfigurationsClientListByServerResponse, error) { + result := ConfigurationsClientListByServerResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ServerConfigurationListResult); err != nil { + return ConfigurationsClientListByServerResponse{}, err + } + return result, nil +} + +// BeginUpdateCoordinator - Updates configuration of coordinator in a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// configurationName - The name of the cluster configuration. +// parameters - The required parameters for updating a cluster configuration. +// options - ConfigurationsClientBeginUpdateCoordinatorOptions contains the optional parameters for the ConfigurationsClient.BeginUpdateCoordinator +// method. +func (client *ConfigurationsClient) BeginUpdateCoordinator(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters ServerConfigurationRequest, options *ConfigurationsClientBeginUpdateCoordinatorOptions) (*runtime.Poller[ConfigurationsClientUpdateCoordinatorResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateCoordinator(ctx, resourceGroupName, clusterName, configurationName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConfigurationsClientUpdateCoordinatorResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConfigurationsClientUpdateCoordinatorResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateCoordinator - Updates configuration of coordinator in a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ConfigurationsClient) updateCoordinator(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters ServerConfigurationRequest, options *ConfigurationsClientBeginUpdateCoordinatorOptions) (*http.Response, error) { + req, err := client.updateCoordinatorCreateRequest(ctx, resourceGroupName, clusterName, configurationName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateCoordinatorCreateRequest creates the UpdateCoordinator request. +func (client *ConfigurationsClient) updateCoordinatorCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters ServerConfigurationRequest, options *ConfigurationsClientBeginUpdateCoordinatorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/configurations/{configurationName}/coordinator" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// BeginUpdateNode - Updates configuration of nodes in a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// configurationName - The name of the cluster configuration. +// parameters - The required parameters for updating a cluster configuration. +// options - ConfigurationsClientBeginUpdateNodeOptions contains the optional parameters for the ConfigurationsClient.BeginUpdateNode +// method. +func (client *ConfigurationsClient) BeginUpdateNode(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters ServerConfigurationRequest, options *ConfigurationsClientBeginUpdateNodeOptions) (*runtime.Poller[ConfigurationsClientUpdateNodeResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.updateNode(ctx, resourceGroupName, clusterName, configurationName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ConfigurationsClientUpdateNodeResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ConfigurationsClientUpdateNodeResponse](options.ResumeToken, client.pl, nil) + } +} + +// UpdateNode - Updates configuration of nodes in a cluster +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *ConfigurationsClient) updateNode(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters ServerConfigurationRequest, options *ConfigurationsClientBeginUpdateNodeOptions) (*http.Response, error) { + req, err := client.updateNodeCreateRequest(ctx, resourceGroupName, clusterName, configurationName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// updateNodeCreateRequest creates the UpdateNode request. +func (client *ConfigurationsClient) updateNodeCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, configurationName string, parameters ServerConfigurationRequest, options *ConfigurationsClientBeginUpdateNodeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/configurations/{configurationName}/node" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if configurationName == "" { + return nil, errors.New("parameter configurationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/constants.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/constants.go new file mode 100644 index 000000000000..fa38994cd62f --- /dev/null +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/constants.go @@ -0,0 +1,89 @@ +//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 armpostgresqlhsc + +const ( + moduleName = "armpostgresqlhsc" + moduleVersion = "v1.0.0" +) + +// ConfigurationDataType - Data type of the configuration. +type ConfigurationDataType string + +const ( + ConfigurationDataTypeBoolean ConfigurationDataType = "Boolean" + ConfigurationDataTypeEnumeration ConfigurationDataType = "Enumeration" + ConfigurationDataTypeInteger ConfigurationDataType = "Integer" + ConfigurationDataTypeNumeric ConfigurationDataType = "Numeric" +) + +// PossibleConfigurationDataTypeValues returns the possible values for the ConfigurationDataType const type. +func PossibleConfigurationDataTypeValues() []ConfigurationDataType { + return []ConfigurationDataType{ + ConfigurationDataTypeBoolean, + ConfigurationDataTypeEnumeration, + ConfigurationDataTypeInteger, + ConfigurationDataTypeNumeric, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// OperationOrigin - The intended executor of the operation. +type OperationOrigin string + +const ( + OperationOriginNotSpecified OperationOrigin = "NotSpecified" + OperationOriginSystem OperationOrigin = "system" + OperationOriginUser OperationOrigin = "user" +) + +// PossibleOperationOriginValues returns the possible values for the OperationOrigin const type. +func PossibleOperationOriginValues() []OperationOrigin { + return []OperationOrigin{ + OperationOriginNotSpecified, + OperationOriginSystem, + OperationOriginUser, + } +} + +// ServerRole - The role of a server. +type ServerRole string + +const ( + ServerRoleCoordinator ServerRole = "Coordinator" + ServerRoleWorker ServerRole = "Worker" +) + +// PossibleServerRoleValues returns the possible values for the ServerRole const type. +func PossibleServerRoleValues() []ServerRole { + return []ServerRole{ + ServerRoleCoordinator, + ServerRoleWorker, + } +} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_firewallrules_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/firewallrules_client.go similarity index 58% rename from sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_firewallrules_client.go rename to sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/firewallrules_client.go index 8d2c4a5e94ae..39ffd4ae6b08 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/firewallrules_client.go @@ -5,6 +5,7 @@ // 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 armpostgresqlhsc @@ -31,7 +32,7 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -// subscriptionID - The ID of the target subscription. +// subscriptionID - The ID of the target subscription. The value must be an UUID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallRulesClient, error) { @@ -56,20 +57,22 @@ func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// firewallRuleName - The name of the server group firewall rule. +// clusterName - The name of the cluster. +// firewallRuleName - The name of the cluster firewall rule. // parameters - The required parameters for creating or updating a firewall rule. // options - FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate // method. -func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverGroupName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallRulesClientCreateOrUpdateResponse], error) { +func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallRulesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverGroupName, firewallRuleName, parameters, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, clusterName, firewallRuleName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[FirewallRulesClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FirewallRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[FirewallRulesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -77,9 +80,9 @@ func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverGroupName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverGroupName, firewallRuleName, parameters, options) +// Generated from API version 2022-11-08 +func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, firewallRuleName, parameters, options) if err != nil { return nil, err } @@ -87,27 +90,24 @@ func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/firewallRules/{firewallRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, firewallRuleName string, parameters FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/firewallRules/{firewallRuleName}" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) if firewallRuleName == "" { return nil, errors.New("parameter firewallRuleName cannot be empty") } @@ -117,37 +117,39 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } -// BeginDelete - Deletes a server group firewall rule. +// BeginDelete - Deletes a cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// firewallRuleName - The name of the server group firewall rule. +// clusterName - The name of the cluster. +// firewallRuleName - The name of the cluster firewall rule. // options - FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete // method. -func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, serverGroupName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*runtime.Poller[FirewallRulesClientDeleteResponse], error) { +func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*runtime.Poller[FirewallRulesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, serverGroupName, firewallRuleName, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, firewallRuleName, options) if err != nil { return nil, err } - return runtime.NewPoller[FirewallRulesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[FirewallRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[FirewallRulesClientDeleteResponse](options.ResumeToken, client.pl, nil) } } -// Delete - Deletes a server group firewall rule. +// Delete - Deletes a cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverGroupName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverGroupName, firewallRuleName, options) +// Generated from API version 2022-11-08 +func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, firewallRuleName, options) if err != nil { return nil, err } @@ -155,27 +157,24 @@ func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resource if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/firewallRules/{firewallRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/firewallRules/{firewallRuleName}" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) if firewallRuleName == "" { return nil, errors.New("parameter firewallRuleName cannot be empty") } @@ -185,21 +184,21 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Gets information about a server group firewall rule. +// Get - Gets information about a cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// firewallRuleName - The name of the server group firewall rule. +// clusterName - The name of the cluster. +// firewallRuleName - The name of the cluster firewall rule. // options - FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. -func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, serverGroupName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, serverGroupName, firewallRuleName, options) +func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, firewallRuleName, options) if err != nil { return FirewallRulesClientGetResponse{}, err } @@ -214,20 +213,17 @@ func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/firewallRules/{firewallRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/firewallRules/{firewallRuleName}" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) if firewallRuleName == "" { return nil, errors.New("parameter firewallRuleName cannot be empty") } @@ -237,7 +233,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,66 +248,62 @@ func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (Firew return result, nil } -// NewListByServerGroupPager - List all the firewall rules in a given server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// NewListByClusterPager - List all the firewall rules in a given cluster. +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - FirewallRulesClientListByServerGroupOptions contains the optional parameters for the FirewallRulesClient.ListByServerGroup +// clusterName - The name of the cluster. +// options - FirewallRulesClientListByClusterOptions contains the optional parameters for the FirewallRulesClient.ListByCluster // method. -func (client *FirewallRulesClient) NewListByServerGroupPager(resourceGroupName string, serverGroupName string, options *FirewallRulesClientListByServerGroupOptions) *runtime.Pager[FirewallRulesClientListByServerGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[FirewallRulesClientListByServerGroupResponse]{ - More: func(page FirewallRulesClientListByServerGroupResponse) bool { +func (client *FirewallRulesClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *FirewallRulesClientListByClusterOptions) *runtime.Pager[FirewallRulesClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallRulesClientListByClusterResponse]{ + More: func(page FirewallRulesClientListByClusterResponse) bool { return false }, - Fetcher: func(ctx context.Context, page *FirewallRulesClientListByServerGroupResponse) (FirewallRulesClientListByServerGroupResponse, error) { - req, err := client.listByServerGroupCreateRequest(ctx, resourceGroupName, serverGroupName, options) + Fetcher: func(ctx context.Context, page *FirewallRulesClientListByClusterResponse) (FirewallRulesClientListByClusterResponse, error) { + req, err := client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { - return FirewallRulesClientListByServerGroupResponse{}, err + return FirewallRulesClientListByClusterResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return FirewallRulesClientListByServerGroupResponse{}, err + return FirewallRulesClientListByClusterResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return FirewallRulesClientListByServerGroupResponse{}, runtime.NewResponseError(resp) + return FirewallRulesClientListByClusterResponse{}, runtime.NewResponseError(resp) } - return client.listByServerGroupHandleResponse(resp) + return client.listByClusterHandleResponse(resp) }, }) } -// listByServerGroupCreateRequest creates the ListByServerGroup request. -func (client *FirewallRulesClient) listByServerGroupCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *FirewallRulesClientListByServerGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/firewallRules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +// listByClusterCreateRequest creates the ListByCluster request. +func (client *FirewallRulesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *FirewallRulesClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/firewallRules" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByServerGroupHandleResponse handles the ListByServerGroup response. -func (client *FirewallRulesClient) listByServerGroupHandleResponse(resp *http.Response) (FirewallRulesClientListByServerGroupResponse, error) { - result := FirewallRulesClientListByServerGroupResponse{} +// listByClusterHandleResponse handles the ListByCluster response. +func (client *FirewallRulesClient) listByClusterHandleResponse(resp *http.Response) (FirewallRulesClientListByClusterResponse, error) { + result := FirewallRulesClientListByClusterResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { - return FirewallRulesClientListByServerGroupResponse{}, err + return FirewallRulesClientListByClusterResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/go.mod b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/go.mod index 6a728a5ffece..ae55405ae06e 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/go.mod +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresqlhsc/armpo go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/go.sum b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/go.sum +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/models.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/models.go new file mode 100644 index 000000000000..6230d9aabbe8 --- /dev/null +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/models.go @@ -0,0 +1,1064 @@ +//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 armpostgresqlhsc + +import "time" + +// Cluster - Represents a cluster for create. +type Cluster struct { + // The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Properties of the cluster create. + Properties *ClusterProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ClusterConfigurationListResult - A list of cluster configurations. +type ClusterConfigurationListResult struct { + // The list of cluster configurations. + Value []*Configuration `json:"value,omitempty"` + + // READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ClusterForUpdate - Represents a cluster for update. +type ClusterForUpdate struct { + // Properties of the cluster. + Properties *ClusterPropertiesForUpdate `json:"properties,omitempty"` + + // Application-specific metadata in the form of key-value pairs. + Tags map[string]*string `json:"tags,omitempty"` +} + +// ClusterListResult - A list of clusters. +type ClusterListResult struct { + // The list of clusters + Value []*ClusterResponse `json:"value,omitempty"` + + // READ-ONLY; The link used to get the next page of cluster list. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ClusterProperties - The properties used to create a new cluster. +type ClusterProperties struct { + // The password of the administrator login. Required for creation. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + + // The Citus version of cluster. + CitusVersion *string `json:"citusVersion,omitempty"` + + // If public IP is requested or not for the coordinator. + CoordinatorEnablePublicIPAccess *bool `json:"coordinatorEnablePublicIpAccess,omitempty"` + + // The edition of the coordinator (default: GeneralPurpose). Required for creation. + CoordinatorServerEdition *string `json:"coordinatorServerEdition,omitempty"` + + // The storage of the coordinator in MB. Required for creation. + CoordinatorStorageQuotaInMb *int64 `json:"coordinatorStorageQuotaInMb,omitempty"` + + // The vCores count of the coordinator (max: 64). Required for creation. + CoordinatorVCores *int64 `json:"coordinatorVCores,omitempty"` + + // If high availability is enabled or not for the cluster. + EnableHa *bool `json:"enableHa,omitempty"` + + // If shards on coordinator is enabled or not for the cluster. + EnableShardsOnCoordinator *bool `json:"enableShardsOnCoordinator,omitempty"` + + // Maintenance window of a cluster. + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + + // Worker node count of the cluster + NodeCount *int64 `json:"nodeCount,omitempty"` + + // If public IP is requested or not for a node. + NodeEnablePublicIPAccess *bool `json:"nodeEnablePublicIpAccess,omitempty"` + + // The edition of a node (default: MemoryOptimized). + NodeServerEdition *string `json:"nodeServerEdition,omitempty"` + + // The storage of a node in MB. + NodeStorageQuotaInMb *int64 `json:"nodeStorageQuotaInMb,omitempty"` + + // The vCores count of a node (max: 64). + NodeVCores *int64 `json:"nodeVCores,omitempty"` + + // The PostgreSQL version of cluster. + PostgresqlVersion *string `json:"postgresqlVersion,omitempty"` + + // Preferred primary zone for the cluster + PreferredPrimaryZone *string `json:"preferredPrimaryZone,omitempty"` + + // The source cluster location to restore from. It's required for 'PointInTimeRestore' or 'ReadReplica' operations + SourceLocation *string `json:"sourceLocation,omitempty"` + + // The source resource id to restore from. It's required for 'PointInTimeRestore' or 'ReadReplica' operations + SourceResourceID *string `json:"sourceResourceId,omitempty"` + + // READ-ONLY; The earliest restore point time (ISO8601 format) for the cluster. + EarliestRestoreTime *time.Time `json:"earliestRestoreTime,omitempty" azure:"ro"` +} + +// ClusterPropertiesForUpdate - The properties used to update a cluster. +type ClusterPropertiesForUpdate struct { + // The password of the administrator login. + AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` + + // The Citus version of the cluster. + CitusVersion *string `json:"citusVersion,omitempty"` + + // If public IP is requested or not for the coordinator. + CoordinatorEnablePublicIPAccess *bool `json:"coordinatorEnablePublicIpAccess,omitempty"` + + // The edition of the coordinator (default: GeneralPurpose). + CoordinatorServerEdition *string `json:"coordinatorServerEdition,omitempty"` + + // The storage of the coordinator in MB. + CoordinatorStorageQuotaInMb *int64 `json:"coordinatorStorageQuotaInMb,omitempty"` + + // The vCores count of the coordinator (max: 64). + CoordinatorVCores *int64 `json:"coordinatorVCores,omitempty"` + + // If high availability is enabled or not for the cluster. + EnableHa *bool `json:"enableHa,omitempty"` + + // If shards on coordinator is enabled or not for the cluster. + EnableShardsOnCoordinator *bool `json:"enableShardsOnCoordinator,omitempty"` + + // Maintenance window of a cluster. + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + + // Worker node count of the cluster + NodeCount *int64 `json:"nodeCount,omitempty"` + + // The edition of a node (default: MemoryOptimized). + NodeServerEdition *string `json:"nodeServerEdition,omitempty"` + + // The storage of a node in MB. + NodeStorageQuotaInMb *int64 `json:"nodeStorageQuotaInMb,omitempty"` + + // The vCores count of a node (max: 64). + NodeVCores *int64 `json:"nodeVCores,omitempty"` + + // The PostgreSQL version of the cluster. + PostgresqlVersion *string `json:"postgresqlVersion,omitempty"` + + // Preferred primary zone for the cluster + PreferredPrimaryZone *string `json:"preferredPrimaryZone,omitempty"` + + // READ-ONLY; If public IP is requested or not for a node. + NodeEnablePublicIPAccess *bool `json:"nodeEnablePublicIpAccess,omitempty" azure:"ro"` +} + +// ClusterResponse - Represents a cluster in response body. +type ClusterResponse struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Properties of the cluster response body. + Properties *ClusterResponseProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ClusterResponseProperties - Properties of the cluster response body. +type ClusterResponseProperties struct { + // The Citus version of cluster. + CitusVersion *string `json:"citusVersion,omitempty"` + + // If public IP is requested or not for a server. + CoordinatorEnablePublicIPAccess *bool `json:"coordinatorEnablePublicIpAccess,omitempty"` + + // The edition of a coordinator server (default: GeneralPurpose). + CoordinatorServerEdition *string `json:"coordinatorServerEdition,omitempty"` + + // The storage of a server in MB. + CoordinatorStorageQuotaInMb *int64 `json:"coordinatorStorageQuotaInMb,omitempty"` + + // The vCores count of a server (max: 64). + CoordinatorVCores *int64 `json:"coordinatorVCores,omitempty"` + + // If high availability is enabled or not for the server. + EnableHa *bool `json:"enableHa,omitempty"` + + // If shards on coordinator is enabled or not for the cluster. + EnableShardsOnCoordinator *bool `json:"enableShardsOnCoordinator,omitempty"` + + // Maintenance window of a cluster. + MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` + + // Worker node count of the cluster + NodeCount *int64 `json:"nodeCount,omitempty"` + + // The edition of a node server (default: MemoryOptimized). + NodeServerEdition *string `json:"nodeServerEdition,omitempty"` + + // The storage of a server in MB. + NodeStorageQuotaInMb *int64 `json:"nodeStorageQuotaInMb,omitempty"` + + // The vCores count of a server (max: 64). + NodeVCores *int64 `json:"nodeVCores,omitempty"` + + // The PostgreSQL version of cluster. + PostgresqlVersion *string `json:"postgresqlVersion,omitempty"` + + // Preferred primary zone for the cluster + PreferredPrimaryZone *string `json:"preferredPrimaryZone,omitempty"` + + // READ-ONLY; The earliest restore point time (ISO8601 format) for the cluster. + EarliestRestoreTime *time.Time `json:"earliestRestoreTime,omitempty" azure:"ro"` + + // READ-ONLY; If public IP is requested or not for a server. + NodeEnablePublicIPAccess *bool `json:"nodeEnablePublicIpAccess,omitempty" azure:"ro"` + + // READ-ONLY; The private endpoint connections for a cluster. + PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the cluster + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The array of read replica clusters. + ReadReplicas []*string `json:"readReplicas,omitempty" azure:"ro"` + + // READ-ONLY; The list of server names in the cluster + ServerNames []*ServerNameItem `json:"serverNames,omitempty" azure:"ro"` + + // READ-ONLY; The location of source cluster for read replica clusters. + SourceLocation *string `json:"sourceLocation,omitempty" azure:"ro"` + + // READ-ONLY; The resource id of source cluster for read replica clusters. + SourceResourceID *string `json:"sourceResourceId,omitempty" azure:"ro"` + + // READ-ONLY; A state of a cluster/server that is visible to user. + State *string `json:"state,omitempty" azure:"ro"` +} + +// ClusterServer - Represents a server in a cluster. +type ClusterServer struct { + // The properties of a server in a cluster. + Properties *ClusterServerProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ClusterServerListResult - A list of servers in a cluster. +type ClusterServerListResult struct { + // The list of servers in a cluster. + Value []*ClusterServer `json:"value,omitempty"` +} + +// ClusterServerProperties - The properties of a server in cluster. +type ClusterServerProperties struct { + // Availability Zone information of the server. + AvailabilityZone *string `json:"availabilityZone,omitempty"` + + // The Citus version of server. + CitusVersion *string `json:"citusVersion,omitempty"` + + // If high availability is enabled or not for the server. + EnableHa *bool `json:"enableHa,omitempty"` + + // The PostgreSQL version of server. + PostgresqlVersion *string `json:"postgresqlVersion,omitempty"` + + // The role of server in the cluster. + Role *ServerRole `json:"role,omitempty"` + + // The edition of a server + ServerEdition *string `json:"serverEdition,omitempty"` + + // The storage of a server in MB. + StorageQuotaInMb *int64 `json:"storageQuotaInMb,omitempty"` + + // The vCores count of a server (max: 64). + VCores *int64 `json:"vCores,omitempty"` + + // READ-ONLY; If public IP is requested or not for a server. + EnablePublicIP *bool `json:"enablePublicIp,omitempty" azure:"ro"` + + // READ-ONLY; The fully qualified domain name of a server. + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty" azure:"ro"` + + // READ-ONLY; A state of HA feature for the cluster. + HaState *string `json:"haState,omitempty" azure:"ro"` + + // READ-ONLY; A state of a cluster/server that is visible to user. + State *string `json:"state,omitempty" azure:"ro"` +} + +// ClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ClustersClient.BeginCreateOrUpdate method. +type ClustersClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. +type ClustersClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginPromoteReadReplicaOptions contains the optional parameters for the ClustersClient.BeginPromoteReadReplica +// method. +type ClustersClientBeginPromoteReadReplicaOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginRestartOptions contains the optional parameters for the ClustersClient.BeginRestart method. +type ClustersClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginStartOptions contains the optional parameters for the ClustersClient.BeginStart method. +type ClustersClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginStopOptions contains the optional parameters for the ClustersClient.BeginStop method. +type ClustersClientBeginStopOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientBeginUpdateOptions contains the optional parameters for the ClustersClient.BeginUpdate method. +type ClustersClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClustersClientCheckNameAvailabilityOptions contains the optional parameters for the ClustersClient.CheckNameAvailability +// method. +type ClustersClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientGetOptions contains the optional parameters for the ClustersClient.Get method. +type ClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListByResourceGroupOptions contains the optional parameters for the ClustersClient.ListByResourceGroup method. +type ClustersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClustersClientListOptions contains the optional parameters for the ClustersClient.List method. +type ClustersClientListOptions struct { + // placeholder for future optional parameters +} + +// Configuration - Represents configuration details for coordinator and node. +type Configuration struct { + // The properties of configuration. + Properties *ConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ConfigurationProperties - The properties of configuration. +type ConfigurationProperties struct { + // REQUIRED; The list of server role group configuration values. + ServerRoleGroupConfigurations []*ServerRoleGroupConfiguration `json:"serverRoleGroupConfigurations,omitempty"` + + // If configuration change requires restart. + RequiresRestart *bool `json:"requiresRestart,omitempty"` + + // READ-ONLY; Allowed values of the configuration. + AllowedValues *string `json:"allowedValues,omitempty" azure:"ro"` + + // READ-ONLY; Data type of the configuration. + DataType *ConfigurationDataType `json:"dataType,omitempty" azure:"ro"` + + // READ-ONLY; Description of the configuration. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// ConfigurationsClientBeginUpdateCoordinatorOptions contains the optional parameters for the ConfigurationsClient.BeginUpdateCoordinator +// method. +type ConfigurationsClientBeginUpdateCoordinatorOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ConfigurationsClientBeginUpdateNodeOptions contains the optional parameters for the ConfigurationsClient.BeginUpdateNode +// method. +type ConfigurationsClientBeginUpdateNodeOptions 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 +} + +// ConfigurationsClientListByClusterOptions contains the optional parameters for the ConfigurationsClient.ListByCluster method. +type ConfigurationsClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.ListByServer method. +type ConfigurationsClientListByServerOptions struct { + // placeholder for future optional parameters +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.). +type ErrorResponse struct { + // The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// FirewallRule - Represents a cluster firewall rule. +type FirewallRule struct { + // REQUIRED; The properties of a firewall rule. + Properties *FirewallRuleProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// FirewallRuleListResult - A list of firewall rules. +type FirewallRuleListResult struct { + // The list of firewall rules in a cluster. + Value []*FirewallRule `json:"value,omitempty"` +} + +// FirewallRuleProperties - The properties of a cluster firewall rule. +type FirewallRuleProperties struct { + // REQUIRED; The end IP address of the cluster firewall rule. Must be IPv4 format. + EndIPAddress *string `json:"endIpAddress,omitempty"` + + // REQUIRED; The start IP address of the cluster firewall rule. Must be IPv4 format. + StartIPAddress *string `json:"startIpAddress,omitempty"` +} + +// 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 +} + +// FirewallRulesClientListByClusterOptions contains the optional parameters for the FirewallRulesClient.ListByCluster method. +type FirewallRulesClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// MaintenanceWindow - Maintenance window of a cluster. +type MaintenanceWindow struct { + // indicates whether custom window is enabled or disabled + CustomWindow *string `json:"customWindow,omitempty"` + + // day of week for maintenance window + DayOfWeek *int32 `json:"dayOfWeek,omitempty"` + + // start hour for maintenance window + StartHour *int32 `json:"startHour,omitempty"` + + // start minute for maintenance window + StartMinute *int32 `json:"startMinute,omitempty"` +} + +// NameAvailability - Represents a resource name availability. +type NameAvailability struct { + // Error Message. + Message *string `json:"message,omitempty"` + + // name of the cluster. + Name *string `json:"name,omitempty"` + + // Indicates whether the resource name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + + // type of the cluster + Type *string `json:"type,omitempty"` +} + +// NameAvailabilityRequest - Request from client to check resource name availability. +type NameAvailabilityRequest struct { + // REQUIRED; Resource name to verify. + Name *string `json:"name,omitempty"` + + // CONSTANT; Resource type used for verification. + // Field has constant value "Microsoft.DBforPostgreSQL/serverGroupsv2", any specified value is ignored. + Type *string `json:"type,omitempty"` +} + +// Operation - REST API operation definition. +type Operation struct { + // Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + + // READ-ONLY; The localized display information for this particular operation or action. + Display *OperationDisplay `json:"display,omitempty" azure:"ro"` + + // READ-ONLY; The name of the operation being performed on this particular object. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The intended executor of the operation. + Origin *OperationOrigin `json:"origin,omitempty" azure:"ro"` + + // READ-ONLY; Additional descriptions for the operation. + Properties map[string]interface{} `json:"properties,omitempty" azure:"ro"` +} + +// OperationDisplay - Display metadata associated with the operation. +type OperationDisplay struct { + // READ-ONLY; Operation description. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Localized friendly name for the operation. + Operation *string `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; Operation resource provider name. + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; Resource on which the operation is performed. + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// OperationListResult - A list of resource provider operations. +type OperationListResult struct { + // Collection of available operation details + Value []*Operation `json:"value,omitempty"` + + // READ-ONLY; URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnection - A private endpoint connection +type PrivateEndpointConnection struct { + // Properties of the private endpoint connection. + Properties *PrivateEndpointConnectionSimpleProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionActionRequest - A private endpoint connection +type PrivateEndpointConnectionActionRequest struct { + // Properties of the private endpoint connection. + Properties *PrivateEndpointConnectionActionRequestProperties `json:"properties,omitempty"` +} + +// PrivateEndpointConnectionActionRequestProperties - The properties used to create a private endpoint connection +type PrivateEndpointConnectionActionRequestProperties struct { + // Private endpoint which the connection belongs to. + ID *string `json:"id,omitempty"` + + // Connection state of the private endpoint connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// PrivateEndpointConnectionListResult - A list of private endpoint connections. +type PrivateEndpointConnectionListResult struct { + // The list of private endpoint connections + Value []*PrivateEndpointConnectionProperty `json:"value,omitempty"` + + // READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionProperties - The properties in private endpoint connection +type PrivateEndpointConnectionProperties struct { + // Group ids of the private endpoint connection. + GroupIDs []*string `json:"groupIds,omitempty"` + + // Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + + // Connection state of the private endpoint connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` + + // State of the private endpoint connection. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// PrivateEndpointConnectionProperty - A private endpoint connection property +type PrivateEndpointConnectionProperty struct { + // Properties of the private endpoint connection. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionSimpleProperties - The properties in private endpoint connection +type PrivateEndpointConnectionSimpleProperties struct { + // Group ids of the private endpoint connection. + GroupIDs []*string `json:"groupIds,omitempty"` + + // Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + + // Connection state of the private endpoint connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.CreateOrUpdate +// method. +type PrivateEndpointConnectionsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListByClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByCluster +// method. +type PrivateEndpointConnectionsClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointProperty - Property to represent resource id of the private endpoint. +type PrivateEndpointProperty struct { + // Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + +// PrivateLinkResource - A private link resource +type PrivateLinkResource struct { + // Properties of the private link resource. + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateLinkResourceListResult - A list of private link resources. +type PrivateLinkResourceListResult struct { + // The list of private link resources. + Value []*PrivateLinkResource `json:"value,omitempty"` + + // READ-ONLY; The link used to get the next page of private link resources. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource group id. + GroupID *string `json:"groupId,omitempty"` + + // The private link resource required member names. + RequiredMembers []*string `json:"requiredMembers,omitempty"` + + // The private link resource zone names. + RequiredZoneNames []*string `json:"requiredZoneNames,omitempty"` +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByClusterOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByCluster +// method. +type PrivateLinkResourcesClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkServiceConnectionState - The private link service connection state +type PrivateLinkServiceConnectionState struct { + // The private link service connection description. + Description *string `json:"description,omitempty"` + + // The private link service connection status. + Status *string `json:"status,omitempty"` +} + +// PrivateLinkServiceConnectionStateProperty - The properties in private link service connection state +type PrivateLinkServiceConnectionStateProperty struct { + // The actions required for private link service connection. + ActionsRequired *string `json:"actionsRequired,omitempty"` + + // The private link service connection description. + Description *string `json:"description,omitempty"` + + // The private link service connection status. + Status *string `json:"status,omitempty"` +} + +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// 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. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// Role - Represents a cluster role. +type Role struct { + // The properties of a role. + Properties *RoleProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RoleListResult - A list of roles. +type RoleListResult struct { + // The list of roles in a cluster. + Value []*Role `json:"value,omitempty"` +} + +// RoleProperties - The properties of a cluster role. +type RoleProperties struct { + // REQUIRED; The password of the cluster role. + Password *string `json:"password,omitempty"` +} + +// RolesClientBeginCreateOptions contains the optional parameters for the RolesClient.BeginCreate method. +type RolesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RolesClientBeginDeleteOptions contains the optional parameters for the RolesClient.BeginDelete method. +type RolesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// RolesClientListByClusterOptions contains the optional parameters for the RolesClient.ListByCluster method. +type RolesClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// ServerConfiguration - Represents a configuration. +type ServerConfiguration struct { + // The properties of a configuration. + Properties *ServerConfigurationProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ServerConfigurationListResult - A list of server configurations. +type ServerConfigurationListResult struct { + // The list of server configurations. + Value []*ServerConfiguration `json:"value,omitempty"` + + // READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// ServerConfigurationProperties - The properties of a configuration. +type ServerConfigurationProperties struct { + // REQUIRED; Value of the configuration. + Value *string `json:"value,omitempty"` + + // If configuration change requires restart. + RequiresRestart *bool `json:"requiresRestart,omitempty"` + + // READ-ONLY; Allowed values of the configuration. + AllowedValues *string `json:"allowedValues,omitempty" azure:"ro"` + + // READ-ONLY; Data type of the configuration. + DataType *ConfigurationDataType `json:"dataType,omitempty" azure:"ro"` + + // READ-ONLY; Default value of the configuration. + DefaultValue *string `json:"defaultValue,omitempty" azure:"ro"` + + // READ-ONLY; Description of the configuration. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Source of the configuration. + Source *string `json:"source,omitempty" azure:"ro"` +} + +// ServerConfigurationRequest - Represents a configuration. +type ServerConfigurationRequest struct { + // Represents a configuration properties + Properties *ServerConfigurationRequestProperties `json:"properties,omitempty"` +} + +// ServerConfigurationRequestProperties - Represents a configuration properties +type ServerConfigurationRequestProperties struct { + // Represents the value of a configuration. + Value *string `json:"value,omitempty"` +} + +// ServerNameItem - The name object for a server. +type ServerNameItem struct { + // The name of a server. + Name *string `json:"name,omitempty"` + + // READ-ONLY; The fully qualified domain name of a server. + FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty" azure:"ro"` +} + +// ServerProperties - The properties of a server. +type ServerProperties struct { + // If high availability is enabled or not for the server. + EnableHa *bool `json:"enableHa,omitempty"` + + // The edition of a server + ServerEdition *string `json:"serverEdition,omitempty"` + + // The storage of a server in MB. + StorageQuotaInMb *int64 `json:"storageQuotaInMb,omitempty"` + + // The vCores count of a server (max: 64). + VCores *int64 `json:"vCores,omitempty"` + + // READ-ONLY; If public IP is requested or not for a server. + EnablePublicIP *bool `json:"enablePublicIp,omitempty" azure:"ro"` +} + +// ServerRoleGroupConfiguration - Represents server role group configuration value. +type ServerRoleGroupConfiguration struct { + // REQUIRED; The role of servers in the server role group. + Role *ServerRole `json:"role,omitempty"` + + // REQUIRED; Value of the configuration. + Value *string `json:"value,omitempty"` + + // READ-ONLY; Default value of the configuration. + DefaultValue *string `json:"defaultValue,omitempty" azure:"ro"` + + // READ-ONLY; Source of the configuration. + Source *string `json:"source,omitempty" azure:"ro"` +} + +// ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. +type ServersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServersClientListByClusterOptions contains the optional parameters for the ServersClient.ListByCluster method. +type ServersClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' +type TrackedResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty" azure:"ro"` +} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/models_serde.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/models_serde.go new file mode 100644 index 000000000000..d65174f09026 --- /dev/null +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/models_serde.go @@ -0,0 +1,2196 @@ +//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 armpostgresqlhsc + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Cluster. +func (c Cluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Cluster. +func (c *Cluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterConfigurationListResult. +func (c ClusterConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterConfigurationListResult. +func (c *ClusterConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterForUpdate. +func (c ClusterForUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterForUpdate. +func (c *ClusterForUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterListResult. +func (c ClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterListResult. +func (c *ClusterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterProperties. +func (c ClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "administratorLoginPassword", c.AdministratorLoginPassword) + populate(objectMap, "citusVersion", c.CitusVersion) + populate(objectMap, "coordinatorEnablePublicIpAccess", c.CoordinatorEnablePublicIPAccess) + populate(objectMap, "coordinatorServerEdition", c.CoordinatorServerEdition) + populate(objectMap, "coordinatorStorageQuotaInMb", c.CoordinatorStorageQuotaInMb) + populate(objectMap, "coordinatorVCores", c.CoordinatorVCores) + populateTimeRFC3339(objectMap, "earliestRestoreTime", c.EarliestRestoreTime) + populate(objectMap, "enableHa", c.EnableHa) + populate(objectMap, "enableShardsOnCoordinator", c.EnableShardsOnCoordinator) + populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) + populate(objectMap, "nodeCount", c.NodeCount) + populate(objectMap, "nodeEnablePublicIpAccess", c.NodeEnablePublicIPAccess) + populate(objectMap, "nodeServerEdition", c.NodeServerEdition) + populate(objectMap, "nodeStorageQuotaInMb", c.NodeStorageQuotaInMb) + populate(objectMap, "nodeVCores", c.NodeVCores) + populate(objectMap, "postgresqlVersion", c.PostgresqlVersion) + populate(objectMap, "preferredPrimaryZone", c.PreferredPrimaryZone) + populate(objectMap, "sourceLocation", c.SourceLocation) + populate(objectMap, "sourceResourceId", c.SourceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterProperties. +func (c *ClusterProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "administratorLoginPassword": + err = unpopulate(val, "AdministratorLoginPassword", &c.AdministratorLoginPassword) + delete(rawMsg, key) + case "citusVersion": + err = unpopulate(val, "CitusVersion", &c.CitusVersion) + delete(rawMsg, key) + case "coordinatorEnablePublicIpAccess": + err = unpopulate(val, "CoordinatorEnablePublicIPAccess", &c.CoordinatorEnablePublicIPAccess) + delete(rawMsg, key) + case "coordinatorServerEdition": + err = unpopulate(val, "CoordinatorServerEdition", &c.CoordinatorServerEdition) + delete(rawMsg, key) + case "coordinatorStorageQuotaInMb": + err = unpopulate(val, "CoordinatorStorageQuotaInMb", &c.CoordinatorStorageQuotaInMb) + delete(rawMsg, key) + case "coordinatorVCores": + err = unpopulate(val, "CoordinatorVCores", &c.CoordinatorVCores) + delete(rawMsg, key) + case "earliestRestoreTime": + err = unpopulateTimeRFC3339(val, "EarliestRestoreTime", &c.EarliestRestoreTime) + delete(rawMsg, key) + case "enableHa": + err = unpopulate(val, "EnableHa", &c.EnableHa) + delete(rawMsg, key) + case "enableShardsOnCoordinator": + err = unpopulate(val, "EnableShardsOnCoordinator", &c.EnableShardsOnCoordinator) + delete(rawMsg, key) + case "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &c.NodeCount) + delete(rawMsg, key) + case "nodeEnablePublicIpAccess": + err = unpopulate(val, "NodeEnablePublicIPAccess", &c.NodeEnablePublicIPAccess) + delete(rawMsg, key) + case "nodeServerEdition": + err = unpopulate(val, "NodeServerEdition", &c.NodeServerEdition) + delete(rawMsg, key) + case "nodeStorageQuotaInMb": + err = unpopulate(val, "NodeStorageQuotaInMb", &c.NodeStorageQuotaInMb) + delete(rawMsg, key) + case "nodeVCores": + err = unpopulate(val, "NodeVCores", &c.NodeVCores) + delete(rawMsg, key) + case "postgresqlVersion": + err = unpopulate(val, "PostgresqlVersion", &c.PostgresqlVersion) + delete(rawMsg, key) + case "preferredPrimaryZone": + err = unpopulate(val, "PreferredPrimaryZone", &c.PreferredPrimaryZone) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &c.SourceLocation) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &c.SourceResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPropertiesForUpdate. +func (c ClusterPropertiesForUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "administratorLoginPassword", c.AdministratorLoginPassword) + populate(objectMap, "citusVersion", c.CitusVersion) + populate(objectMap, "coordinatorEnablePublicIpAccess", c.CoordinatorEnablePublicIPAccess) + populate(objectMap, "coordinatorServerEdition", c.CoordinatorServerEdition) + populate(objectMap, "coordinatorStorageQuotaInMb", c.CoordinatorStorageQuotaInMb) + populate(objectMap, "coordinatorVCores", c.CoordinatorVCores) + populate(objectMap, "enableHa", c.EnableHa) + populate(objectMap, "enableShardsOnCoordinator", c.EnableShardsOnCoordinator) + populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) + populate(objectMap, "nodeCount", c.NodeCount) + populate(objectMap, "nodeEnablePublicIpAccess", c.NodeEnablePublicIPAccess) + populate(objectMap, "nodeServerEdition", c.NodeServerEdition) + populate(objectMap, "nodeStorageQuotaInMb", c.NodeStorageQuotaInMb) + populate(objectMap, "nodeVCores", c.NodeVCores) + populate(objectMap, "postgresqlVersion", c.PostgresqlVersion) + populate(objectMap, "preferredPrimaryZone", c.PreferredPrimaryZone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPropertiesForUpdate. +func (c *ClusterPropertiesForUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "administratorLoginPassword": + err = unpopulate(val, "AdministratorLoginPassword", &c.AdministratorLoginPassword) + delete(rawMsg, key) + case "citusVersion": + err = unpopulate(val, "CitusVersion", &c.CitusVersion) + delete(rawMsg, key) + case "coordinatorEnablePublicIpAccess": + err = unpopulate(val, "CoordinatorEnablePublicIPAccess", &c.CoordinatorEnablePublicIPAccess) + delete(rawMsg, key) + case "coordinatorServerEdition": + err = unpopulate(val, "CoordinatorServerEdition", &c.CoordinatorServerEdition) + delete(rawMsg, key) + case "coordinatorStorageQuotaInMb": + err = unpopulate(val, "CoordinatorStorageQuotaInMb", &c.CoordinatorStorageQuotaInMb) + delete(rawMsg, key) + case "coordinatorVCores": + err = unpopulate(val, "CoordinatorVCores", &c.CoordinatorVCores) + delete(rawMsg, key) + case "enableHa": + err = unpopulate(val, "EnableHa", &c.EnableHa) + delete(rawMsg, key) + case "enableShardsOnCoordinator": + err = unpopulate(val, "EnableShardsOnCoordinator", &c.EnableShardsOnCoordinator) + delete(rawMsg, key) + case "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &c.NodeCount) + delete(rawMsg, key) + case "nodeEnablePublicIpAccess": + err = unpopulate(val, "NodeEnablePublicIPAccess", &c.NodeEnablePublicIPAccess) + delete(rawMsg, key) + case "nodeServerEdition": + err = unpopulate(val, "NodeServerEdition", &c.NodeServerEdition) + delete(rawMsg, key) + case "nodeStorageQuotaInMb": + err = unpopulate(val, "NodeStorageQuotaInMb", &c.NodeStorageQuotaInMb) + delete(rawMsg, key) + case "nodeVCores": + err = unpopulate(val, "NodeVCores", &c.NodeVCores) + delete(rawMsg, key) + case "postgresqlVersion": + err = unpopulate(val, "PostgresqlVersion", &c.PostgresqlVersion) + delete(rawMsg, key) + case "preferredPrimaryZone": + err = unpopulate(val, "PreferredPrimaryZone", &c.PreferredPrimaryZone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterResponse. +func (c ClusterResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResponse. +func (c *ClusterResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterResponseProperties. +func (c ClusterResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "citusVersion", c.CitusVersion) + populate(objectMap, "coordinatorEnablePublicIpAccess", c.CoordinatorEnablePublicIPAccess) + populate(objectMap, "coordinatorServerEdition", c.CoordinatorServerEdition) + populate(objectMap, "coordinatorStorageQuotaInMb", c.CoordinatorStorageQuotaInMb) + populate(objectMap, "coordinatorVCores", c.CoordinatorVCores) + populateTimeRFC3339(objectMap, "earliestRestoreTime", c.EarliestRestoreTime) + populate(objectMap, "enableHa", c.EnableHa) + populate(objectMap, "enableShardsOnCoordinator", c.EnableShardsOnCoordinator) + populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) + populate(objectMap, "nodeCount", c.NodeCount) + populate(objectMap, "nodeEnablePublicIpAccess", c.NodeEnablePublicIPAccess) + populate(objectMap, "nodeServerEdition", c.NodeServerEdition) + populate(objectMap, "nodeStorageQuotaInMb", c.NodeStorageQuotaInMb) + populate(objectMap, "nodeVCores", c.NodeVCores) + populate(objectMap, "postgresqlVersion", c.PostgresqlVersion) + populate(objectMap, "preferredPrimaryZone", c.PreferredPrimaryZone) + populate(objectMap, "privateEndpointConnections", c.PrivateEndpointConnections) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "readReplicas", c.ReadReplicas) + populate(objectMap, "serverNames", c.ServerNames) + populate(objectMap, "sourceLocation", c.SourceLocation) + populate(objectMap, "sourceResourceId", c.SourceResourceID) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterResponseProperties. +func (c *ClusterResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "citusVersion": + err = unpopulate(val, "CitusVersion", &c.CitusVersion) + delete(rawMsg, key) + case "coordinatorEnablePublicIpAccess": + err = unpopulate(val, "CoordinatorEnablePublicIPAccess", &c.CoordinatorEnablePublicIPAccess) + delete(rawMsg, key) + case "coordinatorServerEdition": + err = unpopulate(val, "CoordinatorServerEdition", &c.CoordinatorServerEdition) + delete(rawMsg, key) + case "coordinatorStorageQuotaInMb": + err = unpopulate(val, "CoordinatorStorageQuotaInMb", &c.CoordinatorStorageQuotaInMb) + delete(rawMsg, key) + case "coordinatorVCores": + err = unpopulate(val, "CoordinatorVCores", &c.CoordinatorVCores) + delete(rawMsg, key) + case "earliestRestoreTime": + err = unpopulateTimeRFC3339(val, "EarliestRestoreTime", &c.EarliestRestoreTime) + delete(rawMsg, key) + case "enableHa": + err = unpopulate(val, "EnableHa", &c.EnableHa) + delete(rawMsg, key) + case "enableShardsOnCoordinator": + err = unpopulate(val, "EnableShardsOnCoordinator", &c.EnableShardsOnCoordinator) + delete(rawMsg, key) + case "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &c.NodeCount) + delete(rawMsg, key) + case "nodeEnablePublicIpAccess": + err = unpopulate(val, "NodeEnablePublicIPAccess", &c.NodeEnablePublicIPAccess) + delete(rawMsg, key) + case "nodeServerEdition": + err = unpopulate(val, "NodeServerEdition", &c.NodeServerEdition) + delete(rawMsg, key) + case "nodeStorageQuotaInMb": + err = unpopulate(val, "NodeStorageQuotaInMb", &c.NodeStorageQuotaInMb) + delete(rawMsg, key) + case "nodeVCores": + err = unpopulate(val, "NodeVCores", &c.NodeVCores) + delete(rawMsg, key) + case "postgresqlVersion": + err = unpopulate(val, "PostgresqlVersion", &c.PostgresqlVersion) + delete(rawMsg, key) + case "preferredPrimaryZone": + err = unpopulate(val, "PreferredPrimaryZone", &c.PreferredPrimaryZone) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &c.PrivateEndpointConnections) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "readReplicas": + err = unpopulate(val, "ReadReplicas", &c.ReadReplicas) + delete(rawMsg, key) + case "serverNames": + err = unpopulate(val, "ServerNames", &c.ServerNames) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &c.SourceLocation) + delete(rawMsg, key) + case "sourceResourceId": + err = unpopulate(val, "SourceResourceID", &c.SourceResourceID) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterServer. +func (c ClusterServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServer. +func (c *ClusterServer) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterServerListResult. +func (c ClusterServerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServerListResult. +func (c *ClusterServerListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterServerProperties. +func (c ClusterServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityZone", c.AvailabilityZone) + populate(objectMap, "citusVersion", c.CitusVersion) + populate(objectMap, "enableHa", c.EnableHa) + populate(objectMap, "enablePublicIp", c.EnablePublicIP) + populate(objectMap, "fullyQualifiedDomainName", c.FullyQualifiedDomainName) + populate(objectMap, "haState", c.HaState) + populate(objectMap, "postgresqlVersion", c.PostgresqlVersion) + populate(objectMap, "role", c.Role) + populate(objectMap, "serverEdition", c.ServerEdition) + populate(objectMap, "state", c.State) + populate(objectMap, "storageQuotaInMb", c.StorageQuotaInMb) + populate(objectMap, "vCores", c.VCores) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterServerProperties. +func (c *ClusterServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "availabilityZone": + err = unpopulate(val, "AvailabilityZone", &c.AvailabilityZone) + delete(rawMsg, key) + case "citusVersion": + err = unpopulate(val, "CitusVersion", &c.CitusVersion) + delete(rawMsg, key) + case "enableHa": + err = unpopulate(val, "EnableHa", &c.EnableHa) + delete(rawMsg, key) + case "enablePublicIp": + err = unpopulate(val, "EnablePublicIP", &c.EnablePublicIP) + delete(rawMsg, key) + case "fullyQualifiedDomainName": + err = unpopulate(val, "FullyQualifiedDomainName", &c.FullyQualifiedDomainName) + delete(rawMsg, key) + case "haState": + err = unpopulate(val, "HaState", &c.HaState) + delete(rawMsg, key) + case "postgresqlVersion": + err = unpopulate(val, "PostgresqlVersion", &c.PostgresqlVersion) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &c.Role) + delete(rawMsg, key) + case "serverEdition": + err = unpopulate(val, "ServerEdition", &c.ServerEdition) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + case "storageQuotaInMb": + err = unpopulate(val, "StorageQuotaInMb", &c.StorageQuotaInMb) + delete(rawMsg, key) + case "vCores": + err = unpopulate(val, "VCores", &c.VCores) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Configuration. +func (c Configuration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Configuration. +func (c *Configuration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConfigurationProperties. +func (c ConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedValues", c.AllowedValues) + populate(objectMap, "dataType", c.DataType) + populate(objectMap, "description", c.Description) + populate(objectMap, "requiresRestart", c.RequiresRestart) + populate(objectMap, "serverRoleGroupConfigurations", c.ServerRoleGroupConfigurations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationProperties. +func (c *ConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedValues": + err = unpopulate(val, "AllowedValues", &c.AllowedValues) + delete(rawMsg, key) + case "dataType": + err = unpopulate(val, "DataType", &c.DataType) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "requiresRestart": + err = unpopulate(val, "RequiresRestart", &c.RequiresRestart) + delete(rawMsg, key) + case "serverRoleGroupConfigurations": + err = unpopulate(val, "ServerRoleGroupConfigurations", &c.ServerRoleGroupConfigurations) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRule. +func (f FirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRule. +func (f *FirewallRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleListResult. +func (f FirewallRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleListResult. +func (f *FirewallRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleProperties. +func (f FirewallRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "endIpAddress", f.EndIPAddress) + populate(objectMap, "startIpAddress", f.StartIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleProperties. +func (f *FirewallRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endIpAddress": + err = unpopulate(val, "EndIPAddress", &f.EndIPAddress) + delete(rawMsg, key) + case "startIpAddress": + err = unpopulate(val, "StartIPAddress", &f.StartIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MaintenanceWindow. +func (m MaintenanceWindow) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customWindow", m.CustomWindow) + populate(objectMap, "dayOfWeek", m.DayOfWeek) + populate(objectMap, "startHour", m.StartHour) + populate(objectMap, "startMinute", m.StartMinute) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MaintenanceWindow. +func (m *MaintenanceWindow) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customWindow": + err = unpopulate(val, "CustomWindow", &m.CustomWindow) + delete(rawMsg, key) + case "dayOfWeek": + err = unpopulate(val, "DayOfWeek", &m.DayOfWeek) + delete(rawMsg, key) + case "startHour": + err = unpopulate(val, "StartHour", &m.StartHour) + delete(rawMsg, key) + case "startMinute": + err = unpopulate(val, "StartMinute", &m.StartMinute) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NameAvailability. +func (n NameAvailability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "message", n.Message) + populate(objectMap, "name", n.Name) + populate(objectMap, "nameAvailable", n.NameAvailable) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailability. +func (n *NameAvailability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "message": + err = unpopulate(val, "Message", &n.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "nameAvailable": + err = unpopulate(val, "NameAvailable", &n.NameAvailable) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NameAvailabilityRequest. +func (n NameAvailabilityRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", n.Name) + objectMap["type"] = "Microsoft.DBforPostgreSQL/serverGroupsv2" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NameAvailabilityRequest. +func (n *NameAvailabilityRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &n.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + populate(objectMap, "properties", o.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionActionRequest. +func (p PrivateEndpointConnectionActionRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", p.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionActionRequest. +func (p *PrivateEndpointConnectionActionRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionActionRequestProperties. +func (p PrivateEndpointConnectionActionRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionActionRequestProperties. +func (p *PrivateEndpointConnectionActionRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperty. +func (p PrivateEndpointConnectionProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperty. +func (p *PrivateEndpointConnectionProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionSimpleProperties. +func (p PrivateEndpointConnectionSimpleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionSimpleProperties. +func (p *PrivateEndpointConnectionSimpleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointProperty. +func (p PrivateEndpointProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointProperty. +func (p *PrivateEndpointProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionStateProperty. +func (p *PrivateLinkServiceConnectionStateProperty) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Role. +func (r Role) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Role. +func (r *Role) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleListResult. +func (r RoleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleListResult. +func (r *RoleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RoleProperties. +func (r RoleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "password", r.Password) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RoleProperties. +func (r *RoleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "password": + err = unpopulate(val, "Password", &r.Password) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerConfiguration. +func (s ServerConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfiguration. +func (s *ServerConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerConfigurationListResult. +func (s ServerConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfigurationListResult. +func (s *ServerConfigurationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerConfigurationProperties. +func (s ServerConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedValues", s.AllowedValues) + populate(objectMap, "dataType", s.DataType) + populate(objectMap, "defaultValue", s.DefaultValue) + populate(objectMap, "description", s.Description) + populate(objectMap, "requiresRestart", s.RequiresRestart) + populate(objectMap, "source", s.Source) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfigurationProperties. +func (s *ServerConfigurationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedValues": + err = unpopulate(val, "AllowedValues", &s.AllowedValues) + delete(rawMsg, key) + case "dataType": + err = unpopulate(val, "DataType", &s.DataType) + delete(rawMsg, key) + case "defaultValue": + err = unpopulate(val, "DefaultValue", &s.DefaultValue) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "requiresRestart": + err = unpopulate(val, "RequiresRestart", &s.RequiresRestart) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &s.Source) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerConfigurationRequest. +func (s ServerConfigurationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", s.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfigurationRequest. +func (s *ServerConfigurationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerConfigurationRequestProperties. +func (s ServerConfigurationRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerConfigurationRequestProperties. +func (s *ServerConfigurationRequestProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerNameItem. +func (s ServerNameItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerNameItem. +func (s *ServerNameItem) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fullyQualifiedDomainName": + err = unpopulate(val, "FullyQualifiedDomainName", &s.FullyQualifiedDomainName) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerProperties. +func (s ServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enableHa", s.EnableHa) + populate(objectMap, "enablePublicIp", s.EnablePublicIP) + populate(objectMap, "serverEdition", s.ServerEdition) + populate(objectMap, "storageQuotaInMb", s.StorageQuotaInMb) + populate(objectMap, "vCores", s.VCores) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerProperties. +func (s *ServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enableHa": + err = unpopulate(val, "EnableHa", &s.EnableHa) + delete(rawMsg, key) + case "enablePublicIp": + err = unpopulate(val, "EnablePublicIP", &s.EnablePublicIP) + delete(rawMsg, key) + case "serverEdition": + err = unpopulate(val, "ServerEdition", &s.ServerEdition) + delete(rawMsg, key) + case "storageQuotaInMb": + err = unpopulate(val, "StorageQuotaInMb", &s.StorageQuotaInMb) + delete(rawMsg, key) + case "vCores": + err = unpopulate(val, "VCores", &s.VCores) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServerRoleGroupConfiguration. +func (s ServerRoleGroupConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "defaultValue", s.DefaultValue) + populate(objectMap, "role", s.Role) + populate(objectMap, "source", s.Source) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerRoleGroupConfiguration. +func (s *ServerRoleGroupConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultValue": + err = unpopulate(val, "DefaultValue", &s.DefaultValue) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &s.Role) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &s.Source) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_operations_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/operations_client.go similarity index 93% rename from sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_operations_client.go rename to sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/operations_client.go index 25281a8aa8e5..582b5fa6b8f3 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_operations_client.go +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/operations_client.go @@ -5,6 +5,7 @@ // 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 armpostgresqlhsc @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// Generated from API version 2022-11-08 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -76,13 +76,13 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption // listCreateRequest creates the List request. func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.DBForPostgreSql/operations" + urlPath := "/providers/Microsoft.DBforPostgreSQL/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/privateendpointconnections_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/privateendpointconnections_client.go new file mode 100644 index 000000000000..dfca6a311594 --- /dev/null +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/privateendpointconnections_client.go @@ -0,0 +1,308 @@ +//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 armpostgresqlhsc + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// subscriptionID - The ID of the target subscription. The value must be an UUID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Approve or reject a private endpoint connection with a given name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// privateEndpointConnectionName - The name of the private endpoint connection. +// parameters - The required parameters for approving a private endpoint connection. +// options - PrivateEndpointConnectionsClientCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.CreateOrUpdate +// method. +func (client *PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionActionRequest, options *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, parameters, options) + if err != nil { + return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, parameters PrivateEndpointConnectionActionRequest, options *PrivateEndpointConnectionsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientCreateOrUpdateResponse, error) { + result := PrivateEndpointConnectionsClientCreateOrUpdateResponse{} + if val := resp.Header.Get("location"); val != "" { + result.Location = &val + } + if val := resp.Header.Get("azure-async-operation"); val != "" { + result.AzureAsyncOperation = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProperty); err != nil { + return PrivateEndpointConnectionsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// BeginDelete - Deletes a private endpoint connection with a given name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// privateEndpointConnectionName - The name of the private endpoint connection. +// options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.pl, nil) + } +} + +// Delete - Deletes a private endpoint connection with a given name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// privateEndpointConnectionName - The name of the private endpoint connection. +// options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProperty); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - Gets list of private endpoint connections on a cluster. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - PrivateEndpointConnectionsClientListByClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByCluster +// method. +func (client *PrivateEndpointConnectionsClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *PrivateEndpointConnectionsClientListByClusterOptions) *runtime.Pager[PrivateEndpointConnectionsClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListByClusterResponse]{ + More: func(page PrivateEndpointConnectionsClientListByClusterResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListByClusterResponse) (PrivateEndpointConnectionsClientListByClusterResponse, error) { + req, err := client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return PrivateEndpointConnectionsClientListByClusterResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionsClientListByClusterResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionsClientListByClusterResponse{}, runtime.NewResponseError(resp) + } + return client.listByClusterHandleResponse(resp) + }, + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *PrivateEndpointConnectionsClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateEndpointConnectionsClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateEndpointConnections" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *PrivateEndpointConnectionsClient) listByClusterHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByClusterResponse, error) { + result := PrivateEndpointConnectionsClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListByClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/privatelinkresources_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/privatelinkresources_client.go new file mode 100644 index 000000000000..17973f74dcbc --- /dev/null +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/privatelinkresources_client.go @@ -0,0 +1,175 @@ +//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 armpostgresqlhsc + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. +// subscriptionID - The ID of the target subscription. The value must be an UUID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Gets a private link resource for cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// privateLinkResourceName - The name of the private link resource. +// options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get +// method. +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, privateLinkResourceName, options) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateLinkResources/{privateLinkResourceName}" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if privateLinkResourceName == "" { + return nil, errors.New("parameter privateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkResourceName}", url.PathEscape(privateLinkResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { + result := PrivateLinkResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListByClusterPager - Gets the private link resources for cluster. +// Generated from API version 2022-11-08 +// resourceGroupName - The name of the resource group. The name is case insensitive. +// clusterName - The name of the cluster. +// options - PrivateLinkResourcesClientListByClusterOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByCluster +// method. +func (client *PrivateLinkResourcesClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *PrivateLinkResourcesClientListByClusterOptions) *runtime.Pager[PrivateLinkResourcesClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListByClusterResponse]{ + More: func(page PrivateLinkResourcesClientListByClusterResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListByClusterResponse) (PrivateLinkResourcesClientListByClusterResponse, error) { + req, err := client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return PrivateLinkResourcesClientListByClusterResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourcesClientListByClusterResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourcesClientListByClusterResponse{}, runtime.NewResponseError(resp) + } + return client.listByClusterHandleResponse(resp) + }, + }) +} + +// listByClusterCreateRequest creates the ListByCluster request. +func (client *PrivateLinkResourcesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *PrivateLinkResourcesClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/privateLinkResources" + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-11-08") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByClusterHandleResponse handles the ListByCluster response. +func (client *PrivateLinkResourcesClient) listByClusterHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByClusterResponse, error) { + result := PrivateLinkResourcesClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesClientListByClusterResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/response_types.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/response_types.go new file mode 100644 index 000000000000..69bab77e187a --- /dev/null +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/response_types.go @@ -0,0 +1,175 @@ +//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 armpostgresqlhsc + +// ClustersClientCheckNameAvailabilityResponse contains the response from method ClustersClient.CheckNameAvailability. +type ClustersClientCheckNameAvailabilityResponse struct { + NameAvailability +} + +// ClustersClientCreateOrUpdateResponse contains the response from method ClustersClient.CreateOrUpdate. +type ClustersClientCreateOrUpdateResponse struct { + ClusterResponse +} + +// ClustersClientDeleteResponse contains the response from method ClustersClient.Delete. +type ClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// ClustersClientGetResponse contains the response from method ClustersClient.Get. +type ClustersClientGetResponse struct { + ClusterResponse +} + +// ClustersClientListByResourceGroupResponse contains the response from method ClustersClient.ListByResourceGroup. +type ClustersClientListByResourceGroupResponse struct { + ClusterListResult +} + +// ClustersClientListResponse contains the response from method ClustersClient.List. +type ClustersClientListResponse struct { + ClusterListResult +} + +// ClustersClientPromoteReadReplicaResponse contains the response from method ClustersClient.PromoteReadReplica. +type ClustersClientPromoteReadReplicaResponse struct { + // placeholder for future response values +} + +// ClustersClientRestartResponse contains the response from method ClustersClient.Restart. +type ClustersClientRestartResponse struct { + // placeholder for future response values +} + +// ClustersClientStartResponse contains the response from method ClustersClient.Start. +type ClustersClientStartResponse struct { + // placeholder for future response values +} + +// ClustersClientStopResponse contains the response from method ClustersClient.Stop. +type ClustersClientStopResponse struct { + // placeholder for future response values +} + +// ClustersClientUpdateResponse contains the response from method ClustersClient.Update. +type ClustersClientUpdateResponse struct { + ClusterResponse +} + +// ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. +type ConfigurationsClientGetResponse struct { + Configuration +} + +// ConfigurationsClientListByClusterResponse contains the response from method ConfigurationsClient.ListByCluster. +type ConfigurationsClientListByClusterResponse struct { + ClusterConfigurationListResult +} + +// ConfigurationsClientListByServerResponse contains the response from method ConfigurationsClient.ListByServer. +type ConfigurationsClientListByServerResponse struct { + ServerConfigurationListResult +} + +// ConfigurationsClientUpdateCoordinatorResponse contains the response from method ConfigurationsClient.UpdateCoordinator. +type ConfigurationsClientUpdateCoordinatorResponse struct { + ServerConfiguration +} + +// ConfigurationsClientUpdateNodeResponse contains the response from method ConfigurationsClient.UpdateNode. +type ConfigurationsClientUpdateNodeResponse struct { + ServerConfiguration +} + +// FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.CreateOrUpdate. +type FirewallRulesClientCreateOrUpdateResponse struct { + FirewallRule +} + +// FirewallRulesClientDeleteResponse contains the response from method FirewallRulesClient.Delete. +type FirewallRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. +type FirewallRulesClientGetResponse struct { + FirewallRule +} + +// FirewallRulesClientListByClusterResponse contains the response from method FirewallRulesClient.ListByCluster. +type FirewallRulesClientListByClusterResponse struct { + FirewallRuleListResult +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + OperationListResult +} + +// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.CreateOrUpdate. +type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + PrivateEndpointConnectionProperty + // AzureAsyncOperation contains the information returned from the azure-async-operation header response. + AzureAsyncOperation *string + + // Location contains the information returned from the location header response. + Location *string +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + PrivateEndpointConnectionProperty +} + +// PrivateEndpointConnectionsClientListByClusterResponse contains the response from method PrivateEndpointConnectionsClient.ListByCluster. +type PrivateEndpointConnectionsClientListByClusterResponse struct { + PrivateEndpointConnectionListResult +} + +// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. +type PrivateLinkResourcesClientGetResponse struct { + PrivateLinkResource +} + +// PrivateLinkResourcesClientListByClusterResponse contains the response from method PrivateLinkResourcesClient.ListByCluster. +type PrivateLinkResourcesClientListByClusterResponse struct { + PrivateLinkResourceListResult +} + +// RolesClientCreateResponse contains the response from method RolesClient.Create. +type RolesClientCreateResponse struct { + Role +} + +// RolesClientDeleteResponse contains the response from method RolesClient.Delete. +type RolesClientDeleteResponse struct { + // placeholder for future response values +} + +// RolesClientListByClusterResponse contains the response from method RolesClient.ListByCluster. +type RolesClientListByClusterResponse struct { + RoleListResult +} + +// ServersClientGetResponse contains the response from method ServersClient.Get. +type ServersClientGetResponse struct { + ClusterServer +} + +// ServersClientListByClusterResponse contains the response from method ServersClient.ListByCluster. +type ServersClientListByClusterResponse struct { + ClusterServerListResult +} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_roles_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/roles_client.go similarity index 56% rename from sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_roles_client.go rename to sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/roles_client.go index e33bbc7504ec..82c24a36991c 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_roles_client.go +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/roles_client.go @@ -5,6 +5,7 @@ // 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 armpostgresqlhsc @@ -31,7 +32,7 @@ type RolesClient struct { } // NewRolesClient creates a new instance of RolesClient with the specified values. -// subscriptionID - The ID of the target subscription. +// subscriptionID - The ID of the target subscription. The value must be an UUID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewRolesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RolesClient, error) { @@ -56,19 +57,21 @@ func NewRolesClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreate - Creates a new role or updates an existing role. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// roleName - The name of the server group role name. +// clusterName - The name of the cluster. +// roleName - The name of the cluster role. // parameters - The required parameters for creating or updating a role. // options - RolesClientBeginCreateOptions contains the optional parameters for the RolesClient.BeginCreate method. -func (client *RolesClient) BeginCreate(ctx context.Context, resourceGroupName string, serverGroupName string, roleName string, parameters Role, options *RolesClientBeginCreateOptions) (*runtime.Poller[RolesClientCreateResponse], error) { +func (client *RolesClient) BeginCreate(ctx context.Context, resourceGroupName string, clusterName string, roleName string, parameters Role, options *RolesClientBeginCreateOptions) (*runtime.Poller[RolesClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, serverGroupName, roleName, parameters, options) + resp, err := client.create(ctx, resourceGroupName, clusterName, roleName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[RolesClientCreateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RolesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[RolesClientCreateResponse](options.ResumeToken, client.pl, nil) } @@ -76,9 +79,9 @@ func (client *RolesClient) BeginCreate(ctx context.Context, resourceGroupName st // Create - Creates a new role or updates an existing role. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *RolesClient) create(ctx context.Context, resourceGroupName string, serverGroupName string, roleName string, parameters Role, options *RolesClientBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, serverGroupName, roleName, parameters, options) +// Generated from API version 2022-11-08 +func (client *RolesClient) create(ctx context.Context, resourceGroupName string, clusterName string, roleName string, parameters Role, options *RolesClientBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, roleName, parameters, options) if err != nil { return nil, err } @@ -86,27 +89,24 @@ func (client *RolesClient) create(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusAccepted) { return nil, runtime.NewResponseError(resp) } return resp, nil } // createCreateRequest creates the Create request. -func (client *RolesClient) createCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, roleName string, parameters Role, options *RolesClientBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/roles/{roleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *RolesClient) createCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, roleName string, parameters Role, options *RolesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/roles/{roleName}" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) if roleName == "" { return nil, errors.New("parameter roleName cannot be empty") } @@ -116,36 +116,38 @@ func (client *RolesClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) } -// BeginDelete - Deletes a server group role. +// BeginDelete - Deletes a cluster role. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// roleName - The name of the server group role name. +// clusterName - The name of the cluster. +// roleName - The name of the cluster role. // options - RolesClientBeginDeleteOptions contains the optional parameters for the RolesClient.BeginDelete method. -func (client *RolesClient) BeginDelete(ctx context.Context, resourceGroupName string, serverGroupName string, roleName string, options *RolesClientBeginDeleteOptions) (*runtime.Poller[RolesClientDeleteResponse], error) { +func (client *RolesClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, roleName string, options *RolesClientBeginDeleteOptions) (*runtime.Poller[RolesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, serverGroupName, roleName, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, roleName, options) if err != nil { return nil, err } - return runtime.NewPoller[RolesClientDeleteResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[RolesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[RolesClientDeleteResponse](options.ResumeToken, client.pl, nil) } } -// Delete - Deletes a server group role. +// Delete - Deletes a cluster role. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *RolesClient) deleteOperation(ctx context.Context, resourceGroupName string, serverGroupName string, roleName string, options *RolesClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverGroupName, roleName, options) +// Generated from API version 2022-11-08 +func (client *RolesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, roleName string, options *RolesClientBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, roleName, options) if err != nil { return nil, err } @@ -153,27 +155,24 @@ func (client *RolesClient) deleteOperation(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { return nil, runtime.NewResponseError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *RolesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, roleName string, options *RolesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/roles/{roleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *RolesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, roleName string, options *RolesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/roles/{roleName}" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) if roleName == "" { return nil, errors.New("parameter roleName cannot be empty") } @@ -183,71 +182,67 @@ func (client *RolesClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// NewListByServerGroupPager - List all the roles in a given server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// NewListByClusterPager - List all the roles in a given cluster. +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - RolesClientListByServerGroupOptions contains the optional parameters for the RolesClient.ListByServerGroup method. -func (client *RolesClient) NewListByServerGroupPager(resourceGroupName string, serverGroupName string, options *RolesClientListByServerGroupOptions) *runtime.Pager[RolesClientListByServerGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[RolesClientListByServerGroupResponse]{ - More: func(page RolesClientListByServerGroupResponse) bool { +// clusterName - The name of the cluster. +// options - RolesClientListByClusterOptions contains the optional parameters for the RolesClient.ListByCluster method. +func (client *RolesClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *RolesClientListByClusterOptions) *runtime.Pager[RolesClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[RolesClientListByClusterResponse]{ + More: func(page RolesClientListByClusterResponse) bool { return false }, - Fetcher: func(ctx context.Context, page *RolesClientListByServerGroupResponse) (RolesClientListByServerGroupResponse, error) { - req, err := client.listByServerGroupCreateRequest(ctx, resourceGroupName, serverGroupName, options) + Fetcher: func(ctx context.Context, page *RolesClientListByClusterResponse) (RolesClientListByClusterResponse, error) { + req, err := client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { - return RolesClientListByServerGroupResponse{}, err + return RolesClientListByClusterResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return RolesClientListByServerGroupResponse{}, err + return RolesClientListByClusterResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return RolesClientListByServerGroupResponse{}, runtime.NewResponseError(resp) + return RolesClientListByClusterResponse{}, runtime.NewResponseError(resp) } - return client.listByServerGroupHandleResponse(resp) + return client.listByClusterHandleResponse(resp) }, }) } -// listByServerGroupCreateRequest creates the ListByServerGroup request. -func (client *RolesClient) listByServerGroupCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *RolesClientListByServerGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/roles" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +// listByClusterCreateRequest creates the ListByCluster request. +func (client *RolesClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *RolesClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/roles" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByServerGroupHandleResponse handles the ListByServerGroup response. -func (client *RolesClient) listByServerGroupHandleResponse(resp *http.Response) (RolesClientListByServerGroupResponse, error) { - result := RolesClientListByServerGroupResponse{} +// listByClusterHandleResponse handles the ListByCluster response. +func (client *RolesClient) listByClusterHandleResponse(resp *http.Response) (RolesClientListByClusterResponse, error) { + result := RolesClientListByClusterResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RoleListResult); err != nil { - return RolesClientListByServerGroupResponse{}, err + return RolesClientListByClusterResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_servers_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/servers_client.go similarity index 57% rename from sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_servers_client.go rename to sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/servers_client.go index 8676ae35651f..ad86f94dcef6 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_servers_client.go +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/servers_client.go @@ -5,6 +5,7 @@ // 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 armpostgresqlhsc @@ -31,7 +32,7 @@ type ServersClient struct { } // NewServersClient creates a new instance of ServersClient with the specified values. -// subscriptionID - The ID of the target subscription. +// subscriptionID - The ID of the target subscription. The value must be an UUID. // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServersClient, error) { @@ -54,15 +55,15 @@ func NewServersClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } -// Get - Gets information about a server in server group. +// Get - Gets information about a server in cluster. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. +// clusterName - The name of the cluster. // 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, serverGroupName string, serverName string, options *ServersClientGetOptions) (ServersClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, serverGroupName, serverName, options) +func (client *ServersClient) Get(ctx context.Context, resourceGroupName string, clusterName string, serverName string, options *ServersClientGetOptions) (ServersClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, serverName, options) if err != nil { return ServersClientGetResponse{}, err } @@ -77,20 +78,17 @@ func (client *ServersClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, serverName string, options *ServersClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/servers/{serverName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, serverName string, options *ServersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/servers/{serverName}" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) if serverName == "" { return nil, errors.New("parameter serverName cannot be empty") } @@ -100,7 +98,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,72 +107,67 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup // getHandleResponse handles the Get response. func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersClientGetResponse, error) { result := ServersClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerGroupServer); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterServer); err != nil { return ServersClientGetResponse{}, err } return result, nil } -// NewListByServerGroupPager - Lists servers of a server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview +// NewListByClusterPager - Lists servers of a cluster. +// Generated from API version 2022-11-08 // resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - ServersClientListByServerGroupOptions contains the optional parameters for the ServersClient.ListByServerGroup -// method. -func (client *ServersClient) NewListByServerGroupPager(resourceGroupName string, serverGroupName string, options *ServersClientListByServerGroupOptions) *runtime.Pager[ServersClientListByServerGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[ServersClientListByServerGroupResponse]{ - More: func(page ServersClientListByServerGroupResponse) bool { +// clusterName - The name of the cluster. +// options - ServersClientListByClusterOptions contains the optional parameters for the ServersClient.ListByCluster method. +func (client *ServersClient) NewListByClusterPager(resourceGroupName string, clusterName string, options *ServersClientListByClusterOptions) *runtime.Pager[ServersClientListByClusterResponse] { + return runtime.NewPager(runtime.PagingHandler[ServersClientListByClusterResponse]{ + More: func(page ServersClientListByClusterResponse) bool { return false }, - Fetcher: func(ctx context.Context, page *ServersClientListByServerGroupResponse) (ServersClientListByServerGroupResponse, error) { - req, err := client.listByServerGroupCreateRequest(ctx, resourceGroupName, serverGroupName, options) + Fetcher: func(ctx context.Context, page *ServersClientListByClusterResponse) (ServersClientListByClusterResponse, error) { + req, err := client.listByClusterCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { - return ServersClientListByServerGroupResponse{}, err + return ServersClientListByClusterResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return ServersClientListByServerGroupResponse{}, err + return ServersClientListByClusterResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServersClientListByServerGroupResponse{}, runtime.NewResponseError(resp) + return ServersClientListByClusterResponse{}, runtime.NewResponseError(resp) } - return client.listByServerGroupHandleResponse(resp) + return client.listByClusterHandleResponse(resp) }, }) } -// listByServerGroupCreateRequest creates the ListByServerGroup request. -func (client *ServersClient) listByServerGroupCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServersClientListByServerGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/servers" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } +// listByClusterCreateRequest creates the ListByCluster request. +func (client *ServersClient) listByClusterCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *ServersClientListByClusterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/serverGroupsv2/{clusterName}/servers" urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") + reqQP.Set("api-version", "2022-11-08") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByServerGroupHandleResponse handles the ListByServerGroup response. -func (client *ServersClient) listByServerGroupHandleResponse(resp *http.Response) (ServersClientListByServerGroupResponse, error) { - result := ServersClientListByServerGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerGroupServerListResult); err != nil { - return ServersClientListByServerGroupResponse{}, err +// listByClusterHandleResponse handles the ListByCluster response. +func (client *ServersClient) listByClusterHandleResponse(resp *http.Response) (ServersClientListByClusterResponse, error) { + result := ServersClientListByClusterResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ClusterServerListResult); err != nil { + return ServersClientListByClusterResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_time_rfc3339.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/time_rfc3339.go index 807547701740..7df41ec8f1bf 100644 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 armpostgresqlhsc diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_configurations_client_test.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_configurations_client_test.go deleted file mode 100644 index 767ae2630ca9..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_configurations_client_test.go +++ /dev/null @@ -1,134 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc_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/postgresqlhsc/armpostgresqlhsc" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/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() - client, err := armpostgresqlhsc.NewConfigurationsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServerPager("TestResourceGroup", - "hsctestsg", - "testserver", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationListByServerGroup.json -func ExampleConfigurationsClient_NewListByServerGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewConfigurationsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServerGroupPager("TestResourceGroup", - "hsctestsg", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ConfigurationUpdate.json -func ExampleConfigurationsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewConfigurationsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "TestResourceGroup", - "hsctestsg", - "array_nulls", - armpostgresqlhsc.ServerGroupConfiguration{ - Properties: &armpostgresqlhsc.ServerGroupConfigurationProperties{ - ServerRoleGroupConfigurations: []*armpostgresqlhsc.ServerRoleGroupConfiguration{ - { - Role: to.Ptr(armpostgresqlhsc.ServerRoleCoordinator), - Value: to.Ptr("on"), - }, - { - Role: to.Ptr(armpostgresqlhsc.ServerRoleWorker), - 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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/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() - client, err := armpostgresqlhsc.NewConfigurationsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "TestResourceGroup", - "hsctestsg", - "array_nulls", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_firewallrules_client_test.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_firewallrules_client_test.go deleted file mode 100644 index b9e4d1619dfe..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_firewallrules_client_test.go +++ /dev/null @@ -1,125 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc_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/postgresqlhsc/armpostgresqlhsc" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/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() - client, err := armpostgresqlhsc.NewFirewallRulesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "TestGroup", - "pgtestsvc4", - "rule1", - armpostgresqlhsc.FirewallRule{ - Properties: &armpostgresqlhsc.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) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/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() - client, err := armpostgresqlhsc.NewFirewallRulesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "TestGroup", - "pgtestsvc4", - "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/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/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() - client, err := armpostgresqlhsc.NewFirewallRulesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "TestGroup", - "pgtestsvc4", - "rule1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/FirewallRuleListByServerGroup.json -func ExampleFirewallRulesClient_NewListByServerGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewFirewallRulesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServerGroupPager("TestGroup", - "pgtestsvc4", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_operations_client_test.go deleted file mode 100644 index 8751f7e97b73..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/OperationList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_roles_client_test.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_roles_client_test.go deleted file mode 100644 index 2b7417c0589a..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_roles_client_test.go +++ /dev/null @@ -1,101 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc_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/postgresqlhsc/armpostgresqlhsc" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleCreate.json -func ExampleRolesClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewRolesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreate(ctx, - "TestGroup", - "pgtestsvc4", - "role1", - armpostgresqlhsc.Role{ - Properties: &armpostgresqlhsc.RoleProperties{ - Password: to.Ptr("secret"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleDelete.json -func ExampleRolesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewRolesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "TestGroup", - "pgtestsvc4", - "role1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/RoleListByServerGroup.json -func ExampleRolesClient_NewListByServerGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewRolesClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServerGroupPager("TestGroup", - "pgtestsvc4", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_servergroups_client_test.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_servergroups_client_test.go deleted file mode 100644 index 13ac19405064..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_servergroups_client_test.go +++ /dev/null @@ -1,314 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc_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/postgresqlhsc/armpostgresqlhsc" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupList.json -func ExampleServerGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupListByResourceGroup.json -func ExampleServerGroupsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("TestGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupCreate.json -func ExampleServerGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, - "TestGroup", - "hsctestsg", - armpostgresqlhsc.ServerGroup{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "ElasticServer": to.Ptr("1"), - }, - Properties: &armpostgresqlhsc.ServerGroupProperties{ - AdministratorLogin: to.Ptr("citus"), - AdministratorLoginPassword: to.Ptr("password"), - AvailabilityZone: to.Ptr("1"), - BackupRetentionDays: to.Ptr[int32](35), - CitusVersion: to.Ptr(armpostgresqlhsc.CitusVersionNine5), - DelegatedSubnetArguments: &armpostgresqlhsc.ServerGroupPropertiesDelegatedSubnetArguments{ - SubnetArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"), - }, - EnableMx: to.Ptr(true), - EnableZfs: to.Ptr(false), - PostgresqlVersion: to.Ptr(armpostgresqlhsc.PostgreSQLVersionTwelve), - PrivateDNSZoneArguments: &armpostgresqlhsc.ServerGroupPropertiesPrivateDNSZoneArguments{ - PrivateDNSZoneArmResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone"), - }, - ServerRoleGroups: []*armpostgresqlhsc.ServerRoleGroup{ - { - EnableHa: to.Ptr(true), - ServerEdition: to.Ptr(armpostgresqlhsc.ServerEditionGeneralPurpose), - StorageQuotaInMb: to.Ptr[int64](524288), - VCores: to.Ptr[int64](4), - Name: to.Ptr(""), - Role: to.Ptr(armpostgresqlhsc.ServerRoleCoordinator), - ServerCount: to.Ptr[int32](1), - }, - { - EnableHa: to.Ptr(false), - ServerEdition: to.Ptr(armpostgresqlhsc.ServerEditionMemoryOptimized), - StorageQuotaInMb: to.Ptr[int64](524288), - VCores: to.Ptr[int64](4), - Name: to.Ptr(""), - Role: to.Ptr(armpostgresqlhsc.ServerRoleWorker), - ServerCount: to.Ptr[int32](3), - }}, - StandbyAvailabilityZone: to.Ptr("2"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupGet.json -func ExampleServerGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "TestGroup", - "hsctestsg1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupDelete.json -func ExampleServerGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "TestGroup", - "testservergroup", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupAddNode.json -func ExampleServerGroupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, - "TestGroup", - "hsctestsg", - armpostgresqlhsc.ServerGroupForUpdate{ - Location: to.Ptr("westus"), - Properties: &armpostgresqlhsc.ServerGroupPropertiesForUpdate{ - ServerRoleGroups: []*armpostgresqlhsc.ServerRoleGroup{ - { - Name: to.Ptr(""), - Role: to.Ptr(armpostgresqlhsc.ServerRoleWorker), - ServerCount: to.Ptr[int32](10), - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupRestart.json -func ExampleServerGroupsClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, - "TestGroup", - "hsctestsg1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupStart.json -func ExampleServerGroupsClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStart(ctx, - "TestGroup", - "hsctestsg1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerGroupStop.json -func ExampleServerGroupsClient_BeginStop() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginStop(ctx, - "TestGroup", - "hsctestsg1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/CheckNameAvailability.json -func ExampleServerGroupsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServerGroupsClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, - armpostgresqlhsc.NameAvailabilityRequest{ - Name: to.Ptr("name1"), - Type: to.Ptr("Microsoft.DBforPostgreSQL/serverGroupsv2"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_servers_client_test.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_servers_client_test.go deleted file mode 100644 index 72ce6f124b39..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/ze_generated_example_servers_client_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/examples/ServerListByServerGroup.json -func ExampleServersClient_NewListByServerGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armpostgresqlhsc.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByServerGroupPager("TestGroup", - "hsctestsg1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/postgresqlhsc/resource-manager/Microsoft.DBforPostgreSQL/preview/2020-10-05-privatepreview/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() - client, err := armpostgresqlhsc.NewServersClient("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "TestGroup", - "hsctestsg1", - "hsctestsg1-c", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_configurations_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_configurations_client.go deleted file mode 100644 index b19d6e22e7e0..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_configurations_client.go +++ /dev/null @@ -1,330 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ConfigurationsClient contains the methods for the Configurations group. -// Don't use this type directly, use NewConfigurationsClient() instead. -type ConfigurationsClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ConfigurationsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// Get - Gets information about single server group configuration. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// configurationName - The name of the server group configuration. -// options - ConfigurationsClientGetOptions contains the optional parameters for the ConfigurationsClient.Get method. -func (client *ConfigurationsClient) Get(ctx context.Context, resourceGroupName string, serverGroupName string, configurationName string, options *ConfigurationsClientGetOptions) (ConfigurationsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, serverGroupName, configurationName, options) - if err != nil { - return ConfigurationsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, configurationName string, options *ConfigurationsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/configurations/{configurationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - if configurationName == "" { - return nil, errors.New("parameter configurationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsClientGetResponse, error) { - result := ConfigurationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerGroupConfiguration); err != nil { - return ConfigurationsClientGetResponse{}, err - } - return result, nil -} - -// NewListByServerPager - List all the configurations of a server in server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// serverName - The name of the server. -// options - ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.ListByServer -// method. -func (client *ConfigurationsClient) NewListByServerPager(resourceGroupName string, serverGroupName string, serverName string, options *ConfigurationsClientListByServerOptions) *runtime.Pager[ConfigurationsClientListByServerResponse] { - return runtime.NewPager(runtime.PagingHandler[ConfigurationsClientListByServerResponse]{ - More: func(page ConfigurationsClientListByServerResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ConfigurationsClientListByServerResponse) (ConfigurationsClientListByServerResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByServerCreateRequest(ctx, resourceGroupName, serverGroupName, serverName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ConfigurationsClientListByServerResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationsClientListByServerResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationsClientListByServerResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerHandleResponse(resp) - }, - }) -} - -// listByServerCreateRequest creates the ListByServer request. -func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, serverName string, options *ConfigurationsClientListByServerOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/servers/{serverName}/configurations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - if serverName == "" { - return nil, errors.New("parameter serverName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverName}", url.PathEscape(serverName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByServerHandleResponse handles the ListByServer response. -func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Response) (ConfigurationsClientListByServerResponse, error) { - result := ConfigurationsClientListByServerResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerConfigurationListResult); err != nil { - return ConfigurationsClientListByServerResponse{}, err - } - return result, nil -} - -// NewListByServerGroupPager - List all the configurations of a server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - ConfigurationsClientListByServerGroupOptions contains the optional parameters for the ConfigurationsClient.ListByServerGroup -// method. -func (client *ConfigurationsClient) NewListByServerGroupPager(resourceGroupName string, serverGroupName string, options *ConfigurationsClientListByServerGroupOptions) *runtime.Pager[ConfigurationsClientListByServerGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[ConfigurationsClientListByServerGroupResponse]{ - More: func(page ConfigurationsClientListByServerGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ConfigurationsClientListByServerGroupResponse) (ConfigurationsClientListByServerGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByServerGroupCreateRequest(ctx, resourceGroupName, serverGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ConfigurationsClientListByServerGroupResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ConfigurationsClientListByServerGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationsClientListByServerGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByServerGroupHandleResponse(resp) - }, - }) -} - -// listByServerGroupCreateRequest creates the ListByServerGroup request. -func (client *ConfigurationsClient) listByServerGroupCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *ConfigurationsClientListByServerGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/configurations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByServerGroupHandleResponse handles the ListByServerGroup response. -func (client *ConfigurationsClient) listByServerGroupHandleResponse(resp *http.Response) (ConfigurationsClientListByServerGroupResponse, error) { - result := ConfigurationsClientListByServerGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerGroupConfigurationListResult); err != nil { - return ConfigurationsClientListByServerGroupResponse{}, err - } - return result, nil -} - -// BeginUpdate - Updates configuration of server role groups in a server group -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// configurationName - The name of the server group configuration. -// parameters - The required parameters for updating a server group configuration. -// options - ConfigurationsClientBeginUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginUpdate -// method. -func (client *ConfigurationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, serverGroupName string, configurationName string, parameters ServerGroupConfiguration, options *ConfigurationsClientBeginUpdateOptions) (*runtime.Poller[ConfigurationsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, serverGroupName, configurationName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ConfigurationsClientUpdateResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ConfigurationsClientUpdateResponse](options.ResumeToken, client.pl, nil) - } -} - -// Update - Updates configuration of server role groups in a server group -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *ConfigurationsClient) update(ctx context.Context, resourceGroupName string, serverGroupName string, configurationName string, parameters ServerGroupConfiguration, options *ConfigurationsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, serverGroupName, configurationName, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *ConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, configurationName string, parameters ServerGroupConfiguration, options *ConfigurationsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/configurations/{configurationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - if configurationName == "" { - return nil, errors.New("parameter configurationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{configurationName}", url.PathEscape(configurationName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_constants.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_constants.go deleted file mode 100644 index f5818024a6dc..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_constants.go +++ /dev/null @@ -1,234 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc - -const ( - moduleName = "armpostgresqlhsc" - moduleVersion = "v0.5.0" -) - -// CitusVersion - The Citus version. -type CitusVersion string - -const ( - CitusVersionEight3 CitusVersion = "8.3" - CitusVersionNine0 CitusVersion = "9.0" - CitusVersionNine1 CitusVersion = "9.1" - CitusVersionNine2 CitusVersion = "9.2" - CitusVersionNine3 CitusVersion = "9.3" - CitusVersionNine4 CitusVersion = "9.4" - CitusVersionNine5 CitusVersion = "9.5" -) - -// PossibleCitusVersionValues returns the possible values for the CitusVersion const type. -func PossibleCitusVersionValues() []CitusVersion { - return []CitusVersion{ - CitusVersionEight3, - CitusVersionNine0, - CitusVersionNine1, - CitusVersionNine2, - CitusVersionNine3, - CitusVersionNine4, - CitusVersionNine5, - } -} - -// ConfigurationDataType - Data type of the configuration. -type ConfigurationDataType string - -const ( - ConfigurationDataTypeBoolean ConfigurationDataType = "Boolean" - ConfigurationDataTypeEnumeration ConfigurationDataType = "Enumeration" - ConfigurationDataTypeInteger ConfigurationDataType = "Integer" - ConfigurationDataTypeNumeric ConfigurationDataType = "Numeric" -) - -// PossibleConfigurationDataTypeValues returns the possible values for the ConfigurationDataType const type. -func PossibleConfigurationDataTypeValues() []ConfigurationDataType { - return []ConfigurationDataType{ - ConfigurationDataTypeBoolean, - ConfigurationDataTypeEnumeration, - ConfigurationDataTypeInteger, - ConfigurationDataTypeNumeric, - } -} - -// CreateMode - The mode to create a new server group. -type CreateMode string - -const ( - CreateModeDefault CreateMode = "Default" - CreateModePointInTimeRestore CreateMode = "PointInTimeRestore" - CreateModeReadReplica CreateMode = "ReadReplica" -) - -// PossibleCreateModeValues returns the possible values for the CreateMode const type. -func PossibleCreateModeValues() []CreateMode { - return []CreateMode{ - CreateModeDefault, - CreateModePointInTimeRestore, - CreateModeReadReplica, - } -} - -// CreatedByType - The type of identity that created the resource. -type CreatedByType string - -const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{ - CreatedByTypeApplication, - CreatedByTypeKey, - CreatedByTypeManagedIdentity, - CreatedByTypeUser, - } -} - -// OperationOrigin - The intended executor of the operation. -type OperationOrigin string - -const ( - OperationOriginNotSpecified OperationOrigin = "NotSpecified" - OperationOriginSystem OperationOrigin = "system" - OperationOriginUser OperationOrigin = "user" -) - -// PossibleOperationOriginValues returns the possible values for the OperationOrigin const type. -func PossibleOperationOriginValues() []OperationOrigin { - return []OperationOrigin{ - OperationOriginNotSpecified, - OperationOriginSystem, - OperationOriginUser, - } -} - -// PostgreSQLVersion - The PostgreSQL version. -type PostgreSQLVersion string - -const ( - PostgreSQLVersionEleven PostgreSQLVersion = "11" - PostgreSQLVersionTwelve PostgreSQLVersion = "12" -) - -// PossiblePostgreSQLVersionValues returns the possible values for the PostgreSQLVersion const type. -func PossiblePostgreSQLVersionValues() []PostgreSQLVersion { - return []PostgreSQLVersion{ - PostgreSQLVersionEleven, - PostgreSQLVersionTwelve, - } -} - -// ResourceProviderType - The resource provider type of server group. -type ResourceProviderType string - -const ( - ResourceProviderTypeMarlin ResourceProviderType = "Marlin" - ResourceProviderTypeMeru ResourceProviderType = "Meru" -) - -// PossibleResourceProviderTypeValues returns the possible values for the ResourceProviderType const type. -func PossibleResourceProviderTypeValues() []ResourceProviderType { - return []ResourceProviderType{ - ResourceProviderTypeMarlin, - ResourceProviderTypeMeru, - } -} - -// ServerEdition - The edition of a server (default: GeneralPurpose). -type ServerEdition string - -const ( - ServerEditionGeneralPurpose ServerEdition = "GeneralPurpose" - ServerEditionMemoryOptimized ServerEdition = "MemoryOptimized" -) - -// PossibleServerEditionValues returns the possible values for the ServerEdition const type. -func PossibleServerEditionValues() []ServerEdition { - return []ServerEdition{ - ServerEditionGeneralPurpose, - ServerEditionMemoryOptimized, - } -} - -// ServerHaState - A state of a server role group/server that is visible to user for HA feature. -type ServerHaState string - -const ( - ServerHaStateCreatingStandby ServerHaState = "CreatingStandby" - ServerHaStateFailingOver ServerHaState = "FailingOver" - ServerHaStateHealthy ServerHaState = "Healthy" - ServerHaStateNotEnabled ServerHaState = "NotEnabled" - ServerHaStateNotSync ServerHaState = "NotSync" - ServerHaStateRemovingStandby ServerHaState = "RemovingStandby" - ServerHaStateReplicatingData ServerHaState = "ReplicatingData" -) - -// PossibleServerHaStateValues returns the possible values for the ServerHaState const type. -func PossibleServerHaStateValues() []ServerHaState { - return []ServerHaState{ - ServerHaStateCreatingStandby, - ServerHaStateFailingOver, - ServerHaStateHealthy, - ServerHaStateNotEnabled, - ServerHaStateNotSync, - ServerHaStateRemovingStandby, - ServerHaStateReplicatingData, - } -} - -// ServerRole - The role of a server. -type ServerRole string - -const ( - ServerRoleCoordinator ServerRole = "Coordinator" - ServerRoleWorker ServerRole = "Worker" -) - -// PossibleServerRoleValues returns the possible values for the ServerRole const type. -func PossibleServerRoleValues() []ServerRole { - return []ServerRole{ - ServerRoleCoordinator, - ServerRoleWorker, - } -} - -// ServerState - A state of a server group/server that is visible to user. -type ServerState string - -const ( - ServerStateDisabled ServerState = "Disabled" - ServerStateDropping ServerState = "Dropping" - ServerStateProvisioning ServerState = "Provisioning" - ServerStateReady ServerState = "Ready" - ServerStateStarting ServerState = "Starting" - ServerStateStopped ServerState = "Stopped" - ServerStateStopping ServerState = "Stopping" - ServerStateUpdating ServerState = "Updating" -) - -// PossibleServerStateValues returns the possible values for the ServerState const type. -func PossibleServerStateValues() []ServerState { - return []ServerState{ - ServerStateDisabled, - ServerStateDropping, - ServerStateProvisioning, - ServerStateReady, - ServerStateStarting, - ServerStateStopped, - ServerStateStopping, - ServerStateUpdating, - } -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_models.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_models.go deleted file mode 100644 index e089120f466d..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_models.go +++ /dev/null @@ -1,775 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc - -import "time" - -// CloudError - An error response from the Batch service. -type CloudError struct { - // The error. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - An error response from the Batch service. -type CloudErrorBody struct { - // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - - // A list of additional details about the error. - Details []*CloudErrorBody `json:"details,omitempty"` - - // A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` - - // The target of the particular error. For example, the name of the property in error. - Target *string `json:"target,omitempty"` -} - -// ConfigurationsClientBeginUpdateOptions contains the optional parameters for the ConfigurationsClient.BeginUpdate method. -type ConfigurationsClientBeginUpdateOptions 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 -} - -// ConfigurationsClientListByServerGroupOptions contains the optional parameters for the ConfigurationsClient.ListByServerGroup -// method. -type ConfigurationsClientListByServerGroupOptions struct { - // placeholder for future optional parameters -} - -// ConfigurationsClientListByServerOptions contains the optional parameters for the ConfigurationsClient.ListByServer method. -type ConfigurationsClientListByServerOptions struct { - // placeholder for future optional parameters -} - -// FirewallRule - Represents a server group firewall rule. -type FirewallRule struct { - // REQUIRED; The properties of a firewall rule. - Properties *FirewallRuleProperties `json:"properties,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The system metadata relating to this resource - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// FirewallRuleListResult - A list of firewall rules. -type FirewallRuleListResult struct { - // The list of firewall rules in a server group. - Value []*FirewallRule `json:"value,omitempty"` -} - -// FirewallRuleProperties - The properties of a server group firewall rule. -type FirewallRuleProperties struct { - // REQUIRED; The end IP address of the server group firewall rule. Must be IPv4 format. - EndIPAddress *string `json:"endIpAddress,omitempty"` - - // REQUIRED; The start IP address of the server group firewall rule. Must be IPv4 format. - StartIPAddress *string `json:"startIpAddress,omitempty"` -} - -// 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 -} - -// FirewallRulesClientListByServerGroupOptions contains the optional parameters for the FirewallRulesClient.ListByServerGroup -// method. -type FirewallRulesClientListByServerGroupOptions struct { - // placeholder for future optional parameters -} - -// MaintenanceWindow - Maintenance window of a server group. -type MaintenanceWindow struct { - // indicates whether custom window is enabled or disabled - CustomWindow *string `json:"customWindow,omitempty"` - - // day of week for maintenance window - DayOfWeek *int32 `json:"dayOfWeek,omitempty"` - - // start hour for maintenance window - StartHour *int32 `json:"startHour,omitempty"` - - // start minute for maintenance window - StartMinute *int32 `json:"startMinute,omitempty"` -} - -// NameAvailability - Represents a resource name availability. -type NameAvailability struct { - // Error Message. - Message *string `json:"message,omitempty"` - - // name of the PostgreSQL server. - Name *string `json:"name,omitempty"` - - // Indicates whether the resource name is available. - NameAvailable *bool `json:"nameAvailable,omitempty"` - - // type of the server - Type *string `json:"type,omitempty"` -} - -// NameAvailabilityRequest - Request from client to check resource name availability. -type NameAvailabilityRequest struct { - // REQUIRED; Resource name to verify. - Name *string `json:"name,omitempty"` - - // REQUIRED; Resource type used for verification. - Type *string `json:"type,omitempty"` -} - -// Operation - REST API operation definition. -type Operation struct { - // Indicates whether the operation is a data action - IsDataAction *bool `json:"isDataAction,omitempty"` - - // READ-ONLY; The localized display information for this particular operation or action. - Display *OperationDisplay `json:"display,omitempty" azure:"ro"` - - // READ-ONLY; The name of the operation being performed on this particular object. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The intended executor of the operation. - Origin *OperationOrigin `json:"origin,omitempty" azure:"ro"` - - // READ-ONLY; Additional descriptions for the operation. - Properties map[string]interface{} `json:"properties,omitempty" azure:"ro"` -} - -// OperationDisplay - Display metadata associated with the operation. -type OperationDisplay struct { - // READ-ONLY; Operation description. - Description *string `json:"description,omitempty" azure:"ro"` - - // READ-ONLY; Localized friendly name for the operation. - Operation *string `json:"operation,omitempty" azure:"ro"` - - // READ-ONLY; Operation resource provider name. - Provider *string `json:"provider,omitempty" azure:"ro"` - - // READ-ONLY; Resource on which the operation is performed. - Resource *string `json:"resource,omitempty" azure:"ro"` -} - -// OperationListResult - A list of resource provider operations. -type OperationListResult struct { - // Collection of available operation details - Value []*Operation `json:"value,omitempty"` - - // READ-ONLY; URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// 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} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// Role - Represents a server group role. -type Role struct { - // The properties of a role. - Properties *RoleProperties `json:"properties,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The system metadata relating to this resource - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// RoleListResult - A list of roles. -type RoleListResult struct { - // The list of roles in a server group. - Value []*Role `json:"value,omitempty"` -} - -// RoleProperties - The properties of a server group role. -type RoleProperties struct { - // REQUIRED; The password of the server group role. - Password *string `json:"password,omitempty"` -} - -// RolesClientBeginCreateOptions contains the optional parameters for the RolesClient.BeginCreate method. -type RolesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// RolesClientBeginDeleteOptions contains the optional parameters for the RolesClient.BeginDelete method. -type RolesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// RolesClientListByServerGroupOptions contains the optional parameters for the RolesClient.ListByServerGroup method. -type RolesClientListByServerGroupOptions struct { - // placeholder for future optional parameters -} - -// ServerConfiguration - Represents a configuration. -type ServerConfiguration struct { - // The properties of a configuration. - Properties *ServerConfigurationProperties `json:"properties,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The system metadata relating to this resource - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerConfigurationListResult - A list of server configurations. -type ServerConfigurationListResult struct { - // The list of server configurations. - Value []*ServerConfiguration `json:"value,omitempty"` - - // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` -} - -// ServerConfigurationProperties - The properties of a configuration. -type ServerConfigurationProperties struct { - // REQUIRED; Value of the configuration. - Value *string `json:"value,omitempty"` - - // READ-ONLY; Allowed values of the configuration. - AllowedValues *string `json:"allowedValues,omitempty" azure:"ro"` - - // READ-ONLY; Data type of the configuration. - DataType *ConfigurationDataType `json:"dataType,omitempty" azure:"ro"` - - // READ-ONLY; Default value of the configuration. - DefaultValue *string `json:"defaultValue,omitempty" azure:"ro"` - - // READ-ONLY; Description of the configuration. - Description *string `json:"description,omitempty" azure:"ro"` - - // READ-ONLY; Source of the configuration. - Source *string `json:"source,omitempty" azure:"ro"` -} - -// ServerGroup - Represents a server group for create. -type ServerGroup struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - - // Properties of the server group create. - Properties *ServerGroupProperties `json:"properties,omitempty"` - - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The system metadata relating to this resource - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerGroupConfiguration - Represents the configuration list of server role groups in a server group. -type ServerGroupConfiguration struct { - // The properties of server group configuration. - Properties *ServerGroupConfigurationProperties `json:"properties,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The system metadata relating to this resource - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerGroupConfigurationListResult - A list of server group configurations. -type ServerGroupConfigurationListResult struct { - // The list of server group configurations. - Value []*ServerGroupConfiguration `json:"value,omitempty"` - - // READ-ONLY; Link to retrieve next page of results. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` -} - -// ServerGroupConfigurationProperties - The properties of server group configuration. -type ServerGroupConfigurationProperties struct { - // REQUIRED; The list of server role group configuration values. - ServerRoleGroupConfigurations []*ServerRoleGroupConfiguration `json:"serverRoleGroupConfigurations,omitempty"` - - // READ-ONLY; Allowed values of the configuration. - AllowedValues *string `json:"allowedValues,omitempty" azure:"ro"` - - // READ-ONLY; Data type of the configuration. - DataType *ConfigurationDataType `json:"dataType,omitempty" azure:"ro"` - - // READ-ONLY; Description of the configuration. - Description *string `json:"description,omitempty" azure:"ro"` -} - -// ServerGroupForUpdate - Represents a server group for update. -type ServerGroupForUpdate struct { - // The location the resource resides in. - Location *string `json:"location,omitempty"` - - // Properties of the server group. - Properties *ServerGroupPropertiesForUpdate `json:"properties,omitempty"` - - // Application-specific metadata in the form of key-value pairs. - Tags map[string]*string `json:"tags,omitempty"` -} - -// ServerGroupListResult - A list of server groups. -type ServerGroupListResult struct { - // The list of server groups - Value []*ServerGroup `json:"value,omitempty"` - - // READ-ONLY; The link used to get the next page of operations. - NextLink *string `json:"nextLink,omitempty" azure:"ro"` -} - -// ServerGroupProperties - The properties used to create a new server group. -type ServerGroupProperties struct { - // The administrator's login name of servers in server group. Can only be specified when the server is being created (and - // is required for creation). - AdministratorLogin *string `json:"administratorLogin,omitempty"` - - // The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - - // Availability Zone information of the server group. - AvailabilityZone *string `json:"availabilityZone,omitempty"` - - // The backup retention days for server group. - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` - - // The Citus version of server group. - CitusVersion *CitusVersion `json:"citusVersion,omitempty"` - - // The mode to create a new server group. - CreateMode *CreateMode `json:"createMode,omitempty"` - - // The delegated subnet arguments for a server group. - DelegatedSubnetArguments *ServerGroupPropertiesDelegatedSubnetArguments `json:"delegatedSubnetArguments,omitempty"` - - // If Citus MX is enabled or not for the server group. - EnableMx *bool `json:"enableMx,omitempty"` - - // If shards on coordinator is enabled or not for the server group. - EnableShardsOnCoordinator *bool `json:"enableShardsOnCoordinator,omitempty"` - - // If ZFS compression is enabled or not for the server group. - EnableZfs *bool `json:"enableZfs,omitempty"` - - // Maintenance window of a server group. - MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` - - // Restore point creation time (ISO8601 format), specifying the time to restore from. It's required when 'createMode' is 'PointInTimeRestore' - PointInTimeUTC *time.Time `json:"pointInTimeUTC,omitempty"` - - // The PostgreSQL version of server group. - PostgresqlVersion *PostgreSQLVersion `json:"postgresqlVersion,omitempty"` - - // The private dns zone arguments for a server group. - PrivateDNSZoneArguments *ServerGroupPropertiesPrivateDNSZoneArguments `json:"privateDnsZoneArguments,omitempty"` - - // The list of server role groups. - ServerRoleGroups []*ServerRoleGroup `json:"serverRoleGroups,omitempty"` - - // The source server group location to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'ReadReplica' - SourceLocation *string `json:"sourceLocation,omitempty"` - - // The source resource group name to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'ReadReplica' - SourceResourceGroupName *string `json:"sourceResourceGroupName,omitempty"` - - // The source server group name to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'ReadReplica' - SourceServerGroupName *string `json:"sourceServerGroupName,omitempty"` - - // The source subscription id to restore from. It's required when 'createMode' is 'PointInTimeRestore' or 'ReadReplica' - SourceSubscriptionID *string `json:"sourceSubscriptionId,omitempty"` - - // Standby Availability Zone information of the server group. - StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"` - - // READ-ONLY; The earliest restore point time (ISO8601 format) for server group. - EarliestRestoreTime *time.Time `json:"earliestRestoreTime,omitempty" azure:"ro"` - - // READ-ONLY; The array of read replica server groups. - ReadReplicas []*string `json:"readReplicas,omitempty" azure:"ro"` - - // READ-ONLY; The resource provider type of server group. - ResourceProviderType *ResourceProviderType `json:"resourceProviderType,omitempty" azure:"ro"` - - // READ-ONLY; The source server group id for read replica server groups. - SourceServerGroup *string `json:"sourceServerGroup,omitempty" azure:"ro"` - - // READ-ONLY; A state of a server group that is visible to user. - State *ServerState `json:"state,omitempty" azure:"ro"` -} - -// ServerGroupPropertiesDelegatedSubnetArguments - The delegated subnet arguments for a server group. -type ServerGroupPropertiesDelegatedSubnetArguments struct { - // delegated subnet arm resource id. - SubnetArmResourceID *string `json:"subnetArmResourceId,omitempty"` -} - -// ServerGroupPropertiesForUpdate - The properties used to update a server group. -type ServerGroupPropertiesForUpdate struct { - // The password of the administrator login. - AdministratorLoginPassword *string `json:"administratorLoginPassword,omitempty"` - - // Availability Zone information of the server group. - AvailabilityZone *string `json:"availabilityZone,omitempty"` - - // The backup retention days for server group. - BackupRetentionDays *int32 `json:"backupRetentionDays,omitempty"` - - // The Citus version of server group. - CitusVersion *CitusVersion `json:"citusVersion,omitempty"` - - // If shards on coordinator is enabled or not for the server group. - EnableShardsOnCoordinator *bool `json:"enableShardsOnCoordinator,omitempty"` - - // Maintenance window of a server group. - MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"` - - // The PostgreSQL version of server group. - PostgresqlVersion *PostgreSQLVersion `json:"postgresqlVersion,omitempty"` - - // The list of server role groups. - ServerRoleGroups []*ServerRoleGroup `json:"serverRoleGroups,omitempty"` - - // Standby Availability Zone information of the server group. - StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"` -} - -// ServerGroupPropertiesPrivateDNSZoneArguments - The private dns zone arguments for a server group. -type ServerGroupPropertiesPrivateDNSZoneArguments struct { - // private dns zone arm resource id. - PrivateDNSZoneArmResourceID *string `json:"privateDnsZoneArmResourceId,omitempty"` -} - -// ServerGroupServer - Represents a server in a server group. -type ServerGroupServer struct { - // The properties of a server in a server group. - Properties *ServerGroupServerProperties `json:"properties,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The system metadata relating to this resource - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} - -// ServerGroupServerListResult - A list of servers in a server group. -type ServerGroupServerListResult struct { - // The list of servers in a server group. - Value []*ServerGroupServer `json:"value,omitempty"` -} - -// ServerGroupServerProperties - The properties of a server in server group. -type ServerGroupServerProperties struct { - // The administrator's login name of a servers in server group. - AdministratorLogin *string `json:"administratorLogin,omitempty"` - - // Availability Zone information of the server group. - AvailabilityZone *string `json:"availabilityZone,omitempty"` - - // The Citus version of server. - CitusVersion *CitusVersion `json:"citusVersion,omitempty"` - - // If high availability is enabled or not for the server. - EnableHa *bool `json:"enableHa,omitempty"` - - // The PostgreSQL version of server. - PostgresqlVersion *PostgreSQLVersion `json:"postgresqlVersion,omitempty"` - - // The role of server in the server group. - Role *ServerRole `json:"role,omitempty"` - - // The edition of a server (default: GeneralPurpose). - ServerEdition *ServerEdition `json:"serverEdition,omitempty"` - - // Standby Availability Zone information of the server group. - StandbyAvailabilityZone *string `json:"standbyAvailabilityZone,omitempty"` - - // The storage of a server in MB (max: 2097152 = 2TiB). - StorageQuotaInMb *int64 `json:"storageQuotaInMb,omitempty"` - - // The vCores count of a server (max: 64). - VCores *int64 `json:"vCores,omitempty"` - - // READ-ONLY; If public IP is requested or not for a server. - EnablePublicIP *bool `json:"enablePublicIp,omitempty" azure:"ro"` - - // READ-ONLY; The fully qualified domain name of a server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty" azure:"ro"` - - // READ-ONLY; A state of a server group that is visible to user for HA feature. - HaState *ServerHaState `json:"haState,omitempty" azure:"ro"` - - // READ-ONLY; A state of a server that is visible to user. - State *ServerState `json:"state,omitempty" azure:"ro"` -} - -// ServerGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerGroupsClient.BeginCreateOrUpdate -// method. -type ServerGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerGroupsClientBeginDeleteOptions contains the optional parameters for the ServerGroupsClient.BeginDelete method. -type ServerGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerGroupsClientBeginRestartOptions contains the optional parameters for the ServerGroupsClient.BeginRestart method. -type ServerGroupsClientBeginRestartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerGroupsClientBeginStartOptions contains the optional parameters for the ServerGroupsClient.BeginStart method. -type ServerGroupsClientBeginStartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerGroupsClientBeginStopOptions contains the optional parameters for the ServerGroupsClient.BeginStop method. -type ServerGroupsClientBeginStopOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerGroupsClientBeginUpdateOptions contains the optional parameters for the ServerGroupsClient.BeginUpdate method. -type ServerGroupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ServerGroupsClientCheckNameAvailabilityOptions contains the optional parameters for the ServerGroupsClient.CheckNameAvailability -// method. -type ServerGroupsClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ServerGroupsClientGetOptions contains the optional parameters for the ServerGroupsClient.Get method. -type ServerGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServerGroupsClientListByResourceGroupOptions contains the optional parameters for the ServerGroupsClient.ListByResourceGroup -// method. -type ServerGroupsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ServerGroupsClientListOptions contains the optional parameters for the ServerGroupsClient.List method. -type ServerGroupsClientListOptions struct { - // placeholder for future optional parameters -} - -// ServerNameItem - The name object for a server. -type ServerNameItem struct { - // The name of a server. - Name *string `json:"name,omitempty"` - - // READ-ONLY; The fully qualified domain name of a server. - FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty" azure:"ro"` -} - -// ServerProperties - The properties of a server. -type ServerProperties struct { - // If high availability is enabled or not for the server. - EnableHa *bool `json:"enableHa,omitempty"` - - // The edition of a server (default: GeneralPurpose). - ServerEdition *ServerEdition `json:"serverEdition,omitempty"` - - // The storage of a server in MB (max: 2097152 = 2TiB). - StorageQuotaInMb *int64 `json:"storageQuotaInMb,omitempty"` - - // The vCores count of a server (max: 64). - VCores *int64 `json:"vCores,omitempty"` - - // READ-ONLY; If public IP is requested or not for a server. - EnablePublicIP *bool `json:"enablePublicIp,omitempty" azure:"ro"` -} - -// ServerRoleGroup - Represents a server role group. -type ServerRoleGroup struct { - // If high availability is enabled or not for the server. - EnableHa *bool `json:"enableHa,omitempty"` - - // The name of the server role group. - Name *string `json:"name,omitempty"` - - // The role of servers in the server role group. - Role *ServerRole `json:"role,omitempty"` - - // The number of servers in the server role group. - ServerCount *int32 `json:"serverCount,omitempty"` - - // The edition of a server (default: GeneralPurpose). - ServerEdition *ServerEdition `json:"serverEdition,omitempty"` - - // The storage of a server in MB (max: 2097152 = 2TiB). - StorageQuotaInMb *int64 `json:"storageQuotaInMb,omitempty"` - - // The vCores count of a server (max: 64). - VCores *int64 `json:"vCores,omitempty"` - - // READ-ONLY; If public IP is requested or not for a server. - EnablePublicIP *bool `json:"enablePublicIp,omitempty" azure:"ro"` - - // READ-ONLY; The list of server names in the server role group. - ServerNames []*ServerNameItem `json:"serverNames,omitempty" azure:"ro"` -} - -// ServerRoleGroupConfiguration - Represents server role group configuration value. -type ServerRoleGroupConfiguration struct { - // REQUIRED; The role of servers in the server role group. - Role *ServerRole `json:"role,omitempty"` - - // REQUIRED; Value of the configuration. - Value *string `json:"value,omitempty"` - - // READ-ONLY; Default value of the configuration. - DefaultValue *string `json:"defaultValue,omitempty" azure:"ro"` - - // READ-ONLY; Source of the configuration. - Source *string `json:"source,omitempty" azure:"ro"` -} - -// ServersClientGetOptions contains the optional parameters for the ServersClient.Get method. -type ServersClientGetOptions struct { - // placeholder for future optional parameters -} - -// ServersClientListByServerGroupOptions contains the optional parameters for the ServersClient.ListByServerGroup method. -type ServersClientListByServerGroupOptions struct { - // placeholder for future optional parameters -} - -// SystemData - Metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time `json:"createdAt,omitempty"` - - // The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - - // The type of identity that created the resource. - CreatedByType *CreatedByType `json:"createdByType,omitempty"` - - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` - - // The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` -} - -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string `json:"location,omitempty"` - - // Resource tags. - Tags map[string]*string `json:"tags,omitempty"` - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty" azure:"ro"` - - // READ-ONLY; The name of the resource - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty" azure:"ro"` -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_models_serde.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_models_serde.go deleted file mode 100644 index 07e2d6e0be70..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_models_serde.go +++ /dev/null @@ -1,290 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type ServerGroup. -func (s ServerGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServerGroupConfiguration. -func (s ServerGroupConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServerGroupConfigurationProperties. -func (s ServerGroupConfigurationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedValues", s.AllowedValues) - populate(objectMap, "dataType", s.DataType) - populate(objectMap, "description", s.Description) - populate(objectMap, "serverRoleGroupConfigurations", s.ServerRoleGroupConfigurations) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServerGroupForUpdate. -func (s ServerGroupForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "location", s.Location) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServerGroupProperties. -func (s ServerGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "administratorLogin", s.AdministratorLogin) - populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) - populate(objectMap, "availabilityZone", s.AvailabilityZone) - populate(objectMap, "backupRetentionDays", s.BackupRetentionDays) - populate(objectMap, "citusVersion", s.CitusVersion) - populate(objectMap, "createMode", s.CreateMode) - populate(objectMap, "delegatedSubnetArguments", s.DelegatedSubnetArguments) - populateTimeRFC3339(objectMap, "earliestRestoreTime", s.EarliestRestoreTime) - populate(objectMap, "enableMx", s.EnableMx) - populate(objectMap, "enableShardsOnCoordinator", s.EnableShardsOnCoordinator) - populate(objectMap, "enableZfs", s.EnableZfs) - populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) - populateTimeRFC3339(objectMap, "pointInTimeUTC", s.PointInTimeUTC) - populate(objectMap, "postgresqlVersion", s.PostgresqlVersion) - populate(objectMap, "privateDnsZoneArguments", s.PrivateDNSZoneArguments) - populate(objectMap, "readReplicas", s.ReadReplicas) - populate(objectMap, "resourceProviderType", s.ResourceProviderType) - populate(objectMap, "serverRoleGroups", s.ServerRoleGroups) - populate(objectMap, "sourceLocation", s.SourceLocation) - populate(objectMap, "sourceResourceGroupName", s.SourceResourceGroupName) - populate(objectMap, "sourceServerGroup", s.SourceServerGroup) - populate(objectMap, "sourceServerGroupName", s.SourceServerGroupName) - populate(objectMap, "sourceSubscriptionId", s.SourceSubscriptionID) - populate(objectMap, "standbyAvailabilityZone", s.StandbyAvailabilityZone) - populate(objectMap, "state", s.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerGroupProperties. -func (s *ServerGroupProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "administratorLogin": - err = unpopulate(val, "AdministratorLogin", &s.AdministratorLogin) - delete(rawMsg, key) - case "administratorLoginPassword": - err = unpopulate(val, "AdministratorLoginPassword", &s.AdministratorLoginPassword) - delete(rawMsg, key) - case "availabilityZone": - err = unpopulate(val, "AvailabilityZone", &s.AvailabilityZone) - delete(rawMsg, key) - case "backupRetentionDays": - err = unpopulate(val, "BackupRetentionDays", &s.BackupRetentionDays) - delete(rawMsg, key) - case "citusVersion": - err = unpopulate(val, "CitusVersion", &s.CitusVersion) - delete(rawMsg, key) - case "createMode": - err = unpopulate(val, "CreateMode", &s.CreateMode) - delete(rawMsg, key) - case "delegatedSubnetArguments": - err = unpopulate(val, "DelegatedSubnetArguments", &s.DelegatedSubnetArguments) - delete(rawMsg, key) - case "earliestRestoreTime": - err = unpopulateTimeRFC3339(val, "EarliestRestoreTime", &s.EarliestRestoreTime) - delete(rawMsg, key) - case "enableMx": - err = unpopulate(val, "EnableMx", &s.EnableMx) - delete(rawMsg, key) - case "enableShardsOnCoordinator": - err = unpopulate(val, "EnableShardsOnCoordinator", &s.EnableShardsOnCoordinator) - delete(rawMsg, key) - case "enableZfs": - err = unpopulate(val, "EnableZfs", &s.EnableZfs) - delete(rawMsg, key) - case "maintenanceWindow": - err = unpopulate(val, "MaintenanceWindow", &s.MaintenanceWindow) - delete(rawMsg, key) - case "pointInTimeUTC": - err = unpopulateTimeRFC3339(val, "PointInTimeUTC", &s.PointInTimeUTC) - delete(rawMsg, key) - case "postgresqlVersion": - err = unpopulate(val, "PostgresqlVersion", &s.PostgresqlVersion) - delete(rawMsg, key) - case "privateDnsZoneArguments": - err = unpopulate(val, "PrivateDNSZoneArguments", &s.PrivateDNSZoneArguments) - delete(rawMsg, key) - case "readReplicas": - err = unpopulate(val, "ReadReplicas", &s.ReadReplicas) - delete(rawMsg, key) - case "resourceProviderType": - err = unpopulate(val, "ResourceProviderType", &s.ResourceProviderType) - delete(rawMsg, key) - case "serverRoleGroups": - err = unpopulate(val, "ServerRoleGroups", &s.ServerRoleGroups) - delete(rawMsg, key) - case "sourceLocation": - err = unpopulate(val, "SourceLocation", &s.SourceLocation) - delete(rawMsg, key) - case "sourceResourceGroupName": - err = unpopulate(val, "SourceResourceGroupName", &s.SourceResourceGroupName) - delete(rawMsg, key) - case "sourceServerGroup": - err = unpopulate(val, "SourceServerGroup", &s.SourceServerGroup) - delete(rawMsg, key) - case "sourceServerGroupName": - err = unpopulate(val, "SourceServerGroupName", &s.SourceServerGroupName) - delete(rawMsg, key) - case "sourceSubscriptionId": - err = unpopulate(val, "SourceSubscriptionID", &s.SourceSubscriptionID) - delete(rawMsg, key) - case "standbyAvailabilityZone": - err = unpopulate(val, "StandbyAvailabilityZone", &s.StandbyAvailabilityZone) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ServerGroupPropertiesForUpdate. -func (s ServerGroupPropertiesForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "administratorLoginPassword", s.AdministratorLoginPassword) - populate(objectMap, "availabilityZone", s.AvailabilityZone) - populate(objectMap, "backupRetentionDays", s.BackupRetentionDays) - populate(objectMap, "citusVersion", s.CitusVersion) - populate(objectMap, "enableShardsOnCoordinator", s.EnableShardsOnCoordinator) - populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) - populate(objectMap, "postgresqlVersion", s.PostgresqlVersion) - populate(objectMap, "serverRoleGroups", s.ServerRoleGroups) - populate(objectMap, "standbyAvailabilityZone", s.StandbyAvailabilityZone) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServerRoleGroup. -func (s ServerRoleGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "enableHa", s.EnableHa) - populate(objectMap, "enablePublicIp", s.EnablePublicIP) - populate(objectMap, "name", s.Name) - populate(objectMap, "role", s.Role) - populate(objectMap, "serverCount", s.ServerCount) - populate(objectMap, "serverEdition", s.ServerEdition) - populate(objectMap, "serverNames", s.ServerNames) - populate(objectMap, "storageQuotaInMb", s.StorageQuotaInMb) - populate(objectMap, "vCores", s.VCores) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_response_types.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_response_types.go deleted file mode 100644 index 87afb92888f6..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_response_types.go +++ /dev/null @@ -1,129 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc - -// ConfigurationsClientGetResponse contains the response from method ConfigurationsClient.Get. -type ConfigurationsClientGetResponse struct { - ServerGroupConfiguration -} - -// ConfigurationsClientListByServerGroupResponse contains the response from method ConfigurationsClient.ListByServerGroup. -type ConfigurationsClientListByServerGroupResponse struct { - ServerGroupConfigurationListResult -} - -// ConfigurationsClientListByServerResponse contains the response from method ConfigurationsClient.ListByServer. -type ConfigurationsClientListByServerResponse struct { - ServerConfigurationListResult -} - -// ConfigurationsClientUpdateResponse contains the response from method ConfigurationsClient.Update. -type ConfigurationsClientUpdateResponse struct { - ServerGroupConfiguration -} - -// FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.CreateOrUpdate. -type FirewallRulesClientCreateOrUpdateResponse struct { - FirewallRule -} - -// FirewallRulesClientDeleteResponse contains the response from method FirewallRulesClient.Delete. -type FirewallRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. -type FirewallRulesClientGetResponse struct { - FirewallRule -} - -// FirewallRulesClientListByServerGroupResponse contains the response from method FirewallRulesClient.ListByServerGroup. -type FirewallRulesClientListByServerGroupResponse struct { - FirewallRuleListResult -} - -// OperationsClientListResponse contains the response from method OperationsClient.List. -type OperationsClientListResponse struct { - OperationListResult -} - -// RolesClientCreateResponse contains the response from method RolesClient.Create. -type RolesClientCreateResponse struct { - Role -} - -// RolesClientDeleteResponse contains the response from method RolesClient.Delete. -type RolesClientDeleteResponse struct { - // placeholder for future response values -} - -// RolesClientListByServerGroupResponse contains the response from method RolesClient.ListByServerGroup. -type RolesClientListByServerGroupResponse struct { - RoleListResult -} - -// ServerGroupsClientCheckNameAvailabilityResponse contains the response from method ServerGroupsClient.CheckNameAvailability. -type ServerGroupsClientCheckNameAvailabilityResponse struct { - NameAvailability -} - -// ServerGroupsClientCreateOrUpdateResponse contains the response from method ServerGroupsClient.CreateOrUpdate. -type ServerGroupsClientCreateOrUpdateResponse struct { - ServerGroup -} - -// ServerGroupsClientDeleteResponse contains the response from method ServerGroupsClient.Delete. -type ServerGroupsClientDeleteResponse struct { - // placeholder for future response values -} - -// ServerGroupsClientGetResponse contains the response from method ServerGroupsClient.Get. -type ServerGroupsClientGetResponse struct { - ServerGroup -} - -// ServerGroupsClientListByResourceGroupResponse contains the response from method ServerGroupsClient.ListByResourceGroup. -type ServerGroupsClientListByResourceGroupResponse struct { - ServerGroupListResult -} - -// ServerGroupsClientListResponse contains the response from method ServerGroupsClient.List. -type ServerGroupsClientListResponse struct { - ServerGroupListResult -} - -// ServerGroupsClientRestartResponse contains the response from method ServerGroupsClient.Restart. -type ServerGroupsClientRestartResponse struct { - // placeholder for future response values -} - -// ServerGroupsClientStartResponse contains the response from method ServerGroupsClient.Start. -type ServerGroupsClientStartResponse struct { - // placeholder for future response values -} - -// ServerGroupsClientStopResponse contains the response from method ServerGroupsClient.Stop. -type ServerGroupsClientStopResponse struct { - // placeholder for future response values -} - -// ServerGroupsClientUpdateResponse contains the response from method ServerGroupsClient.Update. -type ServerGroupsClientUpdateResponse struct { - ServerGroup -} - -// ServersClientGetResponse contains the response from method ServersClient.Get. -type ServersClientGetResponse struct { - ServerGroupServer -} - -// ServersClientListByServerGroupResponse contains the response from method ServersClient.ListByServerGroup. -type ServersClientListByServerGroupResponse struct { - ServerGroupServerListResult -} diff --git a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_servergroups_client.go b/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_servergroups_client.go deleted file mode 100644 index 5c18f85ef5a8..000000000000 --- a/sdk/resourcemanager/postgresqlhsc/armpostgresqlhsc/zz_generated_servergroups_client.go +++ /dev/null @@ -1,663 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armpostgresqlhsc - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ServerGroupsClient contains the methods for the ServerGroups group. -// Don't use this type directly, use NewServerGroupsClient() instead. -type ServerGroupsClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewServerGroupsClient creates a new instance of ServerGroupsClient with the specified values. -// subscriptionID - The ID of the target subscription. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewServerGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerGroupsClient, error) { - if options == nil { - options = &arm.ClientOptions{} - } - ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint - if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { - ep = c.Endpoint - } - pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) - if err != nil { - return nil, err - } - client := &ServerGroupsClient{ - subscriptionID: subscriptionID, - host: ep, - pl: pl, - } - return client, nil -} - -// CheckNameAvailability - Check the availability of name for resource -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// nameAvailabilityRequest - The required parameters for checking if resource name is available. -// options - ServerGroupsClientCheckNameAvailabilityOptions contains the optional parameters for the ServerGroupsClient.CheckNameAvailability -// method. -func (client *ServerGroupsClient) CheckNameAvailability(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *ServerGroupsClientCheckNameAvailabilityOptions) (ServerGroupsClientCheckNameAvailabilityResponse, error) { - req, err := client.checkNameAvailabilityCreateRequest(ctx, nameAvailabilityRequest, options) - if err != nil { - return ServerGroupsClientCheckNameAvailabilityResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServerGroupsClientCheckNameAvailabilityResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerGroupsClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) - } - return client.checkNameAvailabilityHandleResponse(resp) -} - -// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *ServerGroupsClient) checkNameAvailabilityCreateRequest(ctx context.Context, nameAvailabilityRequest NameAvailabilityRequest, options *ServerGroupsClientCheckNameAvailabilityOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/checkNameAvailability" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, nameAvailabilityRequest) -} - -// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. -func (client *ServerGroupsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ServerGroupsClientCheckNameAvailabilityResponse, error) { - result := ServerGroupsClientCheckNameAvailabilityResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { - return ServerGroupsClientCheckNameAvailabilityResponse{}, err - } - return result, nil -} - -// BeginCreateOrUpdate - Creates a new server group with servers. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// parameters - The required parameters for creating or updating a server group. -// options - ServerGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerGroupsClient.BeginCreateOrUpdate -// method. -func (client *ServerGroupsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serverGroupName string, parameters ServerGroup, options *ServerGroupsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ServerGroupsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, serverGroupName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ServerGroupsClientCreateOrUpdateResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ServerGroupsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) - } -} - -// CreateOrUpdate - Creates a new server group with servers. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *ServerGroupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, serverGroupName string, parameters ServerGroup, options *ServerGroupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serverGroupName, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServerGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, parameters ServerGroup, options *ServerGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -} - -// BeginDelete - Deletes a server group together with servers in it. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - ServerGroupsClientBeginDeleteOptions contains the optional parameters for the ServerGroupsClient.BeginDelete -// method. -func (client *ServerGroupsClient) BeginDelete(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginDeleteOptions) (*runtime.Poller[ServerGroupsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ServerGroupsClientDeleteResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ServerGroupsClientDeleteResponse](options.ResumeToken, client.pl, nil) - } -} - -// Delete - Deletes a server group together with servers in it. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *ServerGroupsClient) deleteOperation(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ServerGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets information about a server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - ServerGroupsClientGetOptions contains the optional parameters for the ServerGroupsClient.Get method. -func (client *ServerGroupsClient) Get(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientGetOptions) (ServerGroupsClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return ServerGroupsClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServerGroupsClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerGroupsClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ServerGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServerGroupsClient) getHandleResponse(resp *http.Response) (ServerGroupsClientGetResponse, error) { - result := ServerGroupsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerGroup); err != nil { - return ServerGroupsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List all the server groups in a given subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// options - ServerGroupsClientListOptions contains the optional parameters for the ServerGroupsClient.List method. -func (client *ServerGroupsClient) NewListPager(options *ServerGroupsClientListOptions) *runtime.Pager[ServerGroupsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ServerGroupsClientListResponse]{ - More: func(page ServerGroupsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ServerGroupsClientListResponse) (ServerGroupsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ServerGroupsClientListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServerGroupsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerGroupsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - }) -} - -// listCreateRequest creates the List request. -func (client *ServerGroupsClient) listCreateRequest(ctx context.Context, options *ServerGroupsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/serverGroupsv2" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ServerGroupsClient) listHandleResponse(resp *http.Response) (ServerGroupsClientListResponse, error) { - result := ServerGroupsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerGroupListResult); err != nil { - return ServerGroupsClientListResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List all the server groups in a given resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// options - ServerGroupsClientListByResourceGroupOptions contains the optional parameters for the ServerGroupsClient.ListByResourceGroup -// method. -func (client *ServerGroupsClient) NewListByResourceGroupPager(resourceGroupName string, options *ServerGroupsClientListByResourceGroupOptions) *runtime.Pager[ServerGroupsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[ServerGroupsClientListByResourceGroupResponse]{ - More: func(page ServerGroupsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ServerGroupsClientListByResourceGroupResponse) (ServerGroupsClientListByResourceGroupResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ServerGroupsClientListByResourceGroupResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServerGroupsClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServerGroupsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ServerGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServerGroupsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *ServerGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (ServerGroupsClientListByResourceGroupResponse, error) { - result := ServerGroupsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ServerGroupListResult); err != nil { - return ServerGroupsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// BeginRestart - Restarts the server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - ServerGroupsClientBeginRestartOptions contains the optional parameters for the ServerGroupsClient.BeginRestart -// method. -func (client *ServerGroupsClient) BeginRestart(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginRestartOptions) (*runtime.Poller[ServerGroupsClientRestartResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.restart(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ServerGroupsClientRestartResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ServerGroupsClientRestartResponse](options.ResumeToken, client.pl, nil) - } -} - -// Restart - Restarts the server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *ServerGroupsClient) restart(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginRestartOptions) (*http.Response, error) { - req, err := client.restartCreateRequest(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// restartCreateRequest creates the Restart request. -func (client *ServerGroupsClient) restartCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginRestartOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/restart" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginStart - Starts the server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - ServerGroupsClientBeginStartOptions contains the optional parameters for the ServerGroupsClient.BeginStart method. -func (client *ServerGroupsClient) BeginStart(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginStartOptions) (*runtime.Poller[ServerGroupsClientStartResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.start(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ServerGroupsClientStartResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ServerGroupsClientStartResponse](options.ResumeToken, client.pl, nil) - } -} - -// Start - Starts the server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *ServerGroupsClient) start(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginStartOptions) (*http.Response, error) { - req, err := client.startCreateRequest(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// startCreateRequest creates the Start request. -func (client *ServerGroupsClient) startCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginStartOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/start" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginStop - Stops the server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// options - ServerGroupsClientBeginStopOptions contains the optional parameters for the ServerGroupsClient.BeginStop method. -func (client *ServerGroupsClient) BeginStop(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginStopOptions) (*runtime.Poller[ServerGroupsClientStopResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.stop(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ServerGroupsClientStopResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ServerGroupsClientStopResponse](options.ResumeToken, client.pl, nil) - } -} - -// Stop - Stops the server group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *ServerGroupsClient) stop(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginStopOptions) (*http.Response, error) { - req, err := client.stopCreateRequest(ctx, resourceGroupName, serverGroupName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// stopCreateRequest creates the Stop request. -func (client *ServerGroupsClient) stopCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, options *ServerGroupsClientBeginStopOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}/stop" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// BeginUpdate - Updates an existing server group. The request body can contain one to many of the properties present in the -// normal server group definition. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -// resourceGroupName - The name of the resource group. The name is case insensitive. -// serverGroupName - The name of the server group. -// parameters - The parameters for updating a server group. -// options - ServerGroupsClientBeginUpdateOptions contains the optional parameters for the ServerGroupsClient.BeginUpdate -// method. -func (client *ServerGroupsClient) BeginUpdate(ctx context.Context, resourceGroupName string, serverGroupName string, parameters ServerGroupForUpdate, options *ServerGroupsClientBeginUpdateOptions) (*runtime.Poller[ServerGroupsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, serverGroupName, parameters, options) - if err != nil { - return nil, err - } - return runtime.NewPoller[ServerGroupsClientUpdateResponse](resp, client.pl, nil) - } else { - return runtime.NewPollerFromResumeToken[ServerGroupsClientUpdateResponse](options.ResumeToken, client.pl, nil) - } -} - -// Update - Updates an existing server group. The request body can contain one to many of the properties present in the normal -// server group definition. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2020-10-05-privatepreview -func (client *ServerGroupsClient) update(ctx context.Context, resourceGroupName string, serverGroupName string, parameters ServerGroupForUpdate, options *ServerGroupsClientBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, serverGroupName, parameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *ServerGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, serverGroupName string, parameters ServerGroupForUpdate, options *ServerGroupsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/serverGroupsv2/{serverGroupName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if serverGroupName == "" { - return nil, errors.New("parameter serverGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{serverGroupName}", url.PathEscape(serverGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-05-privatepreview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) -}