From 6a31645a2d540f7ae18a8284209c8acda89ed4dd Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 16 Mar 2023 14:04:19 +0000 Subject: [PATCH] CodeGen from PR 22948 in Azure/azure-rest-api-specs Merge 44cc5a9ee17389b8e1bddea7497109b296d1c4ce into 7f5ff3f2011f2f8019ff5db4b6cc00a128c01eb5 --- .../webpubsub/armwebpubsub/CHANGELOG.md | 20 + .../webpubsub/armwebpubsub/autorest.md | 6 +- .../webpubsub/armwebpubsub/client.go | 198 ++++---- .../armwebpubsub/client_example_test.go | 328 ------------- .../webpubsub/armwebpubsub/constants.go | 2 +- .../armwebpubsub/customcertificates_client.go | 85 ++-- .../customcertificates_client_example_test.go | 107 ----- .../armwebpubsub/customdomains_client.go | 87 ++-- .../customdomains_client_example_test.go | 110 ----- .../webpubsub/armwebpubsub/go.mod | 14 +- .../webpubsub/armwebpubsub/go.sum | 24 +- .../webpubsub/armwebpubsub/hubs_client.go | 87 ++-- .../armwebpubsub/hubs_client_example_test.go | 138 ------ .../webpubsub/armwebpubsub/models.go | 202 +++++--- .../webpubsub/armwebpubsub/models_serde.go | 273 ++++++++--- .../armwebpubsub/operations_client.go | 11 +- .../operations_client_example_test.go | 41 -- .../armwebpubsub/polymorphic_helpers.go | 4 +- .../privateendpointconnections_client.go | 86 ++-- ...endpointconnections_client_example_test.go | 111 ----- .../privatelinkresources_client.go | 24 +- ...rivatelinkresources_client_example_test.go | 41 -- .../webpubsub/armwebpubsub/replicas_client.go | 438 ++++++++++++++++++ .../webpubsub/armwebpubsub/response_types.go | 76 ++- .../sharedprivatelinkresources_client.go | 93 ++-- ...rivatelinkresources_client_example_test.go | 111 ----- .../webpubsub/armwebpubsub/time_rfc3339.go | 2 +- .../webpubsub/armwebpubsub/usages_client.go | 19 +- .../usages_client_example_test.go | 41 -- 29 files changed, 1176 insertions(+), 1603 deletions(-) delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go create mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md index 6d996faea44d..8c2486a52aac 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md @@ -1,5 +1,25 @@ # Release History +## 1.1.0-beta.2 (2023-03-16) +### Features Added + +- New function `NewReplicasClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ReplicasClient, error)` +- New function `*ReplicasClient.BeginCreateOrUpdate(context.Context, string, string, string, Replica, *ReplicasClientBeginCreateOrUpdateOptions) (*runtime.Poller[ReplicasClientCreateOrUpdateResponse], error)` +- New function `*ReplicasClient.Delete(context.Context, string, string, string, *ReplicasClientDeleteOptions) (ReplicasClientDeleteResponse, error)` +- New function `*ReplicasClient.Get(context.Context, string, string, string, *ReplicasClientGetOptions) (ReplicasClientGetResponse, error)` +- New function `*ReplicasClient.NewListPager(string, string, *ReplicasClientListOptions) *runtime.Pager[ReplicasClientListResponse]` +- New function `*ReplicasClient.BeginRestart(context.Context, string, string, string, *ReplicasClientBeginRestartOptions) (*runtime.Poller[ReplicasClientRestartResponse], error)` +- New function `*ReplicasClient.BeginUpdate(context.Context, string, string, string, Replica, *ReplicasClientBeginUpdateOptions) (*runtime.Poller[ReplicasClientUpdateResponse], error)` +- New struct `Replica` +- New struct `ReplicaList` +- New struct `ReplicaProperties` +- New struct `ReplicasClient` +- New field `SystemData` in struct `PrivateLinkResource` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `SystemData` in struct `TrackedResource` + + ## 1.1.0-beta.1 (2022-11-03) ### Features Added diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md index 54fe648a9dfa..c922d28c5c5f 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/fc3c409825d6a31ba909a88ea34dcc13165edc9c/specification/webpubsub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/fc3c409825d6a31ba909a88ea34dcc13165edc9c/specification/webpubsub/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/webpubsub/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/webpubsub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0-beta.1 +module-version: 1.1.0-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go index 36442e1d22c9..bcda1b215c80 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go @@ -32,10 +32,9 @@ type Client struct { } // NewClient creates a new instance of Client with the specified values. -// subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,10 +57,11 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // CheckNameAvailability - Checks that the resource name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// location - the region -// parameters - Parameters supplied to the operation. -// options - ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. +// +// Generated from API version 2023-03-01-preview +// - location - the region +// - parameters - Parameters supplied to the operation. +// - options - ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. func (client *Client) CheckNameAvailability(ctx context.Context, location string, parameters NameAvailabilityParameters, options *ClientCheckNameAvailabilityOptions) (ClientCheckNameAvailabilityResponse, error) { req, err := client.checkNameAvailabilityCreateRequest(ctx, location, parameters, options) if err != nil { @@ -84,16 +84,13 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, lo return nil, errors.New("parameter location cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -110,19 +107,21 @@ func (client *Client) checkNameAvailabilityHandleResponse(resp *http.Response) ( // BeginCreateOrUpdate - Create or update a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// parameters - Parameters for the create or update operation -// options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - parameters - Parameters for the create or update operation +// - options - ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*runtime.Poller[ClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[ClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[ClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -130,7 +129,8 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName // CreateOrUpdate - Create or update a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -149,9 +149,6 @@ func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName stri // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}" - 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") @@ -166,7 +163,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -174,11 +171,11 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG // BeginDelete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*runtime.Poller[ClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, options) @@ -195,7 +192,8 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, // Delete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -214,9 +212,6 @@ func (client *Client) deleteOperation(ctx context.Context, resourceGroupName str // deleteCreateRequest creates the Delete request. func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}" - 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") @@ -231,7 +226,7 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -239,11 +234,11 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName // Get - Get the resource and its properties. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - ClientGetOptions contains the optional parameters for the Client.Get method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ClientGetOptions) (ClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -262,9 +257,6 @@ func (client *Client) Get(ctx context.Context, resourceGroupName string, resourc // getCreateRequest creates the Get request. func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}" - 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") @@ -279,7 +271,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,10 +287,11 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, } // NewListByResourceGroupPager - Handles requests to list all resources in a resource group. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// options - ClientListByResourceGroupOptions contains the optional parameters for the Client.ListByResourceGroup method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager +// method. func (client *Client) NewListByResourceGroupPager(resourceGroupName string, options *ClientListByResourceGroupOptions) *runtime.Pager[ClientListByResourceGroupResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListByResourceGroupResponse]{ More: func(page ClientListByResourceGroupResponse) bool { @@ -330,9 +323,6 @@ func (client *Client) NewListByResourceGroupPager(resourceGroupName string, opti // listByResourceGroupCreateRequest creates the ListByResourceGroup request. func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub" - 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") @@ -343,7 +333,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -359,8 +349,9 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl } // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. -// Generated from API version 2022-08-01-preview -// options - ClientListBySubscriptionOptions contains the optional parameters for the Client.ListBySubscription method. +// +// Generated from API version 2023-03-01-preview +// - options - ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListBySubscriptionResponse]{ More: func(page ClientListBySubscriptionResponse) bool { @@ -392,16 +383,13 @@ func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscripti // listBySubscriptionCreateRequest creates the ListBySubscription request. func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, options *ClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub" - 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", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -418,11 +406,11 @@ func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (Cli // ListKeys - Get the access keys of the resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. func (client *Client) ListKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListKeysOptions) (ClientListKeysResponse, error) { req, err := client.listKeysCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -441,9 +429,6 @@ func (client *Client) ListKeys(ctx context.Context, resourceGroupName string, re // listKeysCreateRequest creates the ListKeys request. func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListKeysOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/listKeys" - 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") @@ -458,7 +443,7 @@ func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -475,11 +460,11 @@ func (client *Client) listKeysHandleResponse(resp *http.Response) (ClientListKey // ListSKUs - List all available skus of the resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. func (client *Client) ListSKUs(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListSKUsOptions) (ClientListSKUsResponse, error) { req, err := client.listSKUsCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -498,9 +483,6 @@ func (client *Client) ListSKUs(ctx context.Context, resourceGroupName string, re // listSKUsCreateRequest creates the ListSKUs request. func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListSKUsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/skus" - 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") @@ -515,7 +497,7 @@ func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -533,12 +515,12 @@ func (client *Client) listSKUsHandleResponse(resp *http.Response) (ClientListSKU // BeginRegenerateKey - Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the // same time. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// parameters - Parameter that describes the Regenerate Key Operation. -// options - ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - parameters - Parameter that describes the Regenerate Key Operation. +// - options - ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*runtime.Poller[ClientRegenerateKeyResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.regenerateKey(ctx, resourceGroupName, resourceName, parameters, options) @@ -546,7 +528,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName return nil, err } return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClientRegenerateKeyResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, }) } else { return runtime.NewPollerFromResumeToken[ClientRegenerateKeyResponse](options.ResumeToken, client.pl, nil) @@ -556,7 +538,8 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName // RegenerateKey - Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same // time. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *Client) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*http.Response, error) { req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -575,9 +558,6 @@ func (client *Client) regenerateKey(ctx context.Context, resourceGroupName strin // regenerateKeyCreateRequest creates the RegenerateKey request. func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/regenerateKey" - 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") @@ -592,7 +572,7 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -600,11 +580,11 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr // BeginRestart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*runtime.Poller[ClientRestartResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.restart(ctx, resourceGroupName, resourceName, options) @@ -612,7 +592,7 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string return nil, err } return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClientRestartResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, }) } else { return runtime.NewPollerFromResumeToken[ClientRestartResponse](options.ResumeToken, client.pl, nil) @@ -621,7 +601,8 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string // Restart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *Client) restart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { @@ -640,9 +621,6 @@ func (client *Client) restart(ctx context.Context, resourceGroupName string, res // restartCreateRequest creates the Restart request. func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/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") @@ -657,7 +635,7 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -665,19 +643,21 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam // BeginUpdate - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// parameters - Parameters for the update operation -// options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - parameters - Parameters for the update operation +// - options - ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*runtime.Poller[ClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[ClientUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) } else { return runtime.NewPollerFromResumeToken[ClientUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -685,7 +665,8 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, // Update - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -704,9 +685,6 @@ func (client *Client) update(ctx context.Context, resourceGroupName string, reso // updateCreateRequest creates the Update request. func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}" - 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") @@ -721,7 +699,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go deleted file mode 100644 index 7692a802bcd3..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go +++ /dev/null @@ -1,328 +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 armwebpubsub_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/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_CheckNameAvailability.json -func ExampleClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CheckNameAvailability(ctx, "eastus", armwebpubsub.NameAvailabilityParameters{ - Name: to.Ptr("myWebPubSubService"), - Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_ListBySubscription.json -func ExampleClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_ListByResourceGroup.json -func ExampleClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myResourceGroup", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_Get.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_CreateOrUpdate.json -func ExampleClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", armwebpubsub.ResourceInfo{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Identity: &armwebpubsub.ManagedIdentity{ - Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - }, - Properties: &armwebpubsub.Properties{ - DisableAADAuth: to.Ptr(false), - DisableLocalAuth: to.Ptr(false), - LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - Categories: []*armwebpubsub.LiveTraceCategory{ - { - Name: to.Ptr("ConnectivityLogs"), - Enabled: to.Ptr("true"), - }}, - Enabled: to.Ptr("false"), - }, - NetworkACLs: &armwebpubsub.NetworkACLs{ - DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - PublicNetwork: &armwebpubsub.NetworkACL{ - Allow: []*armwebpubsub.WebPubSubRequestType{ - to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - }, - }, - PublicNetworkAccess: to.Ptr("Enabled"), - TLS: &armwebpubsub.TLSSettings{ - ClientCertEnabled: to.Ptr(false), - }, - }, - SKU: &armwebpubsub.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - }, - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_Delete.json -func ExampleClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_Update.json -func ExampleClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginUpdate(ctx, "myResourceGroup", "myWebPubSubService", armwebpubsub.ResourceInfo{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Identity: &armwebpubsub.ManagedIdentity{ - Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - }, - Properties: &armwebpubsub.Properties{ - DisableAADAuth: to.Ptr(false), - DisableLocalAuth: to.Ptr(false), - LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - Categories: []*armwebpubsub.LiveTraceCategory{ - { - Name: to.Ptr("ConnectivityLogs"), - Enabled: to.Ptr("true"), - }}, - Enabled: to.Ptr("false"), - }, - NetworkACLs: &armwebpubsub.NetworkACLs{ - DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - PublicNetwork: &armwebpubsub.NetworkACL{ - Allow: []*armwebpubsub.WebPubSubRequestType{ - to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - }, - }, - PublicNetworkAccess: to.Ptr("Enabled"), - TLS: &armwebpubsub.TLSSettings{ - ClientCertEnabled: to.Ptr(false), - }, - }, - SKU: &armwebpubsub.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - }, - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_ListKeys.json -func ExampleClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListKeys(ctx, "myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_RegenerateKey.json -func ExampleClient_BeginRegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRegenerateKey(ctx, "myResourceGroup", "myWebPubSubService", armwebpubsub.RegenerateKeyParameters{ - KeyType: to.Ptr(armwebpubsub.KeyTypePrimary), - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_Restart.json -func ExampleClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginRestart(ctx, "myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSub_ListSkus.json -func ExampleClient_ListSKUs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListSKUs(ctx, "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go index 85837ca75c13..3fc2fb1974e3 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go @@ -11,7 +11,7 @@ package armwebpubsub const ( moduleName = "armwebpubsub" - moduleVersion = "v1.1.0-beta.1" + moduleVersion = "v1.1.0-beta.2" ) // ACLAction - Azure Networking ACL Action. diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go index 37e836d9104f..046912f0db1c 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go @@ -32,10 +32,9 @@ type CustomCertificatesClient struct { } // NewCustomCertificatesClient creates a new instance of CustomCertificatesClient with the specified values. -// subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewCustomCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomCertificatesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,20 +57,22 @@ func NewCustomCertificatesClient(subscriptionID string, credential azcore.TokenC // BeginCreateOrUpdate - Create or update a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// certificateName - Custom certificate name -// options - CustomCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomCertificatesClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - certificateName - Custom certificate name +// - options - CustomCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomCertificatesClient.BeginCreateOrUpdate +// method. func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, options *CustomCertificatesClientBeginCreateOrUpdateOptions) (*runtime.Poller[CustomCertificatesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, certificateName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[CustomCertificatesClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CustomCertificatesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[CustomCertificatesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -79,7 +80,8 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Create or update a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *CustomCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, options *CustomCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, certificateName, parameters, options) if err != nil { @@ -98,9 +100,6 @@ func (client *CustomCertificatesClient) createOrUpdate(ctx context.Context, reso // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, options *CustomCertificatesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customCertificates/{certificateName}" - 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") @@ -119,7 +118,7 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -127,13 +126,13 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. // Delete - Delete a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// certificateName - Custom certificate name -// options - CustomCertificatesClientDeleteOptions contains the optional parameters for the CustomCertificatesClient.Delete -// method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - certificateName - Custom certificate name +// - options - CustomCertificatesClientDeleteOptions contains the optional parameters for the CustomCertificatesClient.Delete +// method. func (client *CustomCertificatesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, options *CustomCertificatesClientDeleteOptions) (CustomCertificatesClientDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, certificateName, options) if err != nil { @@ -152,9 +151,6 @@ func (client *CustomCertificatesClient) Delete(ctx context.Context, resourceGrou // deleteCreateRequest creates the Delete request. func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, options *CustomCertificatesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customCertificates/{certificateName}" - 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") @@ -173,7 +169,7 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,12 +177,12 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, // Get - Get a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// certificateName - Custom certificate name -// options - CustomCertificatesClientGetOptions contains the optional parameters for the CustomCertificatesClient.Get method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - certificateName - Custom certificate name +// - options - CustomCertificatesClientGetOptions contains the optional parameters for the CustomCertificatesClient.Get method. func (client *CustomCertificatesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, options *CustomCertificatesClientGetOptions) (CustomCertificatesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, certificateName, options) if err != nil { @@ -205,9 +201,6 @@ func (client *CustomCertificatesClient) Get(ctx context.Context, resourceGroupNa // getCreateRequest creates the Get request. func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, options *CustomCertificatesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customCertificates/{certificateName}" - 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") @@ -226,7 +219,7 @@ func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -242,11 +235,12 @@ func (client *CustomCertificatesClient) getHandleResponse(resp *http.Response) ( } // NewListPager - List all custom certificates. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.List method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.NewListPager +// method. func (client *CustomCertificatesClient) NewListPager(resourceGroupName string, resourceName string, options *CustomCertificatesClientListOptions) *runtime.Pager[CustomCertificatesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[CustomCertificatesClientListResponse]{ More: func(page CustomCertificatesClientListResponse) bool { @@ -278,9 +272,6 @@ func (client *CustomCertificatesClient) NewListPager(resourceGroupName string, r // listCreateRequest creates the List request. func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *CustomCertificatesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customCertificates" - 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") @@ -295,7 +286,7 @@ func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go deleted file mode 100644 index ac84e82fbe91..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go +++ /dev/null @@ -1,107 +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 armwebpubsub_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/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubCustomCertificates_List.json -func ExampleCustomCertificatesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewCustomCertificatesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubCustomCertificates_Get.json -func ExampleCustomCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewCustomCertificatesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myWebPubSubService", "myCert", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubCustomCertificates_CreateOrUpdate.json -func ExampleCustomCertificatesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewCustomCertificatesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myCert", armwebpubsub.CustomCertificate{ - Properties: &armwebpubsub.CustomCertificateProperties{ - KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), - KeyVaultSecretName: to.Ptr("mycert"), - KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), - }, - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubCustomCertificates_Delete.json -func ExampleCustomCertificatesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewCustomCertificatesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, "myResourceGroup", "myWebPubSubService", "myCert", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go index cbf1d7097137..f751c37549f4 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go @@ -32,10 +32,9 @@ type CustomDomainsClient struct { } // NewCustomDomainsClient creates a new instance of CustomDomainsClient with the specified values. -// subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomDomainsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,20 +57,22 @@ func NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create or update a custom domain. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// name - Custom domain name. -// options - CustomDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomDomainsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - name - Custom domain name. +// - options - CustomDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomDomainsClient.BeginCreateOrUpdate +// method. func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, options *CustomDomainsClientBeginCreateOrUpdateOptions) (*runtime.Poller[CustomDomainsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, name, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[CustomDomainsClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[CustomDomainsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[CustomDomainsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -79,7 +80,8 @@ func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a custom domain. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *CustomDomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, options *CustomDomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, name, parameters, options) if err != nil { @@ -98,9 +100,6 @@ func (client *CustomDomainsClient) createOrUpdate(ctx context.Context, resourceG // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, options *CustomDomainsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains/{name}" - 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") @@ -119,7 +118,7 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -127,13 +126,13 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// name - Custom domain name. -// options - CustomDomainsClientBeginDeleteOptions contains the optional parameters for the CustomDomainsClient.BeginDelete -// method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - name - Custom domain name. +// - options - CustomDomainsClientBeginDeleteOptions contains the optional parameters for the CustomDomainsClient.BeginDelete +// method. func (client *CustomDomainsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*runtime.Poller[CustomDomainsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, name, options) @@ -150,7 +149,8 @@ func (client *CustomDomainsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *CustomDomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, name, options) if err != nil { @@ -169,9 +169,6 @@ func (client *CustomDomainsClient) deleteOperation(ctx context.Context, resource // deleteCreateRequest creates the Delete request. func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains/{name}" - 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") @@ -190,7 +187,7 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,12 +195,12 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get a custom domain. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// name - Custom domain name. -// options - CustomDomainsClientGetOptions contains the optional parameters for the CustomDomainsClient.Get method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - name - Custom domain name. +// - options - CustomDomainsClientGetOptions contains the optional parameters for the CustomDomainsClient.Get method. func (client *CustomDomainsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientGetOptions) (CustomDomainsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, name, options) if err != nil { @@ -222,9 +219,6 @@ func (client *CustomDomainsClient) Get(ctx context.Context, resourceGroupName st // getCreateRequest creates the Get request. func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains/{name}" - 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") @@ -243,7 +237,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,11 +253,11 @@ func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (Custo } // NewListPager - List all custom domains. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.List method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.NewListPager method. func (client *CustomDomainsClient) NewListPager(resourceGroupName string, resourceName string, options *CustomDomainsClientListOptions) *runtime.Pager[CustomDomainsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[CustomDomainsClientListResponse]{ More: func(page CustomDomainsClientListResponse) bool { @@ -295,9 +289,6 @@ func (client *CustomDomainsClient) NewListPager(resourceGroupName string, resour // listCreateRequest creates the List request. func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *CustomDomainsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/customDomains" - 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") @@ -312,7 +303,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go deleted file mode 100644 index 134252c023c1..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go +++ /dev/null @@ -1,110 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwebpubsub_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/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubCustomDomains_List.json -func ExampleCustomDomainsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewCustomDomainsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubCustomDomains_Get.json -func ExampleCustomDomainsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewCustomDomainsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "myResourceGroup", "myWebPubSubService", "example", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubCustomDomains_CreateOrUpdate.json -func ExampleCustomDomainsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewCustomDomainsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myDomain", armwebpubsub.CustomDomain{ - Properties: &armwebpubsub.CustomDomainProperties{ - CustomCertificate: &armwebpubsub.ResourceReference{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customCertificates/myCert"), - }, - DomainName: to.Ptr("example.com"), - }, - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubCustomDomains_Delete.json -func ExampleCustomDomainsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewCustomDomainsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "myResourceGroup", "myWebPubSubService", "example", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod index 3b1e59a7f1d1..4791eecae0b1 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpub go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum index 8828b17b1853..3afb578030a5 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= -github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go index 7dbf538ef691..937b329446e8 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go @@ -32,10 +32,9 @@ type HubsClient struct { } // NewHubsClient creates a new instance of HubsClient with the specified values. -// subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HubsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,21 +57,23 @@ func NewHubsClient(subscriptionID string, credential azcore.TokenCredential, opt // BeginCreateOrUpdate - Create or update a hub setting. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// hubName - The hub name. -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// parameters - The resource of WebPubSubHub and its properties -// options - HubsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubsClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-03-01-preview +// - hubName - The hub name. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - parameters - The resource of WebPubSubHub and its properties +// - options - HubsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubsClient.BeginCreateOrUpdate +// method. func (client *HubsClient) BeginCreateOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*runtime.Poller[HubsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, hubName, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[HubsClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[HubsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[HubsClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -80,7 +81,8 @@ func (client *HubsClient) BeginCreateOrUpdate(ctx context.Context, hubName strin // CreateOrUpdate - Create or update a hub setting. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *HubsClient) createOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, hubName, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -103,9 +105,6 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa return nil, errors.New("parameter hubName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) - 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") @@ -120,7 +119,7 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -128,12 +127,12 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa // BeginDelete - Delete a hub setting. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// hubName - The hub name. -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - HubsClientBeginDeleteOptions contains the optional parameters for the HubsClient.BeginDelete method. +// +// Generated from API version 2023-03-01-preview +// - hubName - The hub name. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - HubsClientBeginDeleteOptions contains the optional parameters for the HubsClient.BeginDelete method. func (client *HubsClient) BeginDelete(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*runtime.Poller[HubsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, hubName, resourceGroupName, resourceName, options) @@ -150,7 +149,8 @@ func (client *HubsClient) BeginDelete(ctx context.Context, hubName string, resou // Delete - Delete a hub setting. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *HubsClient) deleteOperation(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, hubName, resourceGroupName, resourceName, options) if err != nil { @@ -173,9 +173,6 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin return nil, errors.New("parameter hubName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) - 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") @@ -190,7 +187,7 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,12 +195,12 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin // Get - Get a hub setting. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// hubName - The hub name. -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - HubsClientGetOptions contains the optional parameters for the HubsClient.Get method. +// +// Generated from API version 2023-03-01-preview +// - hubName - The hub name. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - HubsClientGetOptions contains the optional parameters for the HubsClient.Get method. func (client *HubsClient) Get(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientGetOptions) (HubsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, hubName, resourceGroupName, resourceName, options) if err != nil { @@ -226,9 +223,6 @@ func (client *HubsClient) getCreateRequest(ctx context.Context, hubName string, return nil, errors.New("parameter hubName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) - 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") @@ -243,7 +237,7 @@ func (client *HubsClient) getCreateRequest(ctx context.Context, hubName string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,11 +253,11 @@ func (client *HubsClient) getHandleResponse(resp *http.Response) (HubsClientGetR } // NewListPager - List hub settings. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - HubsClientListOptions contains the optional parameters for the HubsClient.List method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - HubsClientListOptions contains the optional parameters for the HubsClient.NewListPager method. func (client *HubsClient) NewListPager(resourceGroupName string, resourceName string, options *HubsClientListOptions) *runtime.Pager[HubsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[HubsClientListResponse]{ More: func(page HubsClientListResponse) bool { @@ -295,9 +289,6 @@ func (client *HubsClient) NewListPager(resourceGroupName string, resourceName st // listCreateRequest creates the List request. func (client *HubsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *HubsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs" - 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") @@ -312,7 +303,7 @@ func (client *HubsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go deleted file mode 100644 index 5d77c76f7cc8..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go +++ /dev/null @@ -1,138 +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 armwebpubsub_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/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubHubs_List.json -func ExampleHubsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewHubsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubHubs_Get.json -func ExampleHubsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewHubsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "exampleHub", "myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubHubs_CreateOrUpdate.json -func ExampleHubsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewHubsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "exampleHub", "myResourceGroup", "myWebPubSubService", armwebpubsub.Hub{ - Properties: &armwebpubsub.HubProperties{ - AnonymousConnectPolicy: to.Ptr("allow"), - EventHandlers: []*armwebpubsub.EventHandler{ - { - Auth: &armwebpubsub.UpstreamAuthSettings{ - Type: to.Ptr(armwebpubsub.UpstreamAuthTypeManagedIdentity), - ManagedIdentity: &armwebpubsub.ManagedIdentitySettings{ - Resource: to.Ptr("abc"), - }, - }, - SystemEvents: []*string{ - to.Ptr("connect"), - to.Ptr("connected")}, - URLTemplate: to.Ptr("http://host.com"), - UserEventPattern: to.Ptr("*"), - }}, - EventListeners: []*armwebpubsub.EventListener{ - { - Endpoint: &armwebpubsub.EventHubEndpoint{ - Type: to.Ptr(armwebpubsub.EventListenerEndpointDiscriminatorEventHub), - EventHubName: to.Ptr("eventHubName1"), - FullyQualifiedNamespace: to.Ptr("example.servicebus.windows.net"), - }, - Filter: &armwebpubsub.EventNameFilter{ - Type: to.Ptr(armwebpubsub.EventListenerFilterDiscriminatorEventName), - SystemEvents: []*string{ - to.Ptr("connected"), - to.Ptr("disconnected")}, - UserEventPattern: to.Ptr("*"), - }, - }}, - }, - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubHubs_Delete.json -func ExampleHubsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewHubsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "exampleHub", "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go index 0cb2946398e2..0c378e7bb043 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go @@ -51,12 +51,12 @@ type ClientGetOptions struct { // placeholder for future optional parameters } -// ClientListByResourceGroupOptions contains the optional parameters for the Client.ListByResourceGroup method. +// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. type ClientListByResourceGroupOptions struct { // placeholder for future optional parameters } -// ClientListBySubscriptionOptions contains the optional parameters for the Client.ListBySubscription method. +// ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. type ClientListBySubscriptionOptions struct { // placeholder for future optional parameters } @@ -76,16 +76,16 @@ type CustomCertificate struct { // REQUIRED; Custom certificate properties. Properties *CustomCertificateProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // 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.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -130,7 +130,7 @@ type CustomCertificatesClientGetOptions struct { // placeholder for future optional parameters } -// CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.List method. +// CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.NewListPager method. type CustomCertificatesClientListOptions struct { // placeholder for future optional parameters } @@ -140,16 +140,16 @@ type CustomDomain struct { // REQUIRED; Properties of a custom domain. Properties *CustomDomainProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // 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.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -192,7 +192,7 @@ type CustomDomainsClientGetOptions struct { // placeholder for future optional parameters } -// CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.List method. +// CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.NewListPager method. type CustomDomainsClientListOptions struct { // placeholder for future optional parameters } @@ -215,7 +215,7 @@ type Dimension struct { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info interface{} `json:"info,omitempty" azure:"ro"` + Info any `json:"info,omitempty" azure:"ro"` // READ-ONLY; The additional info type. Type *string `json:"type,omitempty" azure:"ro"` @@ -357,16 +357,16 @@ type Hub struct { // REQUIRED; Properties of a hub. Properties *HubProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // 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.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -413,7 +413,7 @@ type HubsClientGetOptions struct { // placeholder for future optional parameters } -// HubsClientListOptions contains the optional parameters for the HubsClient.List method. +// HubsClientListOptions contains the optional parameters for the HubsClient.NewListPager method. type HubsClientListOptions struct { // placeholder for future optional parameters } @@ -605,7 +605,7 @@ type OperationProperties struct { ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } @@ -633,16 +633,16 @@ type PrivateEndpointConnection struct { // Private endpoint connection properties Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // 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.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -684,7 +684,7 @@ type PrivateEndpointConnectionsClientGetOptions struct { // placeholder for future optional parameters } -// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager // method. type PrivateEndpointConnectionsClientListOptions struct { // placeholder for future optional parameters @@ -701,13 +701,16 @@ type PrivateLinkResource struct { // Private link resource properties Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // 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"` } @@ -735,7 +738,8 @@ type PrivateLinkResourceProperties struct { ShareablePrivateLinkResourceTypes []*ShareablePrivateLinkResourceType `json:"shareablePrivateLinkResourceTypes,omitempty"` } -// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List method. +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } @@ -805,16 +809,19 @@ type Properties struct { Version *string `json:"version,omitempty" azure:"ro"` } -// ProxyResource - The resource model definition for a ARM proxy resource. It will have everything other than required location -// and tags +// 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. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // 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"` } @@ -824,45 +831,119 @@ type RegenerateKeyParameters struct { KeyType *KeyType `json:"keyType,omitempty"` } -// Resource - The core properties of ARM resources. +// Replica - A class represent a replica resource. +type Replica struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + Properties *ReplicaProperties `json:"properties,omitempty"` + + // The billing information of the resource. + SKU *ResourceSKU `json:"sku,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"` +} + +type ReplicaList struct { + // The URL the 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"` + + // List of the replica + Value []*Replica `json:"value,omitempty"` +} + +type ReplicaProperties struct { + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate method. +type ReplicasClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientBeginRestartOptions contains the optional parameters for the ReplicasClient.BeginRestart method. +type ReplicasClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientBeginUpdateOptions contains the optional parameters for the ReplicasClient.BeginUpdate method. +type ReplicasClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. +type ReplicasClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. +type ReplicasClientGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. +type ReplicasClientListOptions struct { + // placeholder for future optional parameters +} + +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // 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"` } // ResourceInfo - A class represent a resource. type ResourceInfo struct { + // REQUIRED; The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // A class represent managed identities used for request and response Identity *ManagedIdentity `json:"identity,omitempty"` - // The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. - Location *string `json:"location,omitempty"` - // A class that describes the properties of the resource Properties *Properties `json:"properties,omitempty"` // The billing information of the resource. SKU *ResourceSKU `json:"sku,omitempty"` - // Tags of the service which is a list of key value pairs that describe the resource. + // Resource tags. Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // 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.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -994,16 +1075,16 @@ type SharedPrivateLinkResource struct { // Describes the properties of an existing Shared Private Link Resource Properties *SharedPrivateLinkResourceProperties `json:"properties,omitempty"` - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // 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.SignalRService/SignalR" + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -1055,7 +1136,7 @@ type SharedPrivateLinkResourcesClientGetOptions struct { // placeholder for future optional parameters } -// SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.List +// SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListPager // method. type SharedPrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters @@ -1120,25 +1201,30 @@ type SystemData struct { // TLSSettings - TLS settings for the resource type TLSSettings struct { - // Request client certificate during TLS handshake if enabled + // Request client certificate during TLS handshake if enabled. Not supported for free tier. Any input will be ignored for + // free tier. ClientCertEnabled *bool `json:"clientCertEnabled,omitempty"` } -// TrackedResource - The resource model definition for a ARM tracked top level resource. +// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' +// and a 'location' type TrackedResource struct { - // The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. + // REQUIRED; The geo-location where the resource lives Location *string `json:"location,omitempty"` - // Tags of the service which is a list of key value pairs that describe the resource. + // Resource tags. Tags map[string]*string `json:"tags,omitempty"` - // READ-ONLY; Fully qualified resource Id for the resource. + // 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. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + // 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"` } @@ -1151,7 +1237,7 @@ type UpstreamAuthSettings struct { Type *UpstreamAuthType `json:"type,omitempty"` } -// UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. +// UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. type UsagesClientListOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go index 83fe69365a4d..898a0f7c9079 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go @@ -18,7 +18,7 @@ import ( // MarshalJSON implements the json.Marshaller interface for type CustomCertificate. func (c CustomCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) @@ -61,7 +61,7 @@ func (c *CustomCertificate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CustomCertificateList. func (c CustomCertificateList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) @@ -92,7 +92,7 @@ func (c *CustomCertificateList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CustomCertificateProperties. func (c CustomCertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "keyVaultBaseUri", c.KeyVaultBaseURI) populate(objectMap, "keyVaultSecretName", c.KeyVaultSecretName) populate(objectMap, "keyVaultSecretVersion", c.KeyVaultSecretVersion) @@ -131,7 +131,7 @@ func (c *CustomCertificateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CustomDomain. func (c CustomDomain) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) @@ -174,7 +174,7 @@ func (c *CustomDomain) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CustomDomainList. func (c CustomDomainList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", c.NextLink) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) @@ -205,7 +205,7 @@ func (c *CustomDomainList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CustomDomainProperties. func (c CustomDomainProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "customCertificate", c.CustomCertificate) populate(objectMap, "domainName", c.DomainName) populate(objectMap, "provisioningState", c.ProvisioningState) @@ -240,7 +240,7 @@ func (c *CustomDomainProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Dimension. func (d Dimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "displayName", d.DisplayName) populate(objectMap, "internalName", d.InternalName) populate(objectMap, "name", d.Name) @@ -279,7 +279,7 @@ func (d *Dimension) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "info", &e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) @@ -310,7 +310,7 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorDetail. func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "additionalInfo", e.AdditionalInfo) populate(objectMap, "code", e.Code) populate(objectMap, "details", e.Details) @@ -353,7 +353,7 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ErrorResponse. func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } @@ -380,7 +380,7 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventHandler. func (e EventHandler) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "auth", e.Auth) populate(objectMap, "systemEvents", e.SystemEvents) populate(objectMap, "urlTemplate", e.URLTemplate) @@ -419,7 +419,7 @@ func (e *EventHandler) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventHubEndpoint. func (e EventHubEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "eventHubName", e.EventHubName) populate(objectMap, "fullyQualifiedNamespace", e.FullyQualifiedNamespace) objectMap["type"] = EventListenerEndpointDiscriminatorEventHub @@ -454,7 +454,7 @@ func (e *EventHubEndpoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventListener. func (e EventListener) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "endpoint", e.Endpoint) populate(objectMap, "filter", e.Filter) return json.Marshal(objectMap) @@ -485,7 +485,7 @@ func (e *EventListener) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventListenerEndpoint. func (e EventListenerEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["type"] = e.Type return json.Marshal(objectMap) } @@ -512,7 +512,7 @@ func (e *EventListenerEndpoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventListenerFilter. func (e EventListenerFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) objectMap["type"] = e.Type return json.Marshal(objectMap) } @@ -539,7 +539,7 @@ func (e *EventListenerFilter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EventNameFilter. func (e EventNameFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "systemEvents", e.SystemEvents) objectMap["type"] = EventListenerFilterDiscriminatorEventName populate(objectMap, "userEventPattern", e.UserEventPattern) @@ -574,7 +574,7 @@ func (e *EventNameFilter) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Hub. func (h Hub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", h.ID) populate(objectMap, "name", h.Name) populate(objectMap, "properties", h.Properties) @@ -617,7 +617,7 @@ func (h *Hub) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HubList. func (h HubList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", h.NextLink) populate(objectMap, "value", h.Value) return json.Marshal(objectMap) @@ -648,7 +648,7 @@ func (h *HubList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type HubProperties. func (h HubProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "anonymousConnectPolicy", h.AnonymousConnectPolicy) populate(objectMap, "eventHandlers", h.EventHandlers) populate(objectMap, "eventListeners", h.EventListeners) @@ -683,7 +683,7 @@ func (h *HubProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Keys. func (k Keys) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "primaryConnectionString", k.PrimaryConnectionString) populate(objectMap, "primaryKey", k.PrimaryKey) populate(objectMap, "secondaryConnectionString", k.SecondaryConnectionString) @@ -722,7 +722,7 @@ func (k *Keys) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LiveTraceCategory. func (l LiveTraceCategory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enabled", l.Enabled) populate(objectMap, "name", l.Name) return json.Marshal(objectMap) @@ -753,7 +753,7 @@ func (l *LiveTraceCategory) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LiveTraceConfiguration. func (l LiveTraceConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "categories", l.Categories) populate(objectMap, "enabled", l.Enabled) return json.Marshal(objectMap) @@ -784,7 +784,7 @@ func (l *LiveTraceConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type LogSpecification. func (l LogSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "displayName", l.DisplayName) populate(objectMap, "name", l.Name) return json.Marshal(objectMap) @@ -815,7 +815,7 @@ func (l *LogSpecification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManagedIdentity. func (m ManagedIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "principalId", m.PrincipalID) populate(objectMap, "tenantId", m.TenantID) populate(objectMap, "type", m.Type) @@ -854,7 +854,7 @@ func (m *ManagedIdentity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ManagedIdentitySettings. func (m ManagedIdentitySettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "resource", m.Resource) return json.Marshal(objectMap) } @@ -881,7 +881,7 @@ func (m *ManagedIdentitySettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type MetricSpecification. func (m MetricSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "aggregationType", m.AggregationType) populate(objectMap, "category", m.Category) populate(objectMap, "dimensions", m.Dimensions) @@ -936,7 +936,7 @@ func (m *MetricSpecification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NameAvailability. func (n NameAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "message", n.Message) populate(objectMap, "nameAvailable", n.NameAvailable) populate(objectMap, "reason", n.Reason) @@ -971,7 +971,7 @@ func (n *NameAvailability) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NameAvailabilityParameters. func (n NameAvailabilityParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", n.Name) populate(objectMap, "type", n.Type) return json.Marshal(objectMap) @@ -1002,7 +1002,7 @@ func (n *NameAvailabilityParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkACL. func (n NetworkACL) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allow", n.Allow) populate(objectMap, "deny", n.Deny) return json.Marshal(objectMap) @@ -1033,7 +1033,7 @@ func (n *NetworkACL) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NetworkACLs. func (n NetworkACLs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "defaultAction", n.DefaultAction) populate(objectMap, "privateEndpoints", n.PrivateEndpoints) populate(objectMap, "publicNetwork", n.PublicNetwork) @@ -1068,7 +1068,7 @@ func (n *NetworkACLs) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "display", o.Display) populate(objectMap, "isDataAction", o.IsDataAction) populate(objectMap, "name", o.Name) @@ -1111,7 +1111,7 @@ func (o *Operation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationDisplay. func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", o.Description) populate(objectMap, "operation", o.Operation) populate(objectMap, "provider", o.Provider) @@ -1150,7 +1150,7 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationList. func (o OperationList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", o.NextLink) populate(objectMap, "value", o.Value) return json.Marshal(objectMap) @@ -1181,7 +1181,7 @@ func (o *OperationList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OperationProperties. func (o OperationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "serviceSpecification", o.ServiceSpecification) return json.Marshal(objectMap) } @@ -1208,7 +1208,7 @@ func (o *OperationProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } @@ -1235,7 +1235,7 @@ func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointACL. func (p PrivateEndpointACL) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allow", p.Allow) populate(objectMap, "deny", p.Deny) populate(objectMap, "name", p.Name) @@ -1270,7 +1270,7 @@ func (p *PrivateEndpointACL) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) @@ -1313,7 +1313,7 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionList. func (p PrivateEndpointConnectionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -1344,7 +1344,7 @@ func (p *PrivateEndpointConnectionList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "groupIds", p.GroupIDs) populate(objectMap, "privateEndpoint", p.PrivateEndpoint) populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) @@ -1383,10 +1383,11 @@ func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) 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) } @@ -1409,6 +1410,9 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { 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) @@ -1422,7 +1426,7 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceList. func (p PrivateLinkResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) @@ -1453,7 +1457,7 @@ func (p *PrivateLinkResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "groupId", p.GroupID) populate(objectMap, "requiredMembers", p.RequiredMembers) populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) @@ -1492,7 +1496,7 @@ func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "actionsRequired", p.ActionsRequired) populate(objectMap, "description", p.Description) populate(objectMap, "status", p.Status) @@ -1527,7 +1531,7 @@ func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Properties. func (p Properties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "disableAadAuth", p.DisableAADAuth) populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) populate(objectMap, "externalIP", p.ExternalIP) @@ -1614,9 +1618,10 @@ func (p *Properties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ProxyResource. func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1636,6 +1641,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { 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) @@ -1649,7 +1657,7 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RegenerateKeyParameters. func (r RegenerateKeyParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "keyType", r.KeyType) return json.Marshal(objectMap) } @@ -1674,11 +1682,125 @@ func (r *RegenerateKeyParameters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Replica. +func (r Replica) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + populate(objectMap, "location", r.Location) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "sku", r.SKU) + populate(objectMap, "systemData", r.SystemData) + populate(objectMap, "tags", r.Tags) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Replica. +func (r *Replica) 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 "location": + err = unpopulate(val, "Location", &r.Location) + 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 "sku": + err = unpopulate(val, "SKU", &r.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) + 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 ReplicaList. +func (r ReplicaList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaList. +func (r *ReplicaList) 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 "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, 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 ReplicaProperties. +func (r ReplicaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", r.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicaProperties. +func (r *ReplicaProperties) 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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + 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 Resource. func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -1698,6 +1820,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { 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) @@ -1711,7 +1836,7 @@ func (r *Resource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceInfo. func (r ResourceInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "identity", r.Identity) populate(objectMap, "location", r.Location) @@ -1770,7 +1895,7 @@ func (r *ResourceInfo) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceInfoList. func (r ResourceInfoList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) @@ -1801,7 +1926,7 @@ func (r *ResourceInfoList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceLogCategory. func (r ResourceLogCategory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "enabled", r.Enabled) populate(objectMap, "name", r.Name) return json.Marshal(objectMap) @@ -1832,7 +1957,7 @@ func (r *ResourceLogCategory) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceLogConfiguration. func (r ResourceLogConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "categories", r.Categories) return json.Marshal(objectMap) } @@ -1859,7 +1984,7 @@ func (r *ResourceLogConfiguration) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceReference. func (r ResourceReference) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", r.ID) return json.Marshal(objectMap) } @@ -1886,7 +2011,7 @@ func (r *ResourceReference) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceSKU. func (r ResourceSKU) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacity", r.Capacity) populate(objectMap, "family", r.Family) populate(objectMap, "name", r.Name) @@ -1929,7 +2054,7 @@ func (r *ResourceSKU) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SKU. func (s SKU) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "capacity", s.Capacity) populate(objectMap, "resourceType", s.ResourceType) populate(objectMap, "sku", s.SKU) @@ -1964,7 +2089,7 @@ func (s *SKU) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SKUCapacity. func (s SKUCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "allowedValues", s.AllowedValues) populate(objectMap, "default", s.Default) populate(objectMap, "maximum", s.Maximum) @@ -2007,7 +2132,7 @@ func (s *SKUCapacity) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SKUList. func (s SKUList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -2038,7 +2163,7 @@ func (s *SKUList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. func (s ServiceSpecification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "logSpecifications", s.LogSpecifications) populate(objectMap, "metricSpecifications", s.MetricSpecifications) return json.Marshal(objectMap) @@ -2069,7 +2194,7 @@ func (s *ServiceSpecification) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ShareablePrivateLinkResourceProperties. func (s ShareablePrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "description", s.Description) populate(objectMap, "groupId", s.GroupID) populate(objectMap, "type", s.Type) @@ -2104,7 +2229,7 @@ func (s *ShareablePrivateLinkResourceProperties) UnmarshalJSON(data []byte) erro // MarshalJSON implements the json.Marshaller interface for type ShareablePrivateLinkResourceType. func (s ShareablePrivateLinkResourceType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) return json.Marshal(objectMap) @@ -2135,7 +2260,7 @@ func (s *ShareablePrivateLinkResourceType) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResource. func (s SharedPrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) @@ -2178,7 +2303,7 @@ func (s *SharedPrivateLinkResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResourceList. func (s SharedPrivateLinkResourceList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -2209,7 +2334,7 @@ func (s *SharedPrivateLinkResourceList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SharedPrivateLinkResourceProperties. func (s SharedPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "groupId", s.GroupID) populate(objectMap, "privateLinkResourceId", s.PrivateLinkResourceID) populate(objectMap, "provisioningState", s.ProvisioningState) @@ -2252,7 +2377,7 @@ func (s *SharedPrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SignalRServiceUsage. func (s SignalRServiceUsage) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "currentValue", s.CurrentValue) populate(objectMap, "id", s.ID) populate(objectMap, "limit", s.Limit) @@ -2295,7 +2420,7 @@ func (s *SignalRServiceUsage) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SignalRServiceUsageList. func (s SignalRServiceUsageList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -2326,7 +2451,7 @@ func (s *SignalRServiceUsageList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SignalRServiceUsageName. func (s SignalRServiceUsageName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "localizedValue", s.LocalizedValue) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) @@ -2357,7 +2482,7 @@ func (s *SignalRServiceUsageName) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) @@ -2404,7 +2529,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TLSSettings. func (t TLSSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clientCertEnabled", t.ClientCertEnabled) return json.Marshal(objectMap) } @@ -2431,10 +2556,11 @@ func (t *TLSSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) 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) @@ -2458,6 +2584,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { 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) @@ -2474,7 +2603,7 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpstreamAuthSettings. func (u UpstreamAuthSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "managedIdentity", u.ManagedIdentity) populate(objectMap, "type", u.Type) return json.Marshal(objectMap) @@ -2505,7 +2634,7 @@ func (u *UpstreamAuthSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentityProperty. func (u UserAssignedIdentityProperty) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) + objectMap := make(map[string]any) populate(objectMap, "clientId", u.ClientID) populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) @@ -2534,7 +2663,7 @@ func (u *UserAssignedIdentityProperty) UnmarshalJSON(data []byte) error { return nil } -func populate(m map[string]interface{}, k string, v interface{}) { +func populate(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { @@ -2544,7 +2673,7 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } -func unpopulate(data json.RawMessage, fn string, v interface{}) error { +func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil { return nil } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go index aebfa0975230..b63dafec2844 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go @@ -28,8 +28,8 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -50,8 +50,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists all of the available REST API operations of the Microsoft.SignalRService provider. -// Generated from API version 2022-08-01-preview -// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +// +// Generated from API version 2023-03-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { @@ -88,7 +89,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go deleted file mode 100644 index a11b29e39401..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/Operations_List.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 := armwebpubsub.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/webpubsub/armwebpubsub/polymorphic_helpers.go b/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go index 68902567866e..4536bed49d4c 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go @@ -15,7 +15,7 @@ func unmarshalEventListenerEndpointClassification(rawMsg json.RawMessage) (Event if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } @@ -33,7 +33,7 @@ func unmarshalEventListenerFilterClassification(rawMsg json.RawMessage) (EventLi if rawMsg == nil { return nil, nil } - var m map[string]interface{} + var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go index 593e8c34db56..f334d8a90104 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go @@ -32,10 +32,9 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -// subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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{} @@ -58,13 +57,13 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // BeginDelete - Delete the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// privateEndpointConnectionName - The name of the private endpoint connection -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. +// +// Generated from API version 2023-03-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) @@ -81,7 +80,8 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, // Delete - Delete the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) if err != nil { @@ -104,9 +104,6 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - 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") @@ -121,7 +118,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -129,13 +126,13 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// privateEndpointConnectionName - The name of the private endpoint connection -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. +// +// Generated from API version 2023-03-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { req, err := client.getCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) if err != nil { @@ -158,9 +155,6 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - 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") @@ -175,7 +169,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,12 +185,12 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res } // NewListPager - List private endpoint connections -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.List -// method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{ More: func(page PrivateEndpointConnectionsClientListResponse) bool { @@ -228,9 +222,6 @@ func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName s // listCreateRequest creates the List request. func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections" - 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") @@ -245,7 +236,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,14 +253,14 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // Update - Update the state of specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// privateEndpointConnectionName - The name of the private endpoint connection -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// parameters - The resource of private endpoint and its properties -// options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update -// method. +// +// Generated from API version 2023-03-01-preview +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - parameters - The resource of private endpoint and its properties +// - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -292,9 +283,6 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - 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") @@ -309,7 +297,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go deleted file mode 100644 index 34a7290a49eb..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,111 +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 armwebpubsub_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/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubPrivateEndpointConnections_List.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Update.json -func ExamplePrivateEndpointConnectionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "myWebPubSubService", armwebpubsub.PrivateEndpointConnection{ - Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - }, - PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - }, - }, - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewPrivateEndpointConnectionsClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go index 554fa8496baa..722d2697f6b8 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go @@ -32,10 +32,9 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -// subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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{} @@ -57,12 +56,12 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke } // NewListPager - Get the private link resources that need to be created for a resource. -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.List -// method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListResponse]{ More: func(page PrivateLinkResourcesClientListResponse) bool { @@ -94,9 +93,6 @@ func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, // listCreateRequest creates the List request. func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateLinkResources" - 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") @@ -111,7 +107,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go deleted file mode 100644 index 16ccf98a10b6..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubPrivateLinkResources_List.json -func ExamplePrivateLinkResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewPrivateLinkResourcesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", "myWebPubSubService", 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/webpubsub/armwebpubsub/replicas_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go new file mode 100644 index 000000000000..1a60020b774d --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go @@ -0,0 +1,438 @@ +//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 armwebpubsub + +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" +) + +// ReplicasClient contains the methods for the WebPubSubReplicas group. +// Don't use this type directly, use NewReplicasClient() instead. +type ReplicasClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewReplicasClient creates a new instance of ReplicasClient 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 NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicasClient, 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 := &ReplicasClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create or update a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - parameters - Parameters for the create or update operation +// - options - ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate +// method. +func (client *ReplicasClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*runtime.Poller[ReplicasClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, replicaName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ReplicasClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + } else { + return runtime.NewPollerFromResumeToken[ReplicasClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// CreateOrUpdate - Create or update a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *ReplicasClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// Delete - Operation to delete a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. +func (client *ReplicasClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientDeleteOptions) (ReplicasClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return ReplicasClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ReplicasClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ReplicasClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ReplicasClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get the replica and its properties. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. +func (client *ReplicasClient) Get(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientGetOptions) (ReplicasClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return ReplicasClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ReplicasClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ReplicasClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ReplicasClient) getHandleResponse(resp *http.Response) (ReplicasClientGetResponse, error) { + result := ReplicasClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Replica); err != nil { + return ReplicasClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all replicas belong to this resource +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. +func (client *ReplicasClient) NewListPager(resourceGroupName string, resourceName string, options *ReplicasClientListOptions) *runtime.Pager[ReplicasClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ReplicasClientListResponse]{ + More: func(page ReplicasClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ReplicasClientListResponse) (ReplicasClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, resourceName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ReplicasClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ReplicasClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ReplicasClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ReplicasClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ReplicasClient) listHandleResponse(resp *http.Response) (ReplicasClientListResponse, error) { + result := ReplicasClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicaList); err != nil { + return ReplicasClientListResponse{}, err + } + return result, nil +} + +// BeginRestart - Operation to restart a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicasClientBeginRestartOptions contains the optional parameters for the ReplicasClient.BeginRestart method. +func (client *ReplicasClient) BeginRestart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*runtime.Poller[ReplicasClientRestartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.restart(ctx, resourceGroupName, resourceName, replicaName, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ReplicasClientRestartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ReplicasClientRestartResponse](options.ResumeToken, client.pl, nil) + } +} + +// Restart - Operation to restart a replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *ReplicasClient) restart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*http.Response, error) { + req, err := client.restartCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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 +} + +// restartCreateRequest creates the Restart request. +func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Operation to update an exiting replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - parameters - Parameters for the update operation +// - options - ReplicasClientBeginUpdateOptions contains the optional parameters for the ReplicasClient.BeginUpdate method. +func (client *ReplicasClient) BeginUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*runtime.Poller[ReplicasClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, resourceName, replicaName, parameters, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[ReplicasClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } else { + return runtime.NewPollerFromResumeToken[ReplicasClientUpdateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Update - Operation to update an exiting replica. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-03-01-preview +func (client *ReplicasClient) update(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, 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 *ReplicasClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" + 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 resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + 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", "2023-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go b/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go index d1d2f48c72f1..2da8b2193971 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go @@ -14,12 +14,12 @@ type ClientCheckNameAvailabilityResponse struct { NameAvailability } -// ClientCreateOrUpdateResponse contains the response from method Client.CreateOrUpdate. +// ClientCreateOrUpdateResponse contains the response from method Client.BeginCreateOrUpdate. type ClientCreateOrUpdateResponse struct { ResourceInfo } -// ClientDeleteResponse contains the response from method Client.Delete. +// ClientDeleteResponse contains the response from method Client.BeginDelete. type ClientDeleteResponse struct { // placeholder for future response values } @@ -29,12 +29,12 @@ type ClientGetResponse struct { ResourceInfo } -// ClientListByResourceGroupResponse contains the response from method Client.ListByResourceGroup. +// ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager. type ClientListByResourceGroupResponse struct { ResourceInfoList } -// ClientListBySubscriptionResponse contains the response from method Client.ListBySubscription. +// ClientListBySubscriptionResponse contains the response from method Client.NewListBySubscriptionPager. type ClientListBySubscriptionResponse struct { ResourceInfoList } @@ -49,22 +49,22 @@ type ClientListSKUsResponse struct { SKUList } -// ClientRegenerateKeyResponse contains the response from method Client.RegenerateKey. +// ClientRegenerateKeyResponse contains the response from method Client.BeginRegenerateKey. type ClientRegenerateKeyResponse struct { Keys } -// ClientRestartResponse contains the response from method Client.Restart. +// ClientRestartResponse contains the response from method Client.BeginRestart. type ClientRestartResponse struct { // placeholder for future response values } -// ClientUpdateResponse contains the response from method Client.Update. +// ClientUpdateResponse contains the response from method Client.BeginUpdate. type ClientUpdateResponse struct { ResourceInfo } -// CustomCertificatesClientCreateOrUpdateResponse contains the response from method CustomCertificatesClient.CreateOrUpdate. +// CustomCertificatesClientCreateOrUpdateResponse contains the response from method CustomCertificatesClient.BeginCreateOrUpdate. type CustomCertificatesClientCreateOrUpdateResponse struct { CustomCertificate } @@ -79,17 +79,17 @@ type CustomCertificatesClientGetResponse struct { CustomCertificate } -// CustomCertificatesClientListResponse contains the response from method CustomCertificatesClient.List. +// CustomCertificatesClientListResponse contains the response from method CustomCertificatesClient.NewListPager. type CustomCertificatesClientListResponse struct { CustomCertificateList } -// CustomDomainsClientCreateOrUpdateResponse contains the response from method CustomDomainsClient.CreateOrUpdate. +// CustomDomainsClientCreateOrUpdateResponse contains the response from method CustomDomainsClient.BeginCreateOrUpdate. type CustomDomainsClientCreateOrUpdateResponse struct { CustomDomain } -// CustomDomainsClientDeleteResponse contains the response from method CustomDomainsClient.Delete. +// CustomDomainsClientDeleteResponse contains the response from method CustomDomainsClient.BeginDelete. type CustomDomainsClientDeleteResponse struct { // placeholder for future response values } @@ -99,17 +99,17 @@ type CustomDomainsClientGetResponse struct { CustomDomain } -// CustomDomainsClientListResponse contains the response from method CustomDomainsClient.List. +// CustomDomainsClientListResponse contains the response from method CustomDomainsClient.NewListPager. type CustomDomainsClientListResponse struct { CustomDomainList } -// HubsClientCreateOrUpdateResponse contains the response from method HubsClient.CreateOrUpdate. +// HubsClientCreateOrUpdateResponse contains the response from method HubsClient.BeginCreateOrUpdate. type HubsClientCreateOrUpdateResponse struct { Hub } -// HubsClientDeleteResponse contains the response from method HubsClient.Delete. +// HubsClientDeleteResponse contains the response from method HubsClient.BeginDelete. type HubsClientDeleteResponse struct { // placeholder for future response values } @@ -119,17 +119,17 @@ type HubsClientGetResponse struct { Hub } -// HubsClientListResponse contains the response from method HubsClient.List. +// HubsClientListResponse contains the response from method HubsClient.NewListPager. type HubsClientListResponse struct { HubList } -// OperationsClientListResponse contains the response from method OperationsClient.List. +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { OperationList } -// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { // placeholder for future response values } @@ -139,7 +139,7 @@ type PrivateEndpointConnectionsClientGetResponse struct { PrivateEndpointConnection } -// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.List. +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. type PrivateEndpointConnectionsClientListResponse struct { PrivateEndpointConnectionList } @@ -149,17 +149,47 @@ type PrivateEndpointConnectionsClientUpdateResponse struct { PrivateEndpointConnection } -// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.List. +// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. type PrivateLinkResourcesClientListResponse struct { PrivateLinkResourceList } -// SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.CreateOrUpdate. +// ReplicasClientCreateOrUpdateResponse contains the response from method ReplicasClient.BeginCreateOrUpdate. +type ReplicasClientCreateOrUpdateResponse struct { + Replica +} + +// ReplicasClientDeleteResponse contains the response from method ReplicasClient.Delete. +type ReplicasClientDeleteResponse struct { + // placeholder for future response values +} + +// ReplicasClientGetResponse contains the response from method ReplicasClient.Get. +type ReplicasClientGetResponse struct { + Replica +} + +// ReplicasClientListResponse contains the response from method ReplicasClient.NewListPager. +type ReplicasClientListResponse struct { + ReplicaList +} + +// ReplicasClientRestartResponse contains the response from method ReplicasClient.BeginRestart. +type ReplicasClientRestartResponse struct { + // placeholder for future response values +} + +// ReplicasClientUpdateResponse contains the response from method ReplicasClient.BeginUpdate. +type ReplicasClientUpdateResponse struct { + Replica +} + +// SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.BeginCreateOrUpdate. type SharedPrivateLinkResourcesClientCreateOrUpdateResponse struct { SharedPrivateLinkResource } -// SharedPrivateLinkResourcesClientDeleteResponse contains the response from method SharedPrivateLinkResourcesClient.Delete. +// SharedPrivateLinkResourcesClientDeleteResponse contains the response from method SharedPrivateLinkResourcesClient.BeginDelete. type SharedPrivateLinkResourcesClientDeleteResponse struct { // placeholder for future response values } @@ -169,12 +199,12 @@ type SharedPrivateLinkResourcesClientGetResponse struct { SharedPrivateLinkResource } -// SharedPrivateLinkResourcesClientListResponse contains the response from method SharedPrivateLinkResourcesClient.List. +// SharedPrivateLinkResourcesClientListResponse contains the response from method SharedPrivateLinkResourcesClient.NewListPager. type SharedPrivateLinkResourcesClientListResponse struct { SharedPrivateLinkResourceList } -// UsagesClientListResponse contains the response from method UsagesClient.List. +// UsagesClientListResponse contains the response from method UsagesClient.NewListPager. type UsagesClientListResponse struct { SignalRServiceUsageList } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go index d27df1cae602..9277b68657a1 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go @@ -32,10 +32,9 @@ type SharedPrivateLinkResourcesClient struct { } // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient with the specified values. -// subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedPrivateLinkResourcesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -58,21 +57,23 @@ func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcor // BeginCreateOrUpdate - Create or update a shared private link resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// sharedPrivateLinkResourceName - The name of the shared private link resource -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// parameters - The shared private link resource -// options - SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate -// method. +// +// Generated from API version 2023-03-01-preview +// - sharedPrivateLinkResourceName - The name of the shared private link resource +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - parameters - The shared private link resource +// - options - SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate +// method. func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*runtime.Poller[SharedPrivateLinkResourcesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.createOrUpdate(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - return runtime.NewPoller[SharedPrivateLinkResourcesClientCreateOrUpdateResponse](resp, client.pl, nil) + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) } else { return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientCreateOrUpdateResponse](options.ResumeToken, client.pl, nil) } @@ -80,7 +81,8 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. // CreateOrUpdate - Create or update a shared private link resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) if err != nil { @@ -103,9 +105,6 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) - 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") @@ -120,7 +119,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -128,13 +127,13 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// sharedPrivateLinkResourceName - The name of the shared private link resource -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete -// method. +// +// Generated from API version 2023-03-01-preview +// - sharedPrivateLinkResourceName - The name of the shared private link resource +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete +// method. func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*runtime.Poller[SharedPrivateLinkResourcesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) @@ -151,7 +150,8 @@ func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, // Delete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview +// +// Generated from API version 2023-03-01-preview func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) if err != nil { @@ -174,9 +174,6 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) - 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") @@ -191,7 +188,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,13 +196,13 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. // Get - Get the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-08-01-preview -// sharedPrivateLinkResourceName - The name of the shared private link resource -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get -// method. +// +// Generated from API version 2023-03-01-preview +// - sharedPrivateLinkResourceName - The name of the shared private link resource +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get +// method. func (client *SharedPrivateLinkResourcesClient) Get(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientGetOptions) (SharedPrivateLinkResourcesClientGetResponse, error) { req, err := client.getCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) if err != nil { @@ -228,9 +225,6 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) - 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") @@ -245,7 +239,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,12 +255,12 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res } // NewListPager - List shared private link resources -// Generated from API version 2022-08-01-preview -// resourceGroupName - The name of the resource group that contains the resource. You can obtain this value from the Azure -// Resource Manager API or the portal. -// resourceName - The name of the resource. -// options - SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.List -// method. +// +// Generated from API version 2023-03-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - options - SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListPager +// method. func (client *SharedPrivateLinkResourcesClient) NewListPager(resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientListOptions) *runtime.Pager[SharedPrivateLinkResourcesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SharedPrivateLinkResourcesClientListResponse]{ More: func(page SharedPrivateLinkResourcesClientListResponse) bool { @@ -298,9 +292,6 @@ func (client *SharedPrivateLinkResourcesClient) NewListPager(resourceGroupName s // listCreateRequest creates the List request. func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources" - 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") @@ -315,7 +306,7 @@ func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go deleted file mode 100644 index 833beda96331..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go +++ /dev/null @@ -1,111 +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 armwebpubsub_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/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_List.json -func ExampleSharedPrivateLinkResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewSharedPrivateLinkResourcesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_Get.json -func ExampleSharedPrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewSharedPrivateLinkResourcesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, "upstream", "myResourceGroup", "myWebPubSubService", 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json -func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewSharedPrivateLinkResourcesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginCreateOrUpdate(ctx, "upstream", "myResourceGroup", "myWebPubSubService", armwebpubsub.SharedPrivateLinkResource{ - Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ - GroupID: to.Ptr("sites"), - PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - RequestMessage: to.Ptr("Please approve"), - }, - }, 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/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_Delete.json -func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewSharedPrivateLinkResourcesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, "upstream", "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go b/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go index 8683361c4a07..3205063dea3f 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go @@ -62,7 +62,7 @@ func (t *timeRFC3339) Parse(layout, value string) error { return err } -func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go index 5e7f1154de85..8b30b0245039 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go @@ -32,10 +32,9 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -// subscriptionID - Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms -// part of the URI for every service call. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default 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 NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { if options == nil { options = &arm.ClientOptions{} @@ -57,9 +56,10 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o } // NewListPager - List resource usage quotas by location. -// Generated from API version 2022-08-01-preview -// location - the location like "eastus" -// options - UsagesClientListOptions contains the optional parameters for the UsagesClient.List method. +// +// Generated from API version 2023-03-01-preview +// - location - the location like "eastus" +// - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[UsagesClientListResponse]{ More: func(page UsagesClientListResponse) bool { @@ -95,16 +95,13 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, errors.New("parameter location cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - 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", "2022-08-01-preview") + reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go deleted file mode 100644 index 28d00409044f..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2022-08-01-preview/examples/Usages_List.json -func ExampleUsagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armwebpubsub.NewUsagesClient("00000000-0000-0000-0000-000000000000", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("eastus", 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 - } - } -}