From 39a1e984da9c5579df5492e062d185dbae768f33 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 19 Mar 2026 10:02:32 +0000 Subject: [PATCH] Configurations: 'specification/webpubsub/resource-manager/Microsoft.SignalRService/SignalRService/tspconfig.yaml', API Version: 2025-01-01-preview, SDK Release Type: beta, and CommitSHA: 'aa822c9c01b9e83fbc8ad8ec4c308203a3c29287' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6034398 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../webpubsub/armwebpubsub/CHANGELOG.md | 36 + .../webpubsub/armwebpubsub/README.md | 2 +- .../webpubsub/armwebpubsub/autorest.md | 13 - .../webpubsub/armwebpubsub/build.go | 7 - .../webpubsub/armwebpubsub/client.go | 122 +- .../armwebpubsub/client_example_test.go | 1925 ++++++++++------- .../webpubsub/armwebpubsub/client_factory.go | 3 +- .../webpubsub/armwebpubsub/constants.go | 90 +- .../armwebpubsub/customcertificates_client.go | 38 +- .../customcertificates_client_example_test.go | 163 +- .../armwebpubsub/customdomains_client.go | 40 +- .../customdomains_client_example_test.go | 153 +- .../fake/customcertificates_server.go | 74 +- .../armwebpubsub/fake/customdomains_server.go | 80 +- .../armwebpubsub/fake/hubs_server.go | 104 +- .../webpubsub/armwebpubsub/fake/internal.go | 16 +- .../armwebpubsub/fake/operations_server.go | 54 +- .../fake/privateendpointconnections_server.go | 104 +- .../fake/privatelinkresources_server.go | 56 +- .../armwebpubsub/fake/replicas_server.go | 92 +- ...eplicasharedprivatelinkresources_server.go | 68 +- .../webpubsub/armwebpubsub/fake/server.go | 130 +- .../armwebpubsub/fake/server_factory.go | 74 +- .../fake/sharedprivatelinkresources_server.go | 104 +- .../armwebpubsub/fake/time_rfc3339.go | 107 - .../armwebpubsub/fake/usages_server.go | 56 +- .../webpubsub/armwebpubsub/go.mod | 12 +- .../webpubsub/armwebpubsub/go.sum | 20 +- .../webpubsub/armwebpubsub/hubs_client.go | 93 +- .../armwebpubsub/hubs_client_example_test.go | 351 +-- .../webpubsub/armwebpubsub/interfaces.go | 21 +- .../webpubsub/armwebpubsub/models.go | 414 +++- .../webpubsub/armwebpubsub/models_serde.go | 348 ++- .../armwebpubsub/operations_client.go | 18 +- .../operations_client_example_test.go | 43 +- .../webpubsub/armwebpubsub/options.go | 37 +- .../armwebpubsub/polymorphic_helpers.go | 91 +- .../privateendpointconnections_client.go | 84 +- ...endpointconnections_client_example_test.go | 226 +- .../privatelinkresources_client.go | 13 +- ...rivatelinkresources_client_example_test.go | 92 +- .../webpubsub/armwebpubsub/replicas_client.go | 62 +- .../replicas_client_example_test.go | 381 ++-- ...eplicasharedprivatelinkresources_client.go | 31 +- ...rivatelinkresources_client_example_test.go | 160 +- .../webpubsub/armwebpubsub/responses.go | 6 +- .../sharedprivatelinkresources_client.go | 93 +- ...rivatelinkresources_client_example_test.go | 177 +- .../armwebpubsub/testdata/_metadata.json | 6 + .../webpubsub/armwebpubsub/time_rfc3339.go | 107 - .../webpubsub/armwebpubsub/tsp-location.yaml | 4 + .../webpubsub/armwebpubsub/usages_client.go | 21 +- .../usages_client_example_test.go | 57 +- .../webpubsub/armwebpubsub/version.go | 10 + .../armwebpubsub/webpubsub_live_test.go | 2 +- 55 files changed, 3895 insertions(+), 2796 deletions(-) delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/build.go delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/testdata/_metadata.json delete mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go create mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/tsp-location.yaml create mode 100644 sdk/resourcemanager/webpubsub/armwebpubsub/version.go diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md index 31b07b9eb56e..934587219238 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md @@ -1,5 +1,41 @@ # Release History +## 2.0.0-beta.1 (2026-03-19) +### Breaking Changes + +- Function `*HubsClient.BeginCreateOrUpdate` parameter(s) have been changed from `(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, hubName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions)` +- Function `*HubsClient.BeginDelete` parameter(s) have been changed from `(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, hubName string, options *HubsClientBeginDeleteOptions)` +- Function `*HubsClient.Get` parameter(s) have been changed from `(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientGetOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, hubName string, options *HubsClientGetOptions)` +- Function `*PrivateEndpointConnectionsClient.BeginDelete` parameter(s) have been changed from `(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions)` +- Function `*PrivateEndpointConnectionsClient.Get` parameter(s) have been changed from `(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientGetOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions)` +- Function `*PrivateEndpointConnectionsClient.Update` parameter(s) have been changed from `(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions)` +- Function `*SharedPrivateLinkResourcesClient.BeginCreateOrUpdate` parameter(s) have been changed from `(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions)` +- Function `*SharedPrivateLinkResourcesClient.BeginDelete` parameter(s) have been changed from `(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions)` +- Function `*SharedPrivateLinkResourcesClient.Get` parameter(s) have been changed from `(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientGetOptions)` to `(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, options *SharedPrivateLinkResourcesClientGetOptions)` + +### Features Added + +- New enum type `ClientConnectionCountRuleDiscriminator` with values `ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule`, `ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule`, `ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule` +- New enum type `ClientTrafficControlRuleDiscriminator` with values `ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule`, `ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule`, `ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule` +- New function `*ClientConnectionCountRule.GetClientConnectionCountRule() *ClientConnectionCountRule` +- New function `*ClientTrafficControlRule.GetClientTrafficControlRule() *ClientTrafficControlRule` +- New function `*ThrottleByJwtCustomClaimRule.GetClientConnectionCountRule() *ClientConnectionCountRule` +- New function `*ThrottleByJwtSignatureRule.GetClientConnectionCountRule() *ClientConnectionCountRule` +- New function `*ThrottleByUserIDRule.GetClientConnectionCountRule() *ClientConnectionCountRule` +- New function `*TrafficThrottleByJwtCustomClaimRule.GetClientTrafficControlRule() *ClientTrafficControlRule` +- New function `*TrafficThrottleByJwtSignatureRule.GetClientTrafficControlRule() *ClientTrafficControlRule` +- New function `*TrafficThrottleByUserIDRule.GetClientTrafficControlRule() *ClientTrafficControlRule` +- New struct `ApplicationFirewallSettings` +- New struct `ThrottleByJwtCustomClaimRule` +- New struct `ThrottleByJwtSignatureRule` +- New struct `ThrottleByUserIDRule` +- New struct `TrafficThrottleByJwtCustomClaimRule` +- New struct `TrafficThrottleByJwtSignatureRule` +- New struct `TrafficThrottleByUserIDRule` +- New field `ApplicationFirewall` in struct `Properties` +- New field `Fqdns` in struct `SharedPrivateLinkResourceProperties` + + ## 1.3.0 (2024-09-25) ### Features Added diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/README.md b/sdk/resourcemanager/webpubsub/armwebpubsub/README.md index be5af806e2cf..9284ba9d94be 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/README.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Web PubSub module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md deleted file mode 100644 index f89402a0c8c2..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.3.0 -tag: package-2024-03-01 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/build.go b/sdk/resourcemanager/webpubsub/armwebpubsub/build.go deleted file mode 100644 index 0c737f4b9f1a..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -removeUnreferencedTypes resourcemanager/webpubsub/armwebpubsub - -package armwebpubsub diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go index 51cf6374791c..0610e670576a 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// Client contains the methods for the WebPubSub group. +// Client contains the methods for the service. // Don't use this type directly, use NewClient() instead. type Client struct { internal *arm.Client @@ -27,7 +26,7 @@ type Client struct { // NewClient creates a new instance of Client 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*Client, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,9 +42,9 @@ 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 2024-03-01 -// - location - the region -// - parameters - Parameters supplied to the operation. +// Generated from API version 2025-01-01-preview +// - location - The location name. +// - parameters - The request body // - 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) { var err error @@ -70,24 +69,25 @@ func (client *Client) CheckNameAvailability(ctx context.Context, location string } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, location string, parameters NameAvailabilityParameters, options *ClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, location string, parameters NameAvailabilityParameters, _ *ClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability" - if location == "" { - 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)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -106,7 +106,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-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 @@ -118,8 +118,7 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -132,7 +131,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginCreateOrUpdate" @@ -155,7 +154,7 @@ 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) { +func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, _ *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") @@ -174,9 +173,10 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -186,7 +186,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-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. @@ -197,8 +197,7 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -211,7 +210,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "Client.BeginDelete" @@ -234,7 +233,7 @@ 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) { +func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -253,16 +252,15 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get the resource and its properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -289,7 +287,7 @@ 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) { +func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -308,7 +306,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -325,7 +323,7 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // NewListByResourceGroupPager - Handles requests to list all resources in a resource group. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -353,7 +351,7 @@ 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) { +func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *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") @@ -368,7 +366,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +383,7 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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]{ @@ -411,7 +409,7 @@ func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscripti } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, options *ClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, _ *ClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/webPubSub" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -422,7 +420,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -440,7 +438,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-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. @@ -467,7 +465,7 @@ 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) { +func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -486,7 +484,7 @@ func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -504,7 +502,7 @@ func (client *Client) listKeysHandleResponse(resp *http.Response) (ClientListKey // ListReplicaSKUs - List all available skus of the replica resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -532,7 +530,7 @@ func (client *Client) ListReplicaSKUs(ctx context.Context, resourceGroupName str } // listReplicaSKUsCreateRequest creates the ListReplicaSKUs request. -func (client *Client) listReplicaSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ClientListReplicaSKUsOptions) (*policy.Request, error) { +func (client *Client) listReplicaSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, _ *ClientListReplicaSKUsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/skus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -555,7 +553,7 @@ func (client *Client) listReplicaSKUsCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -573,7 +571,7 @@ func (client *Client) listReplicaSKUsHandleResponse(resp *http.Response) (Client // ListSKUs - List all available skus of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -600,7 +598,7 @@ 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) { +func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -619,7 +617,7 @@ func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -638,7 +636,7 @@ func (client *Client) listSKUsHandleResponse(resp *http.Response) (ClientListSKU // same time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -650,8 +648,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRegenerateKeyResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -665,7 +662,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName // time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *Client) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRegenerateKey" @@ -688,7 +685,7 @@ 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) { +func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, _ *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") @@ -707,9 +704,10 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -719,7 +717,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-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. @@ -730,8 +728,7 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRestartResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -744,7 +741,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *Client) restart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRestart" @@ -767,7 +764,7 @@ 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) { +func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -786,16 +783,15 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // BeginUpdate - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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 @@ -807,8 +803,7 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -821,7 +816,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginUpdate" @@ -844,7 +839,7 @@ 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) { +func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, _ *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") @@ -863,9 +858,10 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go index 7174721113dc..cc1f5762b953 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go @@ -1,28 +1,25 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSub_CheckNameAvailability.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,448 +33,32 @@ func ExampleClient_CheckNameAvailability() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.NameAvailability = armwebpubsub.NameAvailability{ - // Message: to.Ptr("The name is already taken. Please try a different name."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr("AlreadyExists"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceInfoList = armwebpubsub.ResourceInfoList{ - // Value: []*armwebpubsub.ResourceInfo{ - // { - // Name: to.Ptr("myWebPubSubService"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // 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), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armwebpubsub.NetworkACL{ - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // 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), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // SocketIO: &armwebpubsub.SocketIOSettings{ - // ServiceMode: to.Ptr("Serverless"), - // }, - // TLS: &armwebpubsub.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), - // }, - // Version: to.Ptr("1.0"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceInfoList = armwebpubsub.ResourceInfoList{ - // Value: []*armwebpubsub.ResourceInfo{ - // { - // Name: to.Ptr("myWebPubSubService"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // 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), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armwebpubsub.NetworkACL{ - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // 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), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // SocketIO: &armwebpubsub.SocketIOSettings{ - // ServiceMode: to.Ptr("Serverless"), - // }, - // TLS: &armwebpubsub.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), - // }, - // Version: to.Ptr("1.0"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceInfo = armwebpubsub.ResourceInfo{ - // Name: to.Ptr("myWebPubSubService"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // res = armwebpubsub.ClientCheckNameAvailabilityResponse{ + // NameAvailability: &armwebpubsub.NameAvailability{ + // Message: to.Ptr("The name is already taken. Please try a different name."), + // NameAvailable: to.Ptr(false), + // Reason: to.Ptr("AlreadyExists"), // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // 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), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armwebpubsub.NetworkACL{ - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // 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), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // SocketIO: &armwebpubsub.SocketIOSettings{ - // ServiceMode: to.Ptr("Serverless"), - // }, - // TLS: &armwebpubsub.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), - // }, - // Version: to.Ptr("1.0"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, - // } + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSub_CreateOrUpdate.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewClient().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), }, - Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), + Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), + Location: to.Ptr("eastus"), Properties: &armwebpubsub.Properties{ DisableAADAuth: to.Ptr(false), DisableLocalAuth: to.Ptr(false), @@ -486,20 +67,24 @@ func ExampleClient_BeginCreateOrUpdate() { { Name: to.Ptr("ConnectivityLogs"), Enabled: to.Ptr("true"), - }}, + }, + }, Enabled: to.Ptr("false"), }, NetworkACLs: &armwebpubsub.NetworkACLs{ DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ { - Allow: []*armwebpubsub.WebPubSubRequestType{ - to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - }}, + Allow: []*armwebpubsub.WebPubSubRequestType{ + to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection), + }, + }, + }, PublicNetwork: &armwebpubsub.NetworkACL{ Allow: []*armwebpubsub.WebPubSubRequestType{ - to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, + to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection), + }, }, }, PublicNetworkAccess: to.Ptr("Enabled"), @@ -515,6 +100,9 @@ func ExampleClient_BeginCreateOrUpdate() { Capacity: to.Ptr[int32](1), Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), }, + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -526,129 +114,174 @@ func ExampleClient_BeginCreateOrUpdate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceInfo = armwebpubsub.ResourceInfo{ - // Name: to.Ptr("myWebPubSubService"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - // Categories: []*armwebpubsub.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), + // res = armwebpubsub.ClientCreateOrUpdateResponse{ + // ResourceInfo: &armwebpubsub.ResourceInfo{ + // Name: to.Ptr("myWebPubSubService"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // Identity: &armwebpubsub.ManagedIdentity{ + // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, - // NetworkACLs: &armwebpubsub.NetworkACLs{ - // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.Properties{ + // ApplicationFirewall: &armwebpubsub.ApplicationFirewallSettings{ + // ClientConnectionCountRules: []armwebpubsub.ClientConnectionCountRuleClassification{ + // &armwebpubsub.ThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule), + // ClaimName: to.Ptr("claimName"), + // MaxCount: to.Ptr[int32](20), + // }, // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), + // ClientTrafficControlRules: []armwebpubsub.ClientTrafficControlRuleClassification{ + // &armwebpubsub.TrafficThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // ClaimName: to.Ptr("claimName"), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, + // MaxClientConnectionLifetimeInSeconds: to.Ptr[int64](5), + // }, + // DisableAADAuth: to.Ptr(false), + // DisableLocalAuth: to.Ptr(false), + // ExternalIP: to.Ptr("10.0.0.1"), + // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), + // 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), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }, + // }, + // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ + // { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, + // Allow: []*armwebpubsub.WebPubSubRequestType{ + // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection), + // }, + // }, + // }, // PublicNetwork: &armwebpubsub.NetworkACL{ // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, + // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection), // }, // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ + // { + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), // }, - // 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), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // SocketIO: &armwebpubsub.SocketIOSettings{ - // ServiceMode: to.Ptr("Serverless"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // }, - // TLS: &armwebpubsub.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), + // }, + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Enabled"), + // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ + // Categories: []*armwebpubsub.ResourceLogCategory{ + // { + // Name: to.Ptr("ConnectivityLogs"), + // Enabled: to.Ptr("true"), + // }, // }, - // Version: to.Ptr("1.0"), // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // ResourceStopped: to.Ptr("false"), + // ServerPort: to.Ptr[int32](443), + // SocketIO: &armwebpubsub.SocketIOSettings{ + // ServiceMode: to.Ptr("Serverless"), + // }, + // TLS: &armwebpubsub.TLSSettings{ + // ClientCertEnabled: to.Ptr(true), // }, - // } + // Version: to.Ptr("1.0"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSub_Delete.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -656,253 +289,601 @@ func ExampleClient_BeginDelete() { if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.ClientDeleteResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSub_Update.json -func ExampleClient_BeginUpdate() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewClient().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), - }, - Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - 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), - PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - { - Allow: []*armwebpubsub.WebPubSubRequestType{ - to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - }}, - PublicNetwork: &armwebpubsub.NetworkACL{ - Allow: []*armwebpubsub.WebPubSubRequestType{ - to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - }, - }, - PublicNetworkAccess: to.Ptr("Enabled"), - SocketIO: &armwebpubsub.SocketIOSettings{ - ServiceMode: to.Ptr("Serverless"), - }, - 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) + res, err := clientFactory.NewClient().Get(ctx, "myResourceGroup", "myWebPubSubService", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceInfo = armwebpubsub.ResourceInfo{ - // Name: to.Ptr("myWebPubSubService"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - // Categories: []*armwebpubsub.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), + // res = armwebpubsub.ClientGetResponse{ + // ResourceInfo: &armwebpubsub.ResourceInfo{ + // Name: to.Ptr("myWebPubSubService"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // Identity: &armwebpubsub.ManagedIdentity{ + // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), // }, - // NetworkACLs: &armwebpubsub.NetworkACLs{ - // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.Properties{ + // ApplicationFirewall: &armwebpubsub.ApplicationFirewallSettings{ + // ClientConnectionCountRules: []armwebpubsub.ClientConnectionCountRuleClassification{ + // &armwebpubsub.ThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule), + // ClaimName: to.Ptr("claimName"), + // MaxCount: to.Ptr[int32](20), + // }, // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), + // ClientTrafficControlRules: []armwebpubsub.ClientTrafficControlRuleClassification{ + // &armwebpubsub.TrafficThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // ClaimName: to.Ptr("claimName"), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, + // MaxClientConnectionLifetimeInSeconds: to.Ptr[int64](5), + // }, + // DisableAADAuth: to.Ptr(false), + // DisableLocalAuth: to.Ptr(false), + // ExternalIP: to.Ptr("10.0.0.1"), + // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), + // 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), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }, + // }, + // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ + // { // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, + // Allow: []*armwebpubsub.WebPubSubRequestType{ + // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection), + // }, + // }, + // }, // PublicNetwork: &armwebpubsub.NetworkACL{ // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, + // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection), // }, // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ + // { + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), // }, - // 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), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // SocketIO: &armwebpubsub.SocketIOSettings{ - // ServiceMode: to.Ptr("Serverless"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, // }, - // TLS: &armwebpubsub.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), + // }, + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Enabled"), + // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ + // Categories: []*armwebpubsub.ResourceLogCategory{ + // { + // Name: to.Ptr("ConnectivityLogs"), + // Enabled: to.Ptr("true"), + // }, // }, - // Version: to.Ptr("1.0"), // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // ResourceStopped: to.Ptr("false"), + // ServerPort: to.Ptr[int32](443), + // SocketIO: &armwebpubsub.SocketIOSettings{ + // ServiceMode: to.Ptr("Serverless"), + // }, + // TLS: &armwebpubsub.TLSSettings{ + // ClientCertEnabled: to.Ptr(true), // }, - // } + // Version: to.Ptr("1.0"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSub_ListKeys.json -func ExampleClient_ListKeys() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewClient().ListKeys(ctx, "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) + pager := clientFactory.NewClient().NewListByResourceGroupPager("myResourceGroup", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.ClientListByResourceGroupResponse{ + // ResourceInfoList: armwebpubsub.ResourceInfoList{ + // Value: []*armwebpubsub.ResourceInfo{ + // { + // Name: to.Ptr("myWebPubSubService"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // Identity: &armwebpubsub.ManagedIdentity{ + // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.Properties{ + // ApplicationFirewall: &armwebpubsub.ApplicationFirewallSettings{ + // ClientConnectionCountRules: []armwebpubsub.ClientConnectionCountRuleClassification{ + // &armwebpubsub.ThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule), + // ClaimName: to.Ptr("claimName"), + // MaxCount: to.Ptr[int32](20), + // }, + // }, + // ClientTrafficControlRules: []armwebpubsub.ClientTrafficControlRuleClassification{ + // &armwebpubsub.TrafficThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // ClaimName: to.Ptr("claimName"), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // }, + // MaxClientConnectionLifetimeInSeconds: to.Ptr[int64](5), + // }, + // DisableAADAuth: to.Ptr(false), + // DisableLocalAuth: to.Ptr(false), + // ExternalIP: to.Ptr("10.0.0.1"), + // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), + // 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), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }, + // }, + // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ + // { + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Allow: []*armwebpubsub.WebPubSubRequestType{ + // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection), + // }, + // }, + // }, + // PublicNetwork: &armwebpubsub.NetworkACL{ + // Allow: []*armwebpubsub.WebPubSubRequestType{ + // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection), + // }, + // }, + // }, + // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ + // { + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // 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), + // }, + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Enabled"), + // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ + // Categories: []*armwebpubsub.ResourceLogCategory{ + // { + // Name: to.Ptr("ConnectivityLogs"), + // Enabled: to.Ptr("true"), + // }, + // }, + // }, + // ResourceStopped: to.Ptr("false"), + // ServerPort: to.Ptr[int32](443), + // SocketIO: &armwebpubsub.SocketIOSettings{ + // ServiceMode: to.Ptr("Serverless"), + // }, + // TLS: &armwebpubsub.TLSSettings{ + // ClientCertEnabled: to.Ptr(true), + // }, + // Version: to.Ptr("1.0"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // }, + // }, + // }, + // } } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Keys = armwebpubsub.Keys{ - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSub_RegenerateKey.json -func ExampleClient_BeginRegenerateKey() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewClient().BeginRegenerateKey(ctx, "myResourceGroup", "myWebPubSubService", armwebpubsub.RegenerateKeyParameters{ - KeyType: to.Ptr(armwebpubsub.KeyTypePrimary), - }, nil) + pager := clientFactory.NewClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.ClientListBySubscriptionResponse{ + // ResourceInfoList: armwebpubsub.ResourceInfoList{ + // Value: []*armwebpubsub.ResourceInfo{ + // { + // Name: to.Ptr("myWebPubSubService"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // Identity: &armwebpubsub.ManagedIdentity{ + // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.Properties{ + // ApplicationFirewall: &armwebpubsub.ApplicationFirewallSettings{ + // ClientConnectionCountRules: []armwebpubsub.ClientConnectionCountRuleClassification{ + // &armwebpubsub.ThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule), + // ClaimName: to.Ptr("claimName"), + // MaxCount: to.Ptr[int32](20), + // }, + // }, + // ClientTrafficControlRules: []armwebpubsub.ClientTrafficControlRuleClassification{ + // &armwebpubsub.TrafficThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // ClaimName: to.Ptr("claimName"), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // }, + // MaxClientConnectionLifetimeInSeconds: to.Ptr[int64](5), + // }, + // DisableAADAuth: to.Ptr(false), + // DisableLocalAuth: to.Ptr(false), + // ExternalIP: to.Ptr("10.0.0.1"), + // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), + // 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), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }, + // }, + // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ + // { + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Allow: []*armwebpubsub.WebPubSubRequestType{ + // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection), + // }, + // }, + // }, + // PublicNetwork: &armwebpubsub.NetworkACL{ + // Allow: []*armwebpubsub.WebPubSubRequestType{ + // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection), + // }, + // }, + // }, + // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ + // { + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // 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), + // }, + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Enabled"), + // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ + // Categories: []*armwebpubsub.ResourceLogCategory{ + // { + // Name: to.Ptr("ConnectivityLogs"), + // Enabled: to.Ptr("true"), + // }, + // }, + // }, + // ResourceStopped: to.Ptr("false"), + // ServerPort: to.Ptr[int32](443), + // SocketIO: &armwebpubsub.SocketIOSettings{ + // ServiceMode: to.Ptr("Serverless"), + // }, + // TLS: &armwebpubsub.TLSSettings{ + // ClientCertEnabled: to.Ptr(true), + // }, + // Version: to.Ptr("1.0"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-01-01-preview/WebPubSub_ListKeys.json +func ExampleClient_ListKeys() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to finish the request: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewClient().ListKeys(ctx, "myResourceGroup", "myWebPubSubService", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Keys = armwebpubsub.Keys{ + // res = armwebpubsub.ClientListKeysResponse{ + // Keys: &armwebpubsub.Keys{ + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSub_ListReplicaSkus.json +// Generated from example definition: 2025-01-01-preview/WebPubSub_ListReplicaSkus.json func ExampleClient_ListReplicaSKUs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -913,13 +894,15 @@ func ExampleClient_ListReplicaSKUs() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SKUList = armwebpubsub.SKUList{ - // Value: []*armwebpubsub.SKU{ - // { - // Capacity: &armwebpubsub.SKUCapacity{ - // Default: to.Ptr[int32](1), - // AllowedValues: []*int32{ - // to.Ptr[int32](1)}, + // res = armwebpubsub.ClientListReplicaSKUsResponse{ + // SKUList: &armwebpubsub.SKUList{ + // Value: []*armwebpubsub.SKU{ + // { + // Capacity: &armwebpubsub.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // }, // Maximum: to.Ptr[int32](1), // Minimum: to.Ptr[int32](0), // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), @@ -952,82 +935,65 @@ func ExampleClient_ListReplicaSKUs() { // to.Ptr[int32](70), // to.Ptr[int32](80), // to.Ptr[int32](90), - // to.Ptr[int32](100)}, - // Maximum: to.Ptr[int32](100), - // Minimum: to.Ptr[int32](0), - // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), + // to.Ptr[int32](100), // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Standard_S1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Standard_S1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // }, + // }, + // { + // Capacity: &armwebpubsub.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), + // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), + // to.Ptr[int32](10), + // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), + // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), + // to.Ptr[int32](100), // }, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeAutomatic), // }, - // { - // Capacity: &armwebpubsub.SKUCapacity{ - // Default: to.Ptr[int32](1), - // AllowedValues: []*int32{ - // to.Ptr[int32](1), - // to.Ptr[int32](2), - // to.Ptr[int32](3), - // to.Ptr[int32](4), - // to.Ptr[int32](5), - // to.Ptr[int32](6), - // to.Ptr[int32](7), - // to.Ptr[int32](8), - // to.Ptr[int32](9), - // to.Ptr[int32](10), - // to.Ptr[int32](20), - // to.Ptr[int32](30), - // to.Ptr[int32](40), - // to.Ptr[int32](50), - // to.Ptr[int32](60), - // to.Ptr[int32](70), - // to.Ptr[int32](80), - // to.Ptr[int32](90), - // to.Ptr[int32](100)}, - // Maximum: to.Ptr[int32](100), - // Minimum: to.Ptr[int32](0), - // ScaleType: to.Ptr(armwebpubsub.ScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().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) - } + // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // }, + // }, + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSub_ListSkus.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -1038,13 +1004,15 @@ func ExampleClient_ListSKUs() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SKUList = armwebpubsub.SKUList{ - // Value: []*armwebpubsub.SKU{ - // { - // Capacity: &armwebpubsub.SKUCapacity{ - // Default: to.Ptr[int32](1), - // AllowedValues: []*int32{ - // to.Ptr[int32](1)}, + // res = armwebpubsub.ClientListSKUsResponse{ + // SKUList: &armwebpubsub.SKUList{ + // Value: []*armwebpubsub.SKU{ + // { + // Capacity: &armwebpubsub.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // }, // Maximum: to.Ptr[int32](1), // Minimum: to.Ptr[int32](0), // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), @@ -1077,49 +1045,336 @@ func ExampleClient_ListSKUs() { // to.Ptr[int32](70), // to.Ptr[int32](80), // to.Ptr[int32](90), - // to.Ptr[int32](100)}, - // Maximum: to.Ptr[int32](100), - // Minimum: to.Ptr[int32](0), - // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), + // to.Ptr[int32](100), + // }, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeManual), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Standard_S1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // }, + // }, + // { + // Capacity: &armwebpubsub.SKUCapacity{ + // Default: to.Ptr[int32](1), + // AllowedValues: []*int32{ + // to.Ptr[int32](1), + // to.Ptr[int32](2), + // to.Ptr[int32](3), + // to.Ptr[int32](4), + // to.Ptr[int32](5), + // to.Ptr[int32](6), + // to.Ptr[int32](7), + // to.Ptr[int32](8), + // to.Ptr[int32](9), + // to.Ptr[int32](10), + // to.Ptr[int32](20), + // to.Ptr[int32](30), + // to.Ptr[int32](40), + // to.Ptr[int32](50), + // to.Ptr[int32](60), + // to.Ptr[int32](70), + // to.Ptr[int32](80), + // to.Ptr[int32](90), + // to.Ptr[int32](100), + // }, + // Maximum: to.Ptr[int32](100), + // Minimum: to.Ptr[int32](0), + // ScaleType: to.Ptr(armwebpubsub.ScaleTypeAutomatic), + // }, + // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-01-preview/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() + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClient().BeginRegenerateKey(ctx, "myResourceGroup", "myWebPubSubService", armwebpubsub.RegenerateKeyParameters{ + KeyType: to.Ptr(armwebpubsub.KeyTypePrimary), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.ClientRegenerateKeyResponse{ + // Keys: &armwebpubsub.Keys{ + // }, + // } +} + +// Generated from example definition: 2025-01-01-preview/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() + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClient().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: 2025-01-01-preview/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() + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewClient().BeginUpdate(ctx, "myResourceGroup", "myWebPubSubService", armwebpubsub.ResourceInfo{ + Identity: &armwebpubsub.ManagedIdentity{ + Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), + }, + Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), + Location: to.Ptr("eastus"), + 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), + PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ + { + Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + Allow: []*armwebpubsub.WebPubSubRequestType{ + to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection), + }, + }, + }, + PublicNetwork: &armwebpubsub.NetworkACL{ + Allow: []*armwebpubsub.WebPubSubRequestType{ + to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection), + }, + }, + }, + PublicNetworkAccess: to.Ptr("Enabled"), + SocketIO: &armwebpubsub.SocketIOSettings{ + ServiceMode: to.Ptr("Serverless"), + }, + 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), + }, + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.ClientUpdateResponse{ + // ResourceInfo: &armwebpubsub.ResourceInfo{ + // Name: to.Ptr("myWebPubSubService"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), + // Identity: &armwebpubsub.ManagedIdentity{ + // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.Properties{ + // ApplicationFirewall: &armwebpubsub.ApplicationFirewallSettings{ + // ClientConnectionCountRules: []armwebpubsub.ClientConnectionCountRuleClassification{ + // &armwebpubsub.ThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule), + // MaxCount: to.Ptr[int32](20), + // }, + // &armwebpubsub.ThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule), + // ClaimName: to.Ptr("claimName"), + // MaxCount: to.Ptr[int32](20), + // }, + // }, + // ClientTrafficControlRules: []armwebpubsub.ClientTrafficControlRuleClassification{ + // &armwebpubsub.TrafficThrottleByJwtSignatureRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByUserIDRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // &armwebpubsub.TrafficThrottleByJwtCustomClaimRule{ + // Type: to.Ptr(armwebpubsub.ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule), + // AggregationWindowInSeconds: to.Ptr[int32](60), + // ClaimName: to.Ptr("claimName"), + // MaxInboundMessageBytes: to.Ptr[int64](1073741824), + // }, + // }, + // MaxClientConnectionLifetimeInSeconds: to.Ptr[int64](5), + // }, + // DisableAADAuth: to.Ptr(false), + // DisableLocalAuth: to.Ptr(false), + // ExternalIP: to.Ptr("10.0.0.1"), + // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), + // 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), + // IPRules: []*armwebpubsub.IPRule{ + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123/24"), // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Standard_S1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("123.456.789.123"), + // }, + // { + // Action: to.Ptr(armwebpubsub.ACLActionAllow), + // Value: to.Ptr("AppService"), + // }, + // }, + // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ + // { + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Allow: []*armwebpubsub.WebPubSubRequestType{ + // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection), + // }, // }, // }, + // PublicNetwork: &armwebpubsub.NetworkACL{ + // Allow: []*armwebpubsub.WebPubSubRequestType{ + // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection), + // }, + // }, + // }, + // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ // { - // Capacity: &armwebpubsub.SKUCapacity{ - // Default: to.Ptr[int32](1), - // AllowedValues: []*int32{ - // to.Ptr[int32](1), - // to.Ptr[int32](2), - // to.Ptr[int32](3), - // to.Ptr[int32](4), - // to.Ptr[int32](5), - // to.Ptr[int32](6), - // to.Ptr[int32](7), - // to.Ptr[int32](8), - // to.Ptr[int32](9), - // to.Ptr[int32](10), - // to.Ptr[int32](20), - // to.Ptr[int32](30), - // to.Ptr[int32](40), - // to.Ptr[int32](50), - // to.Ptr[int32](60), - // to.Ptr[int32](70), - // to.Ptr[int32](80), - // to.Ptr[int32](90), - // to.Ptr[int32](100)}, - // Maximum: to.Ptr[int32](100), - // Minimum: to.Ptr[int32](0), - // ScaleType: to.Ptr(armwebpubsub.ScaleTypeAutomatic), + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierStandard), + // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ + // ActionsRequired: to.Ptr("None"), + // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), // }, - // }}, - // } + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // PublicNetworkAccess: to.Ptr("Enabled"), + // PublicPort: to.Ptr[int32](443), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ + // Categories: []*armwebpubsub.ResourceLogCategory{ + // { + // Name: to.Ptr("ConnectivityLogs"), + // Enabled: to.Ptr("true"), + // }, + // }, + // }, + // ResourceStopped: to.Ptr("false"), + // ServerPort: to.Ptr[int32](443), + // SocketIO: &armwebpubsub.SocketIOSettings{ + // ServiceMode: to.Ptr("Serverless"), + // }, + // TLS: &armwebpubsub.TLSSettings{ + // ClientCertEnabled: to.Ptr(true), + // }, + // Version: to.Ptr("1.0"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go index ac6aee46c9a5..c6435b2c2413 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go index 68ba72789276..b547edb32476 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go @@ -1,15 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub -const ( - moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" - moduleVersion = "v1.3.0" -) - // ACLAction - Azure Networking ACL Action. type ACLAction string @@ -26,14 +20,52 @@ func PossibleACLActionValues() []ACLAction { } } -// CreatedByType - The type of identity that created the resource. +type ClientConnectionCountRuleDiscriminator string + +const ( + ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule ClientConnectionCountRuleDiscriminator = "ThrottleByJwtCustomClaimRule" + ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule ClientConnectionCountRuleDiscriminator = "ThrottleByJwtSignatureRule" + ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule ClientConnectionCountRuleDiscriminator = "ThrottleByUserIdRule" +) + +// PossibleClientConnectionCountRuleDiscriminatorValues returns the possible values for the ClientConnectionCountRuleDiscriminator const type. +func PossibleClientConnectionCountRuleDiscriminatorValues() []ClientConnectionCountRuleDiscriminator { + return []ClientConnectionCountRuleDiscriminator{ + ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule, + ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule, + ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule, + } +} + +type ClientTrafficControlRuleDiscriminator string + +const ( + ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule ClientTrafficControlRuleDiscriminator = "TrafficThrottleByJwtCustomClaimRule" + ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule ClientTrafficControlRuleDiscriminator = "TrafficThrottleByJwtSignatureRule" + ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule ClientTrafficControlRuleDiscriminator = "TrafficThrottleByUserIdRule" +) + +// PossibleClientTrafficControlRuleDiscriminatorValues returns the possible values for the ClientTrafficControlRuleDiscriminator const type. +func PossibleClientTrafficControlRuleDiscriminatorValues() []ClientTrafficControlRuleDiscriminator { + return []ClientTrafficControlRuleDiscriminator{ + ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule, + ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule, + ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule, + } +} + +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -133,15 +165,23 @@ func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConn type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateCanceled - Resource provisioning was canceled + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Resource is being created + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting - Resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource provisioning failed + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateRunning - Resource provisioning is running + ProvisioningStateRunning ProvisioningState = "Running" + // ProvisioningStateSucceeded - Resource successfully provisioned ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUnknown ProvisioningState = "Unknown" - ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateUnknown - Unknown provisioning state + ProvisioningStateUnknown ProvisioningState = "Unknown" + // ProvisioningStateUpdating - Resource is being updated + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. @@ -252,13 +292,17 @@ func PossibleWebPubSubRequestTypeValues() []WebPubSubRequestType { } // WebPubSubSKUTier - Optional tier of this particular SKU. 'Standard' or 'Free'. -// Basic is deprecated, use Standard instead. +// `Basic` is deprecated, use `Standard` instead. type WebPubSubSKUTier string const ( - WebPubSubSKUTierBasic WebPubSubSKUTier = "Basic" - WebPubSubSKUTierFree WebPubSubSKUTier = "Free" - WebPubSubSKUTierPremium WebPubSubSKUTier = "Premium" + // WebPubSubSKUTierBasic - Basic tier for WebPubSub service (deprecated, use Standard instead) + WebPubSubSKUTierBasic WebPubSubSKUTier = "Basic" + // WebPubSubSKUTierFree - Free tier for WebPubSub service + WebPubSubSKUTierFree WebPubSubSKUTier = "Free" + // WebPubSubSKUTierPremium - Premium tier for WebPubSub service + WebPubSubSKUTierPremium WebPubSubSKUTier = "Premium" + // WebPubSubSKUTierStandard - Standard tier for WebPubSub service WebPubSubSKUTierStandard WebPubSubSKUTier = "Standard" ) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go index 5745b98222f7..8a8fa08c8115 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// CustomCertificatesClient contains the methods for the WebPubSubCustomCertificates group. +// CustomCertificatesClient contains the methods for the CustomCertificates group. // Don't use this type directly, use NewCustomCertificatesClient() instead. type CustomCertificatesClient struct { internal *arm.Client @@ -27,7 +26,7 @@ type CustomCertificatesClient struct { // NewCustomCertificatesClient creates a new instance of CustomCertificatesClient 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewCustomCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomCertificatesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -56,8 +55,7 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomCertificatesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -70,7 +68,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *CustomCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, options *CustomCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomCertificatesClient.BeginCreateOrUpdate" @@ -93,7 +91,7 @@ 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) { +func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, _ *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") @@ -116,9 +114,10 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -128,7 +127,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -156,7 +155,7 @@ 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) { +func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, _ *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") @@ -179,16 +178,15 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -216,7 +214,7 @@ 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) { +func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, _ *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") @@ -239,7 +237,7 @@ func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,7 +254,7 @@ func (client *CustomCertificatesClient) getHandleResponse(resp *http.Response) ( // NewListPager - List all custom certificates. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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 @@ -285,7 +283,7 @@ 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) { +func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -304,7 +302,7 @@ func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 index 45176baaa646..2a8b32483cb4 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go @@ -1,144 +1,153 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubCustomCertificates_List.json -func ExampleCustomCertificatesClient_NewListPager() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewCustomCertificatesClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomCertificateList = armwebpubsub.CustomCertificateList{ - // Value: []*armwebpubsub.CustomCertificate{ - // { - // Name: to.Ptr("myCert"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/customCertificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customCertificates/myCert"), - // Properties: &armwebpubsub.CustomCertificateProperties{ - // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), - // KeyVaultSecretName: to.Ptr("mycert"), - // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // } + poller, err := clientFactory.NewCustomCertificatesClient().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) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.CustomCertificatesClientCreateOrUpdateResponse{ + // CustomCertificate: &armwebpubsub.CustomCertificate{ + // Name: to.Ptr("myCert"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/customCertificates"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customCertificates/myCert"), + // Properties: &armwebpubsub.CustomCertificateProperties{ + // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), + // KeyVaultSecretName: to.Ptr("mycert"), + // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubCustomCertificates_Get.json -func ExampleCustomCertificatesClient_Get() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCustomCertificatesClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "myCert", nil) + res, err := clientFactory.NewCustomCertificatesClient().Delete(ctx, "myResourceGroup", "myWebPubSubService", "myCert", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomCertificate = armwebpubsub.CustomCertificate{ - // Name: to.Ptr("myCert"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/customCertificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customCertificates/myCert"), - // Properties: &armwebpubsub.CustomCertificateProperties{ - // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), - // KeyVaultSecretName: to.Ptr("mycert"), - // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, + // res = armwebpubsub.CustomCertificatesClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubCustomCertificates_CreateOrUpdate.json -func ExampleCustomCertificatesClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewCustomCertificatesClient().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) + res, err := clientFactory.NewCustomCertificatesClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "myCert", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomCertificate = armwebpubsub.CustomCertificate{ - // Name: to.Ptr("myCert"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/customCertificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customCertificates/myCert"), - // Properties: &armwebpubsub.CustomCertificateProperties{ - // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), - // KeyVaultSecretName: to.Ptr("mycert"), - // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // res = armwebpubsub.CustomCertificatesClientGetResponse{ + // CustomCertificate: &armwebpubsub.CustomCertificate{ + // Name: to.Ptr("myCert"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/customCertificates"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customCertificates/myCert"), + // Properties: &armwebpubsub.CustomCertificateProperties{ + // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), + // KeyVaultSecretName: to.Ptr("mycert"), + // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubCustomCertificates_Delete.json -func ExampleCustomCertificatesClient_Delete() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewCustomCertificatesClient().Delete(ctx, "myResourceGroup", "myWebPubSubService", "myCert", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) + pager := clientFactory.NewCustomCertificatesClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.CustomCertificatesClientListResponse{ + // CustomCertificateList: armwebpubsub.CustomCertificateList{ + // Value: []*armwebpubsub.CustomCertificate{ + // { + // Name: to.Ptr("myCert"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/customCertificates"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customCertificates/myCert"), + // Properties: &armwebpubsub.CustomCertificateProperties{ + // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), + // KeyVaultSecretName: to.Ptr("mycert"), + // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go index 5274a930e486..8c8d76f46ea3 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// CustomDomainsClient contains the methods for the WebPubSubCustomDomains group. +// CustomDomainsClient contains the methods for the CustomDomains group. // Don't use this type directly, use NewCustomDomainsClient() instead. type CustomDomainsClient struct { internal *arm.Client @@ -27,7 +26,7 @@ type CustomDomainsClient struct { // NewCustomDomainsClient creates a new instance of CustomDomainsClient 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomDomainsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -70,7 +69,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *CustomDomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, options *CustomDomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginCreateOrUpdate" @@ -93,7 +92,7 @@ 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) { +func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, _ *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") @@ -116,9 +115,10 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -128,7 +128,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -141,8 +141,7 @@ func (client *CustomDomainsClient) BeginDelete(ctx context.Context, resourceGrou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomDomainsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -155,7 +154,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *CustomDomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginDelete" @@ -178,7 +177,7 @@ 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) { +func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, name string, _ *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") @@ -201,16 +200,15 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -238,7 +236,7 @@ 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) { +func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, name string, _ *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") @@ -261,7 +259,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +276,7 @@ func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (Custo // NewListPager - List all custom domains. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -306,7 +304,7 @@ 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) { +func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -325,7 +323,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 index be6cad3e78b6..569818755ebc 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go @@ -1,135 +1,142 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubCustomDomains_List.json -func ExampleCustomDomainsClient_NewListPager() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewCustomDomainsClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomDomainList = armwebpubsub.CustomDomainList{ - // Value: []*armwebpubsub.CustomDomain{ - // { - // Name: to.Ptr("myDomain"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customDomains/myDomain"), - // 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"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // } + poller, err := clientFactory.NewCustomDomainsClient().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/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubCustomDomains_Get.json -func ExampleCustomDomainsClient_Get() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCustomDomainsClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "example", nil) + poller, err := clientFactory.NewCustomDomainsClient().BeginDelete(ctx, "myResourceGroup", "myWebPubSubService", "example", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomDomain = armwebpubsub.CustomDomain{ - // Name: to.Ptr("myDomain"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customDomains/myDomain"), - // 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"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, + // res = armwebpubsub.CustomDomainsClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubCustomDomains_CreateOrUpdate.json -func ExampleCustomDomainsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewCustomDomainsClient().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) + res, err := clientFactory.NewCustomDomainsClient().Get(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) - } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.CustomDomainsClientGetResponse{ + // CustomDomain: &armwebpubsub.CustomDomain{ + // Name: to.Ptr("myDomain"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customDomains/myDomain"), + // 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"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubCustomDomains_Delete.json -func ExampleCustomDomainsClient_BeginDelete() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewCustomDomainsClient().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) + pager := clientFactory.NewCustomDomainsClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.CustomDomainsClientListResponse{ + // CustomDomainList: armwebpubsub.CustomDomainList{ + // Value: []*armwebpubsub.CustomDomain{ + // { + // Name: to.Ptr("myDomain"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/customDomains/myDomain"), + // 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"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/customcertificates_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/customcertificates_server.go index e37f91d23426..4dde5aa3f0bf 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/customcertificates_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/customcertificates_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -65,27 +64,46 @@ func (c *CustomCertificatesServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CustomCertificatesClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CustomCertificatesClient.Delete": - resp, err = c.dispatchDelete(req) - case "CustomCertificatesClient.Get": - resp, err = c.dispatchGet(req) - case "CustomCertificatesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CustomCertificatesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if customCertificatesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = customCertificatesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CustomCertificatesClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CustomCertificatesClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "CustomCertificatesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CustomCertificatesClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CustomCertificatesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -97,7 +115,7 @@ func (c *CustomCertificatesServerTransport) dispatchBeginCreateOrUpdate(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/customCertificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.CustomCertificate](req) @@ -147,7 +165,7 @@ func (c *CustomCertificatesServerTransport) dispatchDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/customCertificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -184,7 +202,7 @@ func (c *CustomCertificatesServerTransport) dispatchGet(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/customCertificates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +241,7 @@ func (c *CustomCertificatesServerTransport) dispatchNewListPager(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/customCertificates` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -254,3 +272,9 @@ func (c *CustomCertificatesServerTransport) dispatchNewListPager(req *http.Reque } return resp, nil } + +// set this to conditionally intercept incoming requests to CustomCertificatesServerTransport +var customCertificatesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/customdomains_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/customdomains_server.go index 4e03eac124f8..0c327ffba194 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/customdomains_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/customdomains_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -22,7 +21,7 @@ import ( // CustomDomainsServer is a fake server for instances of the armwebpubsub.CustomDomainsClient type. type CustomDomainsServer struct { // BeginCreateOrUpdate is the fake for method CustomDomainsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusCreated + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters armwebpubsub.CustomDomain, options *armwebpubsub.CustomDomainsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armwebpubsub.CustomDomainsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CustomDomainsClient.BeginDelete @@ -67,27 +66,46 @@ func (c *CustomDomainsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CustomDomainsClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CustomDomainsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CustomDomainsClient.Get": - resp, err = c.dispatchGet(req) - case "CustomDomainsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CustomDomainsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if customDomainsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = customDomainsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CustomDomainsClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CustomDomainsClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CustomDomainsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CustomDomainsClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CustomDomainsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -99,7 +117,7 @@ func (c *CustomDomainsServerTransport) dispatchBeginCreateOrUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/customDomains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.CustomDomain](req) @@ -131,9 +149,9 @@ func (c *CustomDomainsServerTransport) dispatchBeginCreateOrUpdate(req *http.Req return nil, err } - if !contains([]int{http.StatusCreated}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { c.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusCreated", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } if !server.PollerResponderMore(beginCreateOrUpdate) { c.beginCreateOrUpdate.remove(req) @@ -151,7 +169,7 @@ func (c *CustomDomainsServerTransport) dispatchBeginDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/customDomains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -197,7 +215,7 @@ func (c *CustomDomainsServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/customDomains/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -236,7 +254,7 @@ func (c *CustomDomainsServerTransport) dispatchNewListPager(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/customDomains` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -267,3 +285,9 @@ func (c *CustomDomainsServerTransport) dispatchNewListPager(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to CustomDomainsServerTransport +var customDomainsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/hubs_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/hubs_server.go index bceea4f0774d..1097361feea1 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/hubs_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/hubs_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -23,15 +22,15 @@ import ( type HubsServer struct { // BeginCreateOrUpdate is the fake for method HubsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters armwebpubsub.Hub, options *armwebpubsub.HubsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armwebpubsub.HubsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, hubName string, parameters armwebpubsub.Hub, options *armwebpubsub.HubsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armwebpubsub.HubsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method HubsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *armwebpubsub.HubsClientBeginDeleteOptions) (resp azfake.PollerResponder[armwebpubsub.HubsClientDeleteResponse], errResp azfake.ErrorResponder) + BeginDelete func(ctx context.Context, resourceGroupName string, resourceName string, hubName string, options *armwebpubsub.HubsClientBeginDeleteOptions) (resp azfake.PollerResponder[armwebpubsub.HubsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method HubsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *armwebpubsub.HubsClientGetOptions) (resp azfake.Responder[armwebpubsub.HubsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, resourceName string, hubName string, options *armwebpubsub.HubsClientGetOptions) (resp azfake.Responder[armwebpubsub.HubsClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method HubsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK @@ -67,27 +66,46 @@ func (h *HubsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return h.dispatchToMethodFake(req, method) +} - switch method { - case "HubsClient.BeginCreateOrUpdate": - resp, err = h.dispatchBeginCreateOrUpdate(req) - case "HubsClient.BeginDelete": - resp, err = h.dispatchBeginDelete(req) - case "HubsClient.Get": - resp, err = h.dispatchGet(req) - case "HubsClient.NewListPager": - resp, err = h.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (h *HubsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if hubsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = hubsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "HubsClient.BeginCreateOrUpdate": + res.resp, res.err = h.dispatchBeginCreateOrUpdate(req) + case "HubsClient.BeginDelete": + res.resp, res.err = h.dispatchBeginDelete(req) + case "HubsClient.Get": + res.resp, res.err = h.dispatchGet(req) + case "HubsClient.NewListPager": + res.resp, res.err = h.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (h *HubsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -99,26 +117,26 @@ func (h *HubsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hubs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.Hub](req) if err != nil { return nil, err } - hubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hubName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + hubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hubName")]) if err != nil { return nil, err } - respr, errRespr := h.srv.BeginCreateOrUpdate(req.Context(), hubNameParam, resourceGroupNameParam, resourceNameParam, body, nil) + respr, errRespr := h.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, hubNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -151,22 +169,22 @@ func (h *HubsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hubs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - hubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hubName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + hubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hubName")]) if err != nil { return nil, err } - respr, errRespr := h.srv.BeginDelete(req.Context(), hubNameParam, resourceGroupNameParam, resourceNameParam, nil) + respr, errRespr := h.srv.BeginDelete(req.Context(), resourceGroupNameParam, resourceNameParam, hubNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -197,22 +215,22 @@ func (h *HubsServerTransport) dispatchGet(req *http.Request) (*http.Response, er const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hubs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - hubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hubName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + hubNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hubName")]) if err != nil { return nil, err } - respr, errRespr := h.srv.Get(req.Context(), hubNameParam, resourceGroupNameParam, resourceNameParam, nil) + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, hubNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -236,7 +254,7 @@ func (h *HubsServerTransport) dispatchNewListPager(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/hubs` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -267,3 +285,9 @@ func (h *HubsServerTransport) dispatchNewListPager(req *http.Request) (*http.Res } return resp, nil } + +// set this to conditionally intercept incoming requests to HubsServerTransport +var hubsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/internal.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/internal.go index a56f57fc156d..d9ae2e5818f8 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/internal.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/internal.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -11,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -28,6 +32,14 @@ func contains[T comparable](s []T, v T) bool { return false } +func initServer[T any](mu *sync.Mutex, dst **T, src func() *T) { + mu.Lock() + if *dst == nil { + *dst = src() + } + mu.Unlock() +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/operations_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/operations_server.go index 43def1c495f9..ee21f26f84cb 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/operations_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/operations_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,7 +11,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" ) @@ -48,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -91,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/privateendpointconnections_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/privateendpointconnections_server.go index 75e58b10767c..03f5e5df06c2 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/privateendpointconnections_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -23,11 +22,11 @@ import ( type PrivateEndpointConnectionsServer struct { // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *armwebpubsub.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armwebpubsub.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + BeginDelete func(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *armwebpubsub.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armwebpubsub.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PrivateEndpointConnectionsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *armwebpubsub.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armwebpubsub.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *armwebpubsub.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armwebpubsub.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method PrivateEndpointConnectionsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK @@ -35,7 +34,7 @@ type PrivateEndpointConnectionsServer struct { // Update is the fake for method PrivateEndpointConnectionsClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, parameters armwebpubsub.PrivateEndpointConnection, options *armwebpubsub.PrivateEndpointConnectionsClientUpdateOptions) (resp azfake.Responder[armwebpubsub.PrivateEndpointConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters armwebpubsub.PrivateEndpointConnection, options *armwebpubsub.PrivateEndpointConnectionsClientUpdateOptions) (resp azfake.Responder[armwebpubsub.PrivateEndpointConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. @@ -65,27 +64,46 @@ func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "PrivateEndpointConnectionsClient.Update": - resp, err = p.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateEndpointConnectionsClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { @@ -97,22 +115,22 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) if err != nil { return nil, err } - respr, errRespr := p.srv.BeginDelete(req.Context(), privateEndpointConnectionNameParam, resourceGroupNameParam, resourceNameParam, nil) + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, resourceNameParam, privateEndpointConnectionNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -143,22 +161,22 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) if err != nil { return nil, err } - respr, errRespr := p.srv.Get(req.Context(), privateEndpointConnectionNameParam, resourceGroupNameParam, resourceNameParam, nil) + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, privateEndpointConnectionNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -182,7 +200,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,26 +239,26 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.PrivateEndpointConnection](req) if err != nil { return nil, err } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) if err != nil { return nil, err } - respr, errRespr := p.srv.Update(req.Context(), privateEndpointConnectionNameParam, resourceGroupNameParam, resourceNameParam, body, nil) + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, resourceNameParam, privateEndpointConnectionNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -254,3 +272,9 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchUpdate(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/privatelinkresources_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/privatelinkresources_server.go index 3daacc50ddf6..a6d1f7c265cf 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/privatelinkresources_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/privatelinkresources_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,7 +11,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -50,21 +49,40 @@ func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PrivateLinkResourcesClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -76,7 +94,7 @@ func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -107,3 +125,9 @@ func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicas_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicas_server.go index 9ba22549cf9a..534336aa4fc7 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicas_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicas_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -38,7 +37,7 @@ type ReplicasServer struct { NewListPager func(resourceGroupName string, resourceName string, options *armwebpubsub.ReplicasClientListOptions) (resp azfake.PagerResponder[armwebpubsub.ReplicasClientListResponse]) // BeginRestart is the fake for method ReplicasClient.BeginRestart - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRestart func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *armwebpubsub.ReplicasClientBeginRestartOptions) (resp azfake.PollerResponder[armwebpubsub.ReplicasClientRestartResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method ReplicasClient.BeginUpdate @@ -77,31 +76,50 @@ func (r *ReplicasServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ReplicasClient.BeginCreateOrUpdate": - resp, err = r.dispatchBeginCreateOrUpdate(req) - case "ReplicasClient.Delete": - resp, err = r.dispatchDelete(req) - case "ReplicasClient.Get": - resp, err = r.dispatchGet(req) - case "ReplicasClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - case "ReplicasClient.BeginRestart": - resp, err = r.dispatchBeginRestart(req) - case "ReplicasClient.BeginUpdate": - resp, err = r.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ReplicasServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if replicasServerTransportInterceptor != nil { + res.resp, res.err, intercepted = replicasServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReplicasClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "ReplicasClient.Delete": + res.resp, res.err = r.dispatchDelete(req) + case "ReplicasClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ReplicasClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + case "ReplicasClient.BeginRestart": + res.resp, res.err = r.dispatchBeginRestart(req) + case "ReplicasClient.BeginUpdate": + res.resp, res.err = r.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ReplicasServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -113,7 +131,7 @@ func (r *ReplicasServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.Replica](req) @@ -163,7 +181,7 @@ func (r *ReplicasServerTransport) dispatchDelete(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -200,7 +218,7 @@ func (r *ReplicasServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -239,7 +257,7 @@ func (r *ReplicasServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -280,7 +298,7 @@ func (r *ReplicasServerTransport) dispatchBeginRestart(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restart` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -308,9 +326,9 @@ func (r *ReplicasServerTransport) dispatchBeginRestart(req *http.Request) (*http return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { r.beginRestart.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRestart) { r.beginRestart.remove(req) @@ -328,7 +346,7 @@ func (r *ReplicasServerTransport) dispatchBeginUpdate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.Replica](req) @@ -370,3 +388,9 @@ func (r *ReplicasServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return resp, nil } + +// set this to conditionally intercept incoming requests to ReplicasServerTransport +var replicasServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicasharedprivatelinkresources_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicasharedprivatelinkresources_server.go index 2e64b2c88970..c045366da9f1 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicasharedprivatelinkresources_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replicasharedprivatelinkresources_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -61,25 +60,44 @@ func (r *ReplicaSharedPrivateLinkResourcesServerTransport) Do(req *http.Request) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ReplicaSharedPrivateLinkResourcesClient.BeginCreateOrUpdate": - resp, err = r.dispatchBeginCreateOrUpdate(req) - case "ReplicaSharedPrivateLinkResourcesClient.Get": - resp, err = r.dispatchGet(req) - case "ReplicaSharedPrivateLinkResourcesClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ReplicaSharedPrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if replicaSharedPrivateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = replicaSharedPrivateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReplicaSharedPrivateLinkResourcesClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "ReplicaSharedPrivateLinkResourcesClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ReplicaSharedPrivateLinkResourcesClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *ReplicaSharedPrivateLinkResourcesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -91,7 +109,7 @@ func (r *ReplicaSharedPrivateLinkResourcesServerTransport) dispatchBeginCreateOr const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.SharedPrivateLinkResource](req) @@ -145,7 +163,7 @@ func (r *ReplicaSharedPrivateLinkResourcesServerTransport) dispatchGet(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -188,7 +206,7 @@ func (r *ReplicaSharedPrivateLinkResourcesServerTransport) dispatchNewListPager( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,3 +241,9 @@ func (r *ReplicaSharedPrivateLinkResourcesServerTransport) dispatchNewListPager( } return resp, nil } + +// set this to conditionally intercept incoming requests to ReplicaSharedPrivateLinkResourcesServerTransport +var replicaSharedPrivateLinkResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server.go index a85dd644b164..3c509c89b149 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -62,7 +61,7 @@ type Server struct { BeginRegenerateKey func(ctx context.Context, resourceGroupName string, resourceName string, parameters armwebpubsub.RegenerateKeyParameters, options *armwebpubsub.ClientBeginRegenerateKeyOptions) (resp azfake.PollerResponder[armwebpubsub.ClientRegenerateKeyResponse], errResp azfake.ErrorResponder) // BeginRestart is the fake for method Client.BeginRestart - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRestart func(ctx context.Context, resourceGroupName string, resourceName string, options *armwebpubsub.ClientBeginRestartOptions) (resp azfake.PollerResponder[armwebpubsub.ClientRestartResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method Client.BeginUpdate @@ -107,43 +106,62 @@ func (s *ServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "Client.CheckNameAvailability": - resp, err = s.dispatchCheckNameAvailability(req) - case "Client.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "Client.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "Client.Get": - resp, err = s.dispatchGet(req) - case "Client.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "Client.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "Client.ListKeys": - resp, err = s.dispatchListKeys(req) - case "Client.ListReplicaSKUs": - resp, err = s.dispatchListReplicaSKUs(req) - case "Client.ListSKUs": - resp, err = s.dispatchListSKUs(req) - case "Client.BeginRegenerateKey": - resp, err = s.dispatchBeginRegenerateKey(req) - case "Client.BeginRestart": - resp, err = s.dispatchBeginRestart(req) - case "Client.BeginUpdate": - resp, err = s.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *ServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if serverTransportInterceptor != nil { + res.resp, res.err, intercepted = serverTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "Client.CheckNameAvailability": + res.resp, res.err = s.dispatchCheckNameAvailability(req) + case "Client.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "Client.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "Client.Get": + res.resp, res.err = s.dispatchGet(req) + case "Client.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "Client.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "Client.ListKeys": + res.resp, res.err = s.dispatchListKeys(req) + case "Client.ListReplicaSKUs": + res.resp, res.err = s.dispatchListReplicaSKUs(req) + case "Client.ListSKUs": + res.resp, res.err = s.dispatchListSKUs(req) + case "Client.BeginRegenerateKey": + res.resp, res.err = s.dispatchBeginRegenerateKey(req) + case "Client.BeginRestart": + res.resp, res.err = s.dispatchBeginRestart(req) + case "Client.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -153,7 +171,7 @@ func (s *ServerTransport) dispatchCheckNameAvailability(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.NameAvailabilityParameters](req) @@ -188,7 +206,7 @@ func (s *ServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.ResourceInfo](req) @@ -236,7 +254,7 @@ func (s *ServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -278,7 +296,7 @@ func (s *ServerTransport) dispatchGet(req *http.Request) (*http.Response, error) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,7 +331,7 @@ func (s *ServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -350,7 +368,7 @@ func (s *ServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) @@ -381,7 +399,7 @@ func (s *ServerTransport) dispatchListKeys(req *http.Request) (*http.Response, e const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listKeys` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -414,7 +432,7 @@ func (s *ServerTransport) dispatchListReplicaSKUs(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -451,7 +469,7 @@ func (s *ServerTransport) dispatchListSKUs(req *http.Request) (*http.Response, e const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -486,7 +504,7 @@ func (s *ServerTransport) dispatchBeginRegenerateKey(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regenerateKey` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.RegenerateKeyParameters](req) @@ -534,7 +552,7 @@ func (s *ServerTransport) dispatchBeginRestart(req *http.Request) (*http.Respons const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restart` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -558,9 +576,9 @@ func (s *ServerTransport) dispatchBeginRestart(req *http.Request) (*http.Respons return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginRestart.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRestart) { s.beginRestart.remove(req) @@ -578,7 +596,7 @@ func (s *ServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.ResourceInfo](req) @@ -616,3 +634,9 @@ func (s *ServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response return resp, nil } + +// set this to conditionally intercept incoming requests to ServerTransport +var serverTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go index 30d7243c8336..ee26d68b43f1 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,17 +15,38 @@ import ( // ServerFactory is a fake server for instances of the armwebpubsub.ClientFactory type. type ServerFactory struct { - Server Server - CustomCertificatesServer CustomCertificatesServer - CustomDomainsServer CustomDomainsServer - HubsServer HubsServer - OperationsServer OperationsServer - PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer + // Server contains the fakes for client Client + Server Server + + // CustomCertificatesServer contains the fakes for client CustomCertificatesClient + CustomCertificatesServer CustomCertificatesServer + + // CustomDomainsServer contains the fakes for client CustomDomainsClient + CustomDomainsServer CustomDomainsServer + + // HubsServer contains the fakes for client HubsClient + HubsServer HubsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // ReplicaSharedPrivateLinkResourcesServer contains the fakes for client ReplicaSharedPrivateLinkResourcesClient ReplicaSharedPrivateLinkResourcesServer ReplicaSharedPrivateLinkResourcesServer - ReplicasServer ReplicasServer - SharedPrivateLinkResourcesServer SharedPrivateLinkResourcesServer - UsagesServer UsagesServer + + // ReplicasServer contains the fakes for client ReplicasClient + ReplicasServer ReplicasServer + + // SharedPrivateLinkResourcesServer contains the fakes for client SharedPrivateLinkResourcesClient + SharedPrivateLinkResourcesServer SharedPrivateLinkResourcesServer + + // UsagesServer contains the fakes for client UsagesClient + UsagesServer UsagesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -70,49 +90,49 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { switch client { case "Client": - initServer(s, &s.trServer, func() *ServerTransport { return NewServerTransport(&s.srv.Server) }) + initServer(&s.trMu, &s.trServer, func() *ServerTransport { return NewServerTransport(&s.srv.Server) }) resp, err = s.trServer.Do(req) case "CustomCertificatesClient": - initServer(s, &s.trCustomCertificatesServer, func() *CustomCertificatesServerTransport { + initServer(&s.trMu, &s.trCustomCertificatesServer, func() *CustomCertificatesServerTransport { return NewCustomCertificatesServerTransport(&s.srv.CustomCertificatesServer) }) resp, err = s.trCustomCertificatesServer.Do(req) case "CustomDomainsClient": - initServer(s, &s.trCustomDomainsServer, func() *CustomDomainsServerTransport { + initServer(&s.trMu, &s.trCustomDomainsServer, func() *CustomDomainsServerTransport { return NewCustomDomainsServerTransport(&s.srv.CustomDomainsServer) }) resp, err = s.trCustomDomainsServer.Do(req) case "HubsClient": - initServer(s, &s.trHubsServer, func() *HubsServerTransport { return NewHubsServerTransport(&s.srv.HubsServer) }) + initServer(&s.trMu, &s.trHubsServer, func() *HubsServerTransport { return NewHubsServerTransport(&s.srv.HubsServer) }) resp, err = s.trHubsServer.Do(req) case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + initServer(&s.trMu, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) case "PrivateEndpointConnectionsClient": - initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + initServer(&s.trMu, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) }) resp, err = s.trPrivateEndpointConnectionsServer.Do(req) case "PrivateLinkResourcesClient": - initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + initServer(&s.trMu, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) case "ReplicaSharedPrivateLinkResourcesClient": - initServer(s, &s.trReplicaSharedPrivateLinkResourcesServer, func() *ReplicaSharedPrivateLinkResourcesServerTransport { + initServer(&s.trMu, &s.trReplicaSharedPrivateLinkResourcesServer, func() *ReplicaSharedPrivateLinkResourcesServerTransport { return NewReplicaSharedPrivateLinkResourcesServerTransport(&s.srv.ReplicaSharedPrivateLinkResourcesServer) }) resp, err = s.trReplicaSharedPrivateLinkResourcesServer.Do(req) case "ReplicasClient": - initServer(s, &s.trReplicasServer, func() *ReplicasServerTransport { return NewReplicasServerTransport(&s.srv.ReplicasServer) }) + initServer(&s.trMu, &s.trReplicasServer, func() *ReplicasServerTransport { return NewReplicasServerTransport(&s.srv.ReplicasServer) }) resp, err = s.trReplicasServer.Do(req) case "SharedPrivateLinkResourcesClient": - initServer(s, &s.trSharedPrivateLinkResourcesServer, func() *SharedPrivateLinkResourcesServerTransport { + initServer(&s.trMu, &s.trSharedPrivateLinkResourcesServer, func() *SharedPrivateLinkResourcesServerTransport { return NewSharedPrivateLinkResourcesServerTransport(&s.srv.SharedPrivateLinkResourcesServer) }) resp, err = s.trSharedPrivateLinkResourcesServer.Do(req) case "UsagesClient": - initServer(s, &s.trUsagesServer, func() *UsagesServerTransport { return NewUsagesServerTransport(&s.srv.UsagesServer) }) + initServer(&s.trMu, &s.trUsagesServer, func() *UsagesServerTransport { return NewUsagesServerTransport(&s.srv.UsagesServer) }) resp, err = s.trUsagesServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) @@ -124,11 +144,3 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return resp, nil } - -func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { - s.trMu.Lock() - if *dst == nil { - *dst = src() - } - s.trMu.Unlock() -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/sharedprivatelinkresources_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/sharedprivatelinkresources_server.go index 9938164932c7..289d28e2ed5f 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/sharedprivatelinkresources_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/sharedprivatelinkresources_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -23,15 +22,15 @@ import ( type SharedPrivateLinkResourcesServer struct { // BeginCreateOrUpdate is the fake for method SharedPrivateLinkResourcesClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters armwebpubsub.SharedPrivateLinkResource, options *armwebpubsub.SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armwebpubsub.SharedPrivateLinkResourcesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, parameters armwebpubsub.SharedPrivateLinkResource, options *armwebpubsub.SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armwebpubsub.SharedPrivateLinkResourcesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method SharedPrivateLinkResourcesClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *armwebpubsub.SharedPrivateLinkResourcesClientBeginDeleteOptions) (resp azfake.PollerResponder[armwebpubsub.SharedPrivateLinkResourcesClientDeleteResponse], errResp azfake.ErrorResponder) + BeginDelete func(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, options *armwebpubsub.SharedPrivateLinkResourcesClientBeginDeleteOptions) (resp azfake.PollerResponder[armwebpubsub.SharedPrivateLinkResourcesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SharedPrivateLinkResourcesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *armwebpubsub.SharedPrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armwebpubsub.SharedPrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, options *armwebpubsub.SharedPrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armwebpubsub.SharedPrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method SharedPrivateLinkResourcesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK @@ -67,27 +66,46 @@ func (s *SharedPrivateLinkResourcesServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SharedPrivateLinkResourcesClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "SharedPrivateLinkResourcesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "SharedPrivateLinkResourcesClient.Get": - resp, err = s.dispatchGet(req) - case "SharedPrivateLinkResourcesClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SharedPrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if sharedPrivateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sharedPrivateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SharedPrivateLinkResourcesClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SharedPrivateLinkResourcesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SharedPrivateLinkResourcesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SharedPrivateLinkResourcesClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SharedPrivateLinkResourcesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -99,26 +117,26 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchBeginCreateOrUpdate( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armwebpubsub.SharedPrivateLinkResource](req) if err != nil { return nil, err } - sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) if err != nil { return nil, err } - respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), sharedPrivateLinkResourceNameParam, resourceGroupNameParam, resourceNameParam, body, nil) + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, sharedPrivateLinkResourceNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -151,22 +169,22 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) if err != nil { return nil, err } - respr, errRespr := s.srv.BeginDelete(req.Context(), sharedPrivateLinkResourceNameParam, resourceGroupNameParam, resourceNameParam, nil) + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, resourceNameParam, sharedPrivateLinkResourceNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -197,22 +215,22 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) if err != nil { return nil, err } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) if err != nil { return nil, err } - respr, errRespr := s.srv.Get(req.Context(), sharedPrivateLinkResourceNameParam, resourceGroupNameParam, resourceNameParam, nil) + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, resourceNameParam, sharedPrivateLinkResourceNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -236,7 +254,7 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchNewListPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -267,3 +285,9 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchNewListPager(req *ht } return resp, nil } + +// set this to conditionally intercept incoming requests to SharedPrivateLinkResourcesServerTransport +var sharedPrivateLinkResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/time_rfc3339.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/time_rfc3339.go deleted file mode 100644 index 48727835bf70..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/time_rfc3339.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/usages_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/usages_server.go index 28969657d0b2..168f862771b5 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/usages_server.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/usages_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,7 +11,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "net/http" "net/url" "regexp" @@ -50,21 +49,40 @@ func (u *UsagesServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return u.dispatchToMethodFake(req, method) +} - switch method { - case "UsagesClient.NewListPager": - resp, err = u.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (u *UsagesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if usagesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = usagesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "UsagesClient.NewListPager": + res.resp, res.err = u.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (u *UsagesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -76,7 +94,7 @@ func (u *UsagesServerTransport) dispatchNewListPager(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -103,3 +121,9 @@ func (u *UsagesServerTransport) dispatchNewListPager(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to UsagesServerTransport +var usagesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod index d8022ce91b10..91ec7759b586 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod @@ -1,9 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2 go 1.24.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 @@ -19,9 +19,9 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.45.0 // indirect - golang.org/x/net v0.47.0 // indirect - golang.org/x/sys v0.38.0 // indirect - golang.org/x/text v0.31.0 // indirect + golang.org/x/crypto v0.47.0 // indirect + golang.org/x/net v0.49.0 // indirect + golang.org/x/sys v0.40.0 // indirect + golang.org/x/text v0.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum index cc236fb92e86..f4450ac568ee 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum @@ -1,5 +1,5 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 h1:JXg2dwJUmPB9JmtVmdEB16APJ7jurfbY5jnfXpJoRMc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0/go.mod h1:YD5h/ldMsG0XiIw7PdyNhLxaM317eFh5yNLccNfGdyw= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= @@ -40,15 +40,15 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= -golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= -golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= -golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= +golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8= +golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A= +golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= +golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= -golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= +golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= +golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= +golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go index 3fa78de7c12d..0c89b6c2ee09 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// HubsClient contains the methods for the WebPubSubHubs group. +// HubsClient contains the methods for the Hubs group. // Don't use this type directly, use NewHubsClient() instead. type HubsClient struct { internal *arm.Client @@ -27,7 +26,7 @@ type HubsClient struct { // NewHubsClient creates a new instance of HubsClient 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HubsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,22 +42,21 @@ 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 2024-03-01 -// - hubName - The hub name. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - hubName - The hub name. // - 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) { +func (client *HubsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, hubName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*runtime.Poller[HubsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, hubName, resourceGroupName, resourceName, parameters, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, hubName, parameters, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -71,14 +69,14 @@ 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 2024-03-01 -func (client *HubsClient) createOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-01-01-preview +func (client *HubsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, hubName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "HubsClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, hubName, resourceGroupName, resourceName, parameters, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, hubName, parameters, options) if err != nil { return nil, err } @@ -94,12 +92,8 @@ func (client *HubsClient) createOrUpdate(ctx context.Context, hubName string, re } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, hubName string, parameters Hub, _ *HubsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}" - if hubName == "" { - 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") } @@ -112,14 +106,19 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if hubName == "" { + return nil, errors.New("parameter hubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -129,20 +128,19 @@ 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 2024-03-01 -// - hubName - The hub name. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - hubName - The hub name. // - 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) { +func (client *HubsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, hubName string, options *HubsClientBeginDeleteOptions) (*runtime.Poller[HubsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, hubName, resourceGroupName, resourceName, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, hubName, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -155,14 +153,14 @@ 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 2024-03-01 -func (client *HubsClient) deleteOperation(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2025-01-01-preview +func (client *HubsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, hubName string, options *HubsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "HubsClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, hubName, resourceGroupName, resourceName, options) + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, hubName, options) if err != nil { return nil, err } @@ -178,12 +176,8 @@ func (client *HubsClient) deleteOperation(ctx context.Context, hubName string, r } // deleteCreateRequest creates the Delete request. -func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *HubsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, hubName string, _ *HubsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}" - if hubName == "" { - 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") } @@ -196,32 +190,35 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if hubName == "" { + return nil, errors.New("parameter hubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 -// - hubName - The hub name. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - hubName - The hub name. // - 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) { +func (client *HubsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, hubName string, options *HubsClientGetOptions) (HubsClientGetResponse, error) { var err error const operationName = "HubsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, hubName, resourceGroupName, resourceName, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, hubName, options) if err != nil { return HubsClientGetResponse{}, err } @@ -238,12 +235,8 @@ func (client *HubsClient) Get(ctx context.Context, hubName string, resourceGroup } // getCreateRequest creates the Get request. -func (client *HubsClient) getCreateRequest(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientGetOptions) (*policy.Request, error) { +func (client *HubsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, hubName string, _ *HubsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/hubs/{hubName}" - if hubName == "" { - 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") } @@ -256,12 +249,16 @@ func (client *HubsClient) getCreateRequest(ctx context.Context, hubName string, return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if hubName == "" { + return nil, errors.New("parameter hubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hubName}", url.PathEscape(hubName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +275,7 @@ func (client *HubsClient) getHandleResponse(resp *http.Response) (HubsClientGetR // NewListPager - List hub settings. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -306,7 +303,7 @@ 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) { +func (client *HubsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -325,7 +322,7 @@ func (client *HubsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 index 49930760705a..88ebdf26e90f 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go @@ -1,156 +1,29 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHubsClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.HubList = armwebpubsub.HubList{ - // Value: []*armwebpubsub.Hub{ - // { - // Name: to.Ptr("exampleHub"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/hubs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/hubs/exampleHub"), - // 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("*"), - // }, - // }}, - // WebSocketKeepAliveIntervalInSeconds: to.Ptr[int32](50), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHubsClient().Get(ctx, "exampleHub", "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Hub = armwebpubsub.Hub{ - // Name: to.Ptr("exampleHub"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/hubs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/hubs/exampleHub"), - // 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("*"), - // }, - // }}, - // WebSocketKeepAliveIntervalInSeconds: to.Ptr[int32](50), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubHubs_CreateOrUpdate.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewHubsClient().BeginCreateOrUpdate(ctx, "exampleHub", "myResourceGroup", "myWebPubSubService", armwebpubsub.Hub{ + poller, err := clientFactory.NewHubsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "exampleHub", armwebpubsub.Hub{ Properties: &armwebpubsub.HubProperties{ AnonymousConnectPolicy: to.Ptr("allow"), EventHandlers: []*armwebpubsub.EventHandler{ @@ -163,10 +36,12 @@ func ExampleHubsClient_BeginCreateOrUpdate() { }, SystemEvents: []*string{ to.Ptr("connect"), - to.Ptr("connected")}, + to.Ptr("connected"), + }, URLTemplate: to.Ptr("http://host.com"), UserEventPattern: to.Ptr("*"), - }}, + }, + }, EventListeners: []*armwebpubsub.EventListener{ { Endpoint: &armwebpubsub.EventHubEndpoint{ @@ -178,10 +53,12 @@ func ExampleHubsClient_BeginCreateOrUpdate() { Type: to.Ptr(armwebpubsub.EventListenerFilterDiscriminatorEventName), SystemEvents: []*string{ to.Ptr("connected"), - to.Ptr("disconnected")}, + to.Ptr("disconnected"), + }, UserEventPattern: to.Ptr("*"), }, - }}, + }, + }, WebSocketKeepAliveIntervalInSeconds: to.Ptr[int32](50), }, }, nil) @@ -195,26 +72,29 @@ func ExampleHubsClient_BeginCreateOrUpdate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Hub = armwebpubsub.Hub{ - // Name: to.Ptr("exampleHub"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/hubs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/hubs/exampleHub"), - // 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"), + // res = armwebpubsub.HubsClientCreateOrUpdateResponse{ + // Hub: &armwebpubsub.Hub{ + // Name: to.Ptr("exampleHub"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/hubs"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/hubs/exampleHub"), + // 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"), // }, - // }, - // SystemEvents: []*string{ - // to.Ptr("connect"), - // to.Ptr("connected")}, // URLTemplate: to.Ptr("http://host.com"), // UserEventPattern: to.Ptr("*"), - // }}, + // }, + // }, // EventListeners: []*armwebpubsub.EventListener{ // { // Endpoint: &armwebpubsub.EventHubEndpoint{ @@ -226,32 +106,177 @@ func ExampleHubsClient_BeginCreateOrUpdate() { // Type: to.Ptr(armwebpubsub.EventListenerFilterDiscriminatorEventName), // SystemEvents: []*string{ // to.Ptr("connected"), - // to.Ptr("disconnected")}, - // UserEventPattern: to.Ptr("*"), + // to.Ptr("disconnected"), // }, - // }}, - // WebSocketKeepAliveIntervalInSeconds: to.Ptr[int32](50), + // UserEventPattern: to.Ptr("*"), + // }, + // }, // }, - // } + // WebSocketKeepAliveIntervalInSeconds: to.Ptr[int32](50), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubHubs_Delete.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewHubsClient().BeginDelete(ctx, "exampleHub", "myResourceGroup", "myWebPubSubService", nil) + poller, err := clientFactory.NewHubsClient().BeginDelete(ctx, "myResourceGroup", "myWebPubSubService", "exampleHub", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.HubsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-01-01-preview/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() + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewHubsClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "exampleHub", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.HubsClientGetResponse{ + // Hub: &armwebpubsub.Hub{ + // Name: to.Ptr("exampleHub"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/hubs"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/hubs/exampleHub"), + // 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("*"), + // }, + // }, + // }, + // WebSocketKeepAliveIntervalInSeconds: to.Ptr[int32](50), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-01-preview/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() + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewHubsClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.HubsClientListResponse{ + // HubList: armwebpubsub.HubList{ + // Value: []*armwebpubsub.Hub{ + // { + // Name: to.Ptr("exampleHub"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/hubs"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/hubs/exampleHub"), + // 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("*"), + // }, + // }, + // }, + // WebSocketKeepAliveIntervalInSeconds: to.Ptr[int32](50), + // }, + // }, + // }, + // }, + // } + } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/interfaces.go b/sdk/resourcemanager/webpubsub/armwebpubsub/interfaces.go index d2a61e92eb7c..3beb35b90684 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/interfaces.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/interfaces.go @@ -1,10 +1,27 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub +// ClientConnectionCountRuleClassification provides polymorphic access to related types. +// Call the interface's GetClientConnectionCountRule() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ClientConnectionCountRule, *ThrottleByJwtCustomClaimRule, *ThrottleByJwtSignatureRule, *ThrottleByUserIDRule +type ClientConnectionCountRuleClassification interface { + // GetClientConnectionCountRule returns the ClientConnectionCountRule content of the underlying type. + GetClientConnectionCountRule() *ClientConnectionCountRule +} + +// ClientTrafficControlRuleClassification provides polymorphic access to related types. +// Call the interface's GetClientTrafficControlRule() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *ClientTrafficControlRule, *TrafficThrottleByJwtCustomClaimRule, *TrafficThrottleByJwtSignatureRule, *TrafficThrottleByUserIDRule +type ClientTrafficControlRuleClassification interface { + // GetClientTrafficControlRule returns the ClientTrafficControlRule content of the underlying type. + GetClientTrafficControlRule() *ClientTrafficControlRule +} + // EventListenerEndpointClassification provides polymorphic access to related types. // Call the interface's GetEventListenerEndpoint() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go index 4b66b88b323e..bb7740690145 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go @@ -1,18 +1,49 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub import "time" +// ApplicationFirewallSettings - Application firewall settings for the resource +type ApplicationFirewallSettings struct { + // Rules to control the client connection count + ClientConnectionCountRules []ClientConnectionCountRuleClassification + + // Rules to control the client traffic + ClientTrafficControlRules []ClientTrafficControlRuleClassification + + // Config to control the client connection lifetime in seconds, can be set to 0 to disable the config + MaxClientConnectionLifetimeInSeconds *int64 +} + +// ClientConnectionCountRule - A base class for client connection count rules +type ClientConnectionCountRule struct { + // REQUIRED + Type *ClientConnectionCountRuleDiscriminator +} + +// GetClientConnectionCountRule implements the ClientConnectionCountRuleClassification interface for type ClientConnectionCountRule. +func (c *ClientConnectionCountRule) GetClientConnectionCountRule() *ClientConnectionCountRule { + return c +} + +// ClientTrafficControlRule - A base class for client traffic control rules +type ClientTrafficControlRule struct { + // REQUIRED + Type *ClientTrafficControlRuleDiscriminator +} + +// GetClientTrafficControlRule implements the ClientTrafficControlRuleClassification interface for type ClientTrafficControlRule. +func (c *ClientTrafficControlRule) GetClientTrafficControlRule() *ClientTrafficControlRule { return c } + // CustomCertificate - A custom certificate. type CustomCertificate struct { // REQUIRED; Custom certificate properties. Properties *CustomCertificateProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -27,11 +58,11 @@ type CustomCertificate struct { // CustomCertificateList - Custom certificates list. type CustomCertificateList 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 - - // List of custom certificates of this resource. + // REQUIRED; The CustomCertificate items on this page Value []*CustomCertificate + + // The link to the next page of items + NextLink *string } // CustomCertificateProperties - Custom certificate properties. @@ -54,7 +85,7 @@ type CustomDomain struct { // REQUIRED; Properties of a custom domain. Properties *CustomDomainProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -69,11 +100,11 @@ type CustomDomain struct { // CustomDomainList - Custom domains list type CustomDomainList 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 - - // List of custom domains that bind to this resource. + // REQUIRED; The CustomDomain items on this page Value []*CustomDomain + + // The link to the next page of items + NextLink *string } // CustomDomainProperties - Properties of a custom domain. @@ -105,9 +136,13 @@ type Dimension struct { // EventHandler - Properties of event handler. type EventHandler struct { - // REQUIRED; Gets or sets the EventHandler URL template. You can use a predefined parameter {hub} and {event} inside the template, - // the value of the EventHandler URL is dynamically calculated when the client - // request comes in. For example, UrlTemplate can be http://example.com/api/{hub}/{event}. The host part can't contains parameters. + // REQUIRED; Gets or sets the URL template for the event handler. The actual URL is calculated when the corresponding event + // is triggered. + // The template supports predefined parameters syntax: `{event}`, `{hub}`, and KeyVault reference syntax `{@Microsoft.KeyVault(SecretUri=_your_secret_identifier_)}` + // For example, if the template is `http://example.com/api/{event}`, when `connect` event is triggered, a POST request will + // be sent to the URL `http://example.com/chat/api/connect`. + // Note: Parameters are not allowed in the hostname of the URL, and curly brackets `{}` are reserved for parameter syntax + // only. If your URL path contains literal curly brackets, please URL-encode them to ensure proper handling. URLTemplate *string // Upstream auth settings. If not set, no auth is used for upstream messages. @@ -116,22 +151,25 @@ type EventHandler struct { // Gets or sets the list of system events. SystemEvents []*string - // Gets or sets the matching pattern for event names. There are 3 kinds of patterns supported: 1. "*", it matches any event - // name 2. Combine multiple events with ",", for example "event1,event2", it - // matches event "event1" and "event2" 3. A single event name, for example, "event1", it matches "event1" + // Gets or sets the matching pattern for event names. + // There are 3 kinds of patterns supported: + // 1. "*", it matches any event name + // 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" and "event2" + // 3. A single event name, for example, "event1", it matches "event1" UserEventPattern *string } -// EventHubEndpoint - An Event Hub endpoint. The managed identity of Web PubSub service must be enabled, and the identity -// should have the "Azure Event Hubs Data sender" role to access Event Hub. +// EventHubEndpoint - An Event Hub endpoint. +// The managed identity of Web PubSub service must be enabled, and the identity should have the "Azure Event Hubs Data sender" +// role to access Event Hub. type EventHubEndpoint struct { // REQUIRED; The name of the Event Hub. EventHubName *string - // REQUIRED; The fully qualified namespace name of the Event Hub resource. For example, "example.servicebus.windows.net". + // REQUIRED; The fully qualified namespace name of the Event Hub resource. FullyQualifiedNamespace *string - // REQUIRED + // CONSTANT; Field has constant value EventListenerEndpointDiscriminatorEventHub, any specified value is ignored. Type *EventListenerEndpointDiscriminator } @@ -171,16 +209,18 @@ func (e *EventListenerFilter) GetEventListenerFilter() *EventListenerFilter { re // EventNameFilter - Filter events by their name. type EventNameFilter struct { - // REQUIRED + // CONSTANT; Field has constant value EventListenerFilterDiscriminatorEventName, any specified value is ignored. Type *EventListenerFilterDiscriminator // Gets or sets a list of system events. Supported events: "connected" and "disconnected". Blocking event "connect" is not // supported because it requires a response. SystemEvents []*string - // Gets or sets a matching pattern for event names. There are 3 kinds of patterns supported: 1. "*", it matches any event - // name 2. Combine multiple events with ",", for example "event1,event2", it matches - // events "event1" and "event2" 3. A single event name, for example, "event1", it matches "event1" + // Gets or sets a matching pattern for event names. + // There are 3 kinds of patterns supported: + // 1. "*", it matches any event name + // 2. Combine multiple events with ",", for example "event1,event2", it matches events "event1" and "event2" + // 3. A single event name, for example, "event1", it matches "event1" UserEventPattern *string } @@ -196,7 +236,7 @@ type Hub struct { // REQUIRED; Properties of a hub. Properties *HubProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -211,11 +251,10 @@ type Hub struct { // HubList - Hub setting list type HubList struct { - // List of hub settings to this resource. + // REQUIRED; The WebPubSubHub items on this page Value []*Hub - // READ-ONLY; The URL the client should use to fetch the next page (per server side paging). It's null for now, added for - // future use. + // The link to the next page of items NextLink *string } @@ -227,11 +266,12 @@ type HubProperties struct { // Event handler of a hub. EventHandlers []*EventHandler - // Event listener settings for forwarding your client events to listeners. Event listener is transparent to Web PubSub clients, - // and it doesn't return any result to clients nor interrupt the lifetime of - // clients. One event can be sent to multiple listeners, as long as it matches the filters in those listeners. The order of - // the array elements doesn't matter. Maximum count of event listeners among all - // hubs is 10. + // Event listener settings for forwarding your client events to listeners. + // Event listener is transparent to Web PubSub clients, and it doesn't return any result to clients nor interrupt the lifetime + // of clients. + // One event can be sent to multiple listeners, as long as it matches the filters in those listeners. The order of the array + // elements doesn't matter. + // Maximum count of event listeners among all hubs is 10. EventListeners []*EventListener // The settings for configuring the WebSocket ping-pong interval in seconds for all clients in the hub. Valid range: 1 to @@ -265,10 +305,14 @@ type Keys struct { // LiveTraceCategory - Live trace category configuration of a Microsoft.SignalRService resource. type LiveTraceCategory struct { - // Indicates whether or the live trace category is enabled. Available values: true, false. Case insensitive. + // Indicates whether or the live trace category is enabled. + // Available values: true, false. + // Case insensitive. Enabled *string - // Gets or sets the live trace category's name. Available values: ConnectivityLogs, MessagingLogs. Case insensitive. + // Gets or sets the live trace category's name. + // Available values: ConnectivityLogs, MessagingLogs. + // Case insensitive. Name *string } @@ -277,9 +321,12 @@ type LiveTraceConfiguration struct { // Gets or sets the list of category configurations. Categories []*LiveTraceCategory - // Indicates whether or not enable live trace. When it's set to true, live trace client can connect to the service. Otherwise, - // live trace client can't connect to the service, so that you are unable to - // receive any log, no matter what you configure in "categories". Available values: true, false. Case insensitive. + // Indicates whether or not enable live trace. + // When it's set to true, live trace client can connect to the service. + // Otherwise, live trace client can't connect to the service, so that you are unable to receive any log, no matter what you + // configure in "categories". + // Available values: true, false. + // Case insensitive. Enabled *string } @@ -300,17 +347,19 @@ type ManagedIdentity struct { // Get or set the user assigned identities UserAssignedIdentities map[string]*UserAssignedIdentityProperty - // READ-ONLY; Get the principal id for the system assigned identity. Only be used in response. + // READ-ONLY; Get the principal id for the system assigned identity. + // Only be used in response. PrincipalID *string - // READ-ONLY; Get the tenant id for the system assigned identity. Only be used in response + // READ-ONLY; Get the tenant id for the system assigned identity. + // Only be used in response TenantID *string } // ManagedIdentitySettings - Managed identity settings for upstream. type ManagedIdentitySettings struct { - // The Resource indicating the App ID URI of the target resource. It also appears in the aud (audience) claim of the issued - // token. + // The Resource indicating the App ID URI of the target resource. + // It also appears in the aud (audience) claim of the issued token. Resource *string } @@ -331,10 +380,9 @@ type MetricSpecification struct { // Localized friendly display name of the metric. DisplayName *string - // Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. Ex. a metric - // that returns the number of times a particular error code was emitted. The - // error code may not appear often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing - // was emitted. + // Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + // Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear + // often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted. FillGapWithZero *string // Name of the metric. @@ -424,13 +472,13 @@ type OperationDisplay struct { Resource *string } -// OperationList - Result of the request to list REST API operations. It contains a list of operations. +// OperationList - Paged collection of Operation items type OperationList 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 - - // List of operations supported by the resource provider. + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } // OperationProperties - Extra Operation properties. @@ -462,7 +510,7 @@ type PrivateEndpointConnection struct { // Private endpoint connection properties Properties *PrivateEndpointConnectionProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -477,12 +525,11 @@ type PrivateEndpointConnection struct { // PrivateEndpointConnectionList - A list of private endpoint connections type PrivateEndpointConnectionList struct { - // Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested - // private endpoint connections exceed maximum page size. - NextLink *string - - // The list of the private endpoint connections + // REQUIRED; The PrivateEndpointConnection items on this page Value []*PrivateEndpointConnection + + // The link to the next page of items + NextLink *string } // PrivateEndpointConnectionProperties - Private endpoint connection properties @@ -505,7 +552,7 @@ type PrivateLinkResource struct { // Private link resource properties Properties *PrivateLinkResourceProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -520,11 +567,11 @@ type PrivateLinkResource struct { // PrivateLinkResourceList - Contains a list of PrivateLinkResource and a possible link to query more results type PrivateLinkResourceList 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 - - // List of PrivateLinkResource + // REQUIRED; The PrivateLinkResource items on this page Value []*PrivateLinkResource + + // The link to the next page of items + NextLink *string } // PrivateLinkResourceProperties - Private link resource properties @@ -556,10 +603,17 @@ type PrivateLinkServiceConnectionState struct { // Properties - A class that describes the properties of the resource type Properties struct { - // DisableLocalAuth Enable or disable aad auth When set as true, connection with AuthType=aad won't work. + // Application firewall settings for the resource + ApplicationFirewall *ApplicationFirewallSettings + + // DisableLocalAuth + // Enable or disable aad auth + // When set as true, connection with AuthType=aad won't work. DisableAADAuth *bool - // DisableLocalAuth Enable or disable local auth with AccessKey When set as true, connection with AccessKey=xxx won't work. + // DisableLocalAuth + // Enable or disable local auth with AccessKey + // When set as true, connection with AccessKey=xxx won't work. DisableLocalAuth *bool // Live trace configuration of a Microsoft.SignalRService resource. @@ -568,21 +622,22 @@ type Properties struct { // Network ACLs for the resource NetworkACLs *NetworkACLs - // Enable or disable public network access. Default to "Enabled". When it's Enabled, network ACLs still apply. When it's Disabled, - // public network access is always disabled no matter what you set in - // network ACLs. + // Enable or disable public network access. Default to "Enabled". + // When it's Enabled, network ACLs still apply. + // When it's Disabled, public network access is always disabled no matter what you set in network ACLs. PublicNetworkAccess *string - // Enable or disable the regional endpoint. Default to "Enabled". When it's Disabled, new connections will not be routed to - // this endpoint, however existing connections will not be affected. This property - // is replica specific. Disable the regional endpoint without replica is not allowed. + // Enable or disable the regional endpoint. Default to "Enabled". + // When it's Disabled, new connections will not be routed to this endpoint, however existing connections will not be affected. + // This property is replica specific. Disable the regional endpoint without replica is not allowed. RegionEndpointEnabled *string // Resource log configuration of a Microsoft.SignalRService resource. ResourceLogConfiguration *ResourceLogConfiguration - // Stop or start the resource. Default to "False". When it's true, the data plane of the resource is shutdown. When it's false, - // the data plane of the resource is started. + // Stop or start the resource. Default to "False". + // When it's true, the data plane of the resource is shutdown. + // When it's false, the data plane of the resource is started. ResourceStopped *string // SocketIO settings for the resource @@ -637,7 +692,7 @@ type Replica struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -650,21 +705,23 @@ type Replica struct { Type *string } +// ReplicaList - Paged collection of Replica items 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 - - // List of the replica + // REQUIRED; The Replica items on this page Value []*Replica + + // The link to the next page of items + NextLink *string } type ReplicaProperties struct { - // Enable or disable the regional endpoint. Default to "Enabled". When it's Disabled, new connections will not be routed to - // this endpoint, however existing connections will not be affected. + // Enable or disable the regional endpoint. Default to "Enabled". + // When it's Disabled, new connections will not be routed to this endpoint, however existing connections will not be affected. RegionEndpointEnabled *string - // Stop or start the resource. Default to "false". When it's true, the data plane of the resource is shutdown. When it's false, - // the data plane of the resource is started. + // Stop or start the resource. Default to "false". + // When it's true, the data plane of the resource is shutdown. + // When it's false, the data plane of the resource is started. ResourceStopped *string // READ-ONLY; Provisioning state of the resource. @@ -691,7 +748,7 @@ type ResourceInfo struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -706,19 +763,23 @@ type ResourceInfo struct { // ResourceInfoList - Object that includes an array of resources and a possible link for next set. type ResourceInfoList 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 - - // List of the resources + // REQUIRED; The WebPubSubResource items on this page Value []*ResourceInfo + + // The link to the next page of items + NextLink *string } // ResourceLogCategory - Resource log category configuration of a Microsoft.SignalRService resource. type ResourceLogCategory struct { - // Indicates whether or the resource log category is enabled. Available values: true, false. Case insensitive. + // Indicates whether or the resource log category is enabled. + // Available values: true, false. + // Case insensitive. Enabled *string - // Gets or sets the resource log category's name. Available values: ConnectivityLogs, MessagingLogs. Case insensitive. + // Gets or sets the resource log category's name. + // Available values: ConnectivityLogs, MessagingLogs. + // Case insensitive. Name *string } @@ -737,17 +798,20 @@ type ResourceReference struct { // ResourceSKU - The billing information of the resource. type ResourceSKU struct { // REQUIRED; The name of the SKU. Required. - // Allowed values: StandardS1, FreeF1, PremiumP1, PremiumP2 + // Allowed values: Standard_S1, Free_F1, Premium_P1, Premium_P2 Name *string - // Optional, integer. The unit count of the resource. 1 for FreeF1/StandardS1/PremiumP1, 100 for PremiumP2 by default. - // If present, following values are allowed: FreeF1: 1; StandardS1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; PremiumP1: - // 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; PremiumP2: - // 100,200,300,400,500,600,700,800,900,1000; + // Optional, integer. The unit count of the resource. + // 1 for Free_F1/Standard_S1/Premium_P1, 100 for Premium_P2 by default. + // If present, following values are allowed: + // Free_F1: 1; + // Standard_S1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + // Premium_P1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + // Premium_P2: 100,200,300,400,500,600,700,800,900,1000; Capacity *int32 // Optional tier of this particular SKU. 'Standard' or 'Free'. - // Basic is deprecated, use Standard instead. + // `Basic` is deprecated, use `Standard` instead. Tier *WebPubSubSKUTier // READ-ONLY; Not used. Retained for future use. @@ -789,8 +853,8 @@ type SKUCapacity struct { // SKUList - The list skus operation response type SKUList struct { - // READ-ONLY; The URL the client should use to fetch the next page (per server side paging). It's null for now, added for - // future use. + // READ-ONLY; 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 // READ-ONLY; The list of skus available for the resource. @@ -833,7 +897,7 @@ type SharedPrivateLinkResource struct { // Describes the properties of an existing Shared Private Link Resource Properties *SharedPrivateLinkResourceProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -848,12 +912,11 @@ type SharedPrivateLinkResource struct { // SharedPrivateLinkResourceList - A list of shared private link resources type SharedPrivateLinkResourceList struct { - // Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested - // private endpoint connections exceed maximum page size. - NextLink *string - - // The list of the shared private link resources + // REQUIRED; The SharedPrivateLinkResource items on this page Value []*SharedPrivateLinkResource + + // The link to the next page of items + NextLink *string } // SharedPrivateLinkResourceProperties - Describes the properties of an existing Shared Private Link Resource @@ -864,6 +927,9 @@ type SharedPrivateLinkResourceProperties struct { // REQUIRED; The resource id of the resource the shared private link resource is for PrivateLinkResourceID *string + // A list of FQDNs for third party private link service + Fqdns []*string + // The request message for requesting approval of the shared private link resource RequestMessage *string @@ -894,11 +960,11 @@ type SignalRServiceUsage struct { // SignalRServiceUsageList - Object that includes an array of the resource usages and a possible link for next set. type SignalRServiceUsageList 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 - - // List of the resource usages + // REQUIRED; The SignalRServiceUsage items on this page Value []*SignalRServiceUsage + + // The link to the next page of items + NextLink *string } // SignalRServiceUsageName - Localizable String object containing the name and a localized value. @@ -912,8 +978,9 @@ type SignalRServiceUsageName struct { // SocketIOSettings - SocketIO settings for the resource type SocketIOSettings struct { - // The service mode of Web PubSub for Socket.IO. Values allowed: "Default": have your own backend Socket.IO server "Serverless": - // your application doesn't have a backend server + // The service mode of Web PubSub for Socket.IO. Values allowed: + // "Default": have your own backend Socket.IO server + // "Serverless": your application doesn't have a backend server ServiceMode *string } @@ -945,6 +1012,133 @@ type TLSSettings struct { ClientCertEnabled *bool } +// ThrottleByJwtCustomClaimRule - Throttle the client connection by a custom JWT claim +type ThrottleByJwtCustomClaimRule struct { + // REQUIRED; The name of the claim in the JWT token. The client connection with the same claim value will be aggregated. If + // the claim is not found in the token, the connection will be allowed. + ClaimName *string + + // CONSTANT; Field has constant value ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule, any specified value + // is ignored. + Type *ClientConnectionCountRuleDiscriminator + + // Maximum connection count allowed for the same Jwt claim value. Clients with the same Jwt claim will get rejected if the + // connection count exceeds this value. Default value is 20. + MaxCount *int32 +} + +// GetClientConnectionCountRule implements the ClientConnectionCountRuleClassification interface for type ThrottleByJwtCustomClaimRule. +func (t *ThrottleByJwtCustomClaimRule) GetClientConnectionCountRule() *ClientConnectionCountRule { + return &ClientConnectionCountRule{ + Type: t.Type, + } +} + +// ThrottleByJwtSignatureRule - Throttle the client connection by the JWT signature +type ThrottleByJwtSignatureRule struct { + // CONSTANT; Field has constant value ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule, any specified value + // is ignored. + Type *ClientConnectionCountRuleDiscriminator + + // Maximum connection count allowed for the same JWT signature. Clients with the same JWT signature will get rejected if the + // connection count exceeds this value. Default value is 20. + MaxCount *int32 +} + +// GetClientConnectionCountRule implements the ClientConnectionCountRuleClassification interface for type ThrottleByJwtSignatureRule. +func (t *ThrottleByJwtSignatureRule) GetClientConnectionCountRule() *ClientConnectionCountRule { + return &ClientConnectionCountRule{ + Type: t.Type, + } +} + +// ThrottleByUserIDRule - Throttle the client connection by the user ID +type ThrottleByUserIDRule struct { + // CONSTANT; Field has constant value ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule, any specified value is ignored. + Type *ClientConnectionCountRuleDiscriminator + + // Maximum connection count allowed for the same user ID. Clients with the same user ID will get rejected if the connection + // count exceeds this value. Default value is 20. + MaxCount *int32 +} + +// GetClientConnectionCountRule implements the ClientConnectionCountRuleClassification interface for type ThrottleByUserIDRule. +func (t *ThrottleByUserIDRule) GetClientConnectionCountRule() *ClientConnectionCountRule { + return &ClientConnectionCountRule{ + Type: t.Type, + } +} + +// TrafficThrottleByJwtCustomClaimRule - Throttle the client traffic by a custom JWT claim +type TrafficThrottleByJwtCustomClaimRule struct { + // REQUIRED; The name of the claim in the JWT token. The message bytes with the same claim value will be aggregated. If the + // claim is not found in the token, the rule will be skipped. + ClaimName *string + + // CONSTANT; Field has constant value ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule, any specified + // value is ignored. + Type *ClientTrafficControlRuleDiscriminator + + // The aggregation window for the message bytes. The message bytes will be aggregated in this window and be reset after the + // window. Default value is 60 seconds. + AggregationWindowInSeconds *int32 + + // Maximum accumulated inbound message bytes allowed for the same JWT signature within a time window. Clients with the same + // JWT claim will get disconnected if the message bytes exceeds this value. Default value is 1GB. + MaxInboundMessageBytes *int64 +} + +// GetClientTrafficControlRule implements the ClientTrafficControlRuleClassification interface for type TrafficThrottleByJwtCustomClaimRule. +func (t *TrafficThrottleByJwtCustomClaimRule) GetClientTrafficControlRule() *ClientTrafficControlRule { + return &ClientTrafficControlRule{ + Type: t.Type, + } +} + +// TrafficThrottleByJwtSignatureRule - Throttle the client traffic by the JWT signature +type TrafficThrottleByJwtSignatureRule struct { + // CONSTANT; Field has constant value ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule, any specified + // value is ignored. + Type *ClientTrafficControlRuleDiscriminator + + // The aggregation window for the message bytes. The message bytes will be aggregated in this window and be reset after the + // window. Default value is 60 seconds. + AggregationWindowInSeconds *int32 + + // Maximum accumulated inbound message bytes allowed for the same JWT signature within a time window. Clients with the same + // JWT signature will get disconnected if the message bytes exceeds this value. Default value is 1GB. + MaxInboundMessageBytes *int64 +} + +// GetClientTrafficControlRule implements the ClientTrafficControlRuleClassification interface for type TrafficThrottleByJwtSignatureRule. +func (t *TrafficThrottleByJwtSignatureRule) GetClientTrafficControlRule() *ClientTrafficControlRule { + return &ClientTrafficControlRule{ + Type: t.Type, + } +} + +// TrafficThrottleByUserIDRule - Throttle the client traffic by the user ID +type TrafficThrottleByUserIDRule struct { + // CONSTANT; Field has constant value ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule, any specified value + // is ignored. + Type *ClientTrafficControlRuleDiscriminator + + // The aggregation window for the message bytes. The message bytes will be aggregated in this window and be reset after the + // window. Default value is 60 seconds. + AggregationWindowInSeconds *int32 + + // Maximum accumulated inbound message bytes allowed for the same user ID within a time window. Clients with the same user + // ID will get disconnected if the message bytes exceeds this value. Default value is 1GB. + MaxInboundMessageBytes *int64 +} + +// GetClientTrafficControlRule implements the ClientTrafficControlRuleClassification interface for type TrafficThrottleByUserIDRule. +func (t *TrafficThrottleByUserIDRule) GetClientTrafficControlRule() *ClientTrafficControlRule { + return &ClientTrafficControlRule{ + Type: t.Type, + } +} + // UpstreamAuthSettings - Upstream auth settings. If not set, no auth is used for upstream messages. type UpstreamAuthSettings struct { // Managed identity settings for upstream. diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go index b55f4b0ca9e1..e6aab26cf799 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -9,9 +8,100 @@ import ( "encoding/json" "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/datetime" "reflect" + "time" ) +// MarshalJSON implements the json.Marshaller interface for type ApplicationFirewallSettings. +func (a ApplicationFirewallSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientConnectionCountRules", a.ClientConnectionCountRules) + populate(objectMap, "clientTrafficControlRules", a.ClientTrafficControlRules) + populate(objectMap, "maxClientConnectionLifetimeInSeconds", a.MaxClientConnectionLifetimeInSeconds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationFirewallSettings. +func (a *ApplicationFirewallSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientConnectionCountRules": + a.ClientConnectionCountRules, err = unmarshalClientConnectionCountRuleClassificationArray(val) + delete(rawMsg, key) + case "clientTrafficControlRules": + a.ClientTrafficControlRules, err = unmarshalClientTrafficControlRuleClassificationArray(val) + delete(rawMsg, key) + case "maxClientConnectionLifetimeInSeconds": + err = unpopulate(val, "MaxClientConnectionLifetimeInSeconds", &a.MaxClientConnectionLifetimeInSeconds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClientConnectionCountRule. +func (c ClientConnectionCountRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientConnectionCountRule. +func (c *ClientConnectionCountRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClientTrafficControlRule. +func (c ClientTrafficControlRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClientTrafficControlRule. +func (c *ClientTrafficControlRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type CustomCertificate. func (c CustomCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -381,7 +471,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]any) - objectMap["type"] = e.Type + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -408,7 +498,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]any) - objectMap["type"] = e.Type + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -1466,6 +1556,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]any) + populate(objectMap, "applicationFirewall", p.ApplicationFirewall) populate(objectMap, "disableAadAuth", p.DisableAADAuth) populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) populate(objectMap, "externalIP", p.ExternalIP) @@ -1497,6 +1588,9 @@ func (p *Properties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "applicationFirewall": + err = unpopulate(val, "ApplicationFirewall", &p.ApplicationFirewall) + delete(rawMsg, key) case "disableAadAuth": err = unpopulate(val, "DisableAADAuth", &p.DisableAADAuth) delete(rawMsg, key) @@ -2215,6 +2309,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]any) + populate(objectMap, "fqdns", s.Fqdns) populate(objectMap, "groupId", s.GroupID) populate(objectMap, "privateLinkResourceId", s.PrivateLinkResourceID) populate(objectMap, "provisioningState", s.ProvisioningState) @@ -2232,6 +2327,9 @@ func (s *SharedPrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "fqdns": + err = unpopulate(val, "Fqdns", &s.Fqdns) + delete(rawMsg, key) case "groupId": err = unpopulate(val, "GroupID", &s.GroupID) delete(rawMsg, key) @@ -2390,10 +2488,10 @@ func (s *SocketIOSettings) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateTime[datetime.RFC3339](objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateTime[datetime.RFC3339](objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -2409,7 +2507,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateTime[datetime.RFC3339](val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -2418,7 +2516,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateTime[datetime.RFC3339](val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -2461,6 +2559,212 @@ func (t *TLSSettings) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ThrottleByJwtCustomClaimRule. +func (t ThrottleByJwtCustomClaimRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "claimName", t.ClaimName) + populate(objectMap, "maxCount", t.MaxCount) + objectMap["type"] = ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThrottleByJwtCustomClaimRule. +func (t *ThrottleByJwtCustomClaimRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "claimName": + err = unpopulate(val, "ClaimName", &t.ClaimName) + delete(rawMsg, key) + case "maxCount": + err = unpopulate(val, "MaxCount", &t.MaxCount) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThrottleByJwtSignatureRule. +func (t ThrottleByJwtSignatureRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxCount", t.MaxCount) + objectMap["type"] = ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThrottleByJwtSignatureRule. +func (t *ThrottleByJwtSignatureRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxCount": + err = unpopulate(val, "MaxCount", &t.MaxCount) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ThrottleByUserIDRule. +func (t ThrottleByUserIDRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maxCount", t.MaxCount) + objectMap["type"] = ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThrottleByUserIDRule. +func (t *ThrottleByUserIDRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maxCount": + err = unpopulate(val, "MaxCount", &t.MaxCount) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficThrottleByJwtCustomClaimRule. +func (t TrafficThrottleByJwtCustomClaimRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregationWindowInSeconds", t.AggregationWindowInSeconds) + populate(objectMap, "claimName", t.ClaimName) + populate(objectMap, "maxInboundMessageBytes", t.MaxInboundMessageBytes) + objectMap["type"] = ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficThrottleByJwtCustomClaimRule. +func (t *TrafficThrottleByJwtCustomClaimRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationWindowInSeconds": + err = unpopulate(val, "AggregationWindowInSeconds", &t.AggregationWindowInSeconds) + delete(rawMsg, key) + case "claimName": + err = unpopulate(val, "ClaimName", &t.ClaimName) + delete(rawMsg, key) + case "maxInboundMessageBytes": + err = unpopulate(val, "MaxInboundMessageBytes", &t.MaxInboundMessageBytes) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficThrottleByJwtSignatureRule. +func (t TrafficThrottleByJwtSignatureRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregationWindowInSeconds", t.AggregationWindowInSeconds) + populate(objectMap, "maxInboundMessageBytes", t.MaxInboundMessageBytes) + objectMap["type"] = ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficThrottleByJwtSignatureRule. +func (t *TrafficThrottleByJwtSignatureRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationWindowInSeconds": + err = unpopulate(val, "AggregationWindowInSeconds", &t.AggregationWindowInSeconds) + delete(rawMsg, key) + case "maxInboundMessageBytes": + err = unpopulate(val, "MaxInboundMessageBytes", &t.MaxInboundMessageBytes) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TrafficThrottleByUserIDRule. +func (t TrafficThrottleByUserIDRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "aggregationWindowInSeconds", t.AggregationWindowInSeconds) + populate(objectMap, "maxInboundMessageBytes", t.MaxInboundMessageBytes) + objectMap["type"] = ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrafficThrottleByUserIDRule. +func (t *TrafficThrottleByUserIDRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aggregationWindowInSeconds": + err = unpopulate(val, "AggregationWindowInSeconds", &t.AggregationWindowInSeconds) + delete(rawMsg, key) + case "maxInboundMessageBytes": + err = unpopulate(val, "MaxInboundMessageBytes", &t.MaxInboundMessageBytes) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type UpstreamAuthSettings. func (u UpstreamAuthSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2533,6 +2837,17 @@ func populate(m map[string]any, k string, v any) { } } +func populateTime[T dateTimeConstraints](m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + } else if !reflect.ValueOf(t).IsNil() { + newTime := T(*t) + m[k] = (*T)(&newTime) + } +} + func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil || string(data) == "null" { return nil @@ -2542,3 +2857,20 @@ func unpopulate(data json.RawMessage, fn string, v any) error { } return nil } + +func unpopulateTime[T dateTimeConstraints](data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux T + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + newTime := time.Time(aux) + *t = &newTime + return nil +} + +type dateTimeConstraints interface { + datetime.PlainDate | datetime.PlainTime | datetime.RFC1123 | datetime.RFC3339 | datetime.Unix +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go index 95d1c7da5118..6f29eb2900d9 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -14,7 +13,10 @@ import ( "net/http" ) -// OperationsClient contains the methods for the Operations group. +// OperationsClient - This is the interface that implements the standard Azure Resource Manager operation that returns +// all supported RP operations. You should have exactly one declaration for each +// Azure Resource Manager service. It implements +// GET "/providers/Microsoft.ContosoProviderHub/operations" // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { internal *arm.Client @@ -22,7 +24,7 @@ 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -34,9 +36,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Lists all of the available REST API operations of the Microsoft.SignalRService provider. +// NewListPager - List the operations for the provider // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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]{ @@ -62,14 +64,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.SignalRService/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 index f3dbf9bcdcce..c648dfffa2cc 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go @@ -1,27 +1,24 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/Operations_List.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,20 +33,24 @@ func ExampleOperationsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationList = armwebpubsub.OperationList{ - // Value: []*armwebpubsub.Operation{ - // { - // Name: to.Ptr("Microsoft.SignalRService/WebPubSub/read"), - // Display: &armwebpubsub.OperationDisplay{ - // Description: to.Ptr("View the resource settings and configurations in the management portal or through API"), - // Operation: to.Ptr("Manage WebPubSub (read-only)"), - // Provider: to.Ptr("Microsoft.SignalRService"), - // Resource: to.Ptr("WebPubSub"), - // }, - // IsDataAction: to.Ptr(false), - // Properties: &armwebpubsub.OperationProperties{ + // page = armwebpubsub.OperationsClientListResponse{ + // OperationList: armwebpubsub.OperationList{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/example-rg/providers/Microsoft.SignalRService/operations?api-version=2025-01-01-preview&$skipToken=abcd1234"), + // Value: []*armwebpubsub.Operation{ + // { + // Name: to.Ptr("Microsoft.SignalRService/WebPubSub/read"), + // Display: &armwebpubsub.OperationDisplay{ + // Description: to.Ptr("View the resource settings and configurations in the management portal or through API"), + // Operation: to.Ptr("Manage WebPubSub (read-only)"), + // Provider: to.Ptr("Microsoft.SignalRService"), + // Resource: to.Ptr("WebPubSub"), + // }, + // IsDataAction: to.Ptr(false), + // Properties: &armwebpubsub.OperationProperties{ + // }, // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/options.go b/sdk/resourcemanager/webpubsub/armwebpubsub/options.go index 60249c5586c3..0e74d2479912 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/options.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/options.go @@ -1,37 +1,36 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub // ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. type ClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. type ClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. type ClientBeginRegenerateKeyOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. type ClientBeginRestartOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. type ClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -73,7 +72,7 @@ type ClientListSKUsOptions struct { // CustomCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomCertificatesClient.BeginCreateOrUpdate // method. type CustomCertificatesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -95,13 +94,13 @@ type CustomCertificatesClientListOptions struct { // CustomDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomDomainsClient.BeginCreateOrUpdate // method. type CustomDomainsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CustomDomainsClientBeginDeleteOptions contains the optional parameters for the CustomDomainsClient.BeginDelete method. type CustomDomainsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -117,13 +116,13 @@ type CustomDomainsClientListOptions struct { // HubsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubsClient.BeginCreateOrUpdate method. type HubsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // HubsClientBeginDeleteOptions contains the optional parameters for the HubsClient.BeginDelete method. type HubsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -145,7 +144,7 @@ type OperationsClientListOptions struct { // PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -176,7 +175,7 @@ type PrivateLinkResourcesClientListOptions struct { // ReplicaSharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicaSharedPrivateLinkResourcesClient.BeginCreateOrUpdate // method. type ReplicaSharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -194,19 +193,19 @@ type ReplicaSharedPrivateLinkResourcesClientListOptions struct { // ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate method. type ReplicasClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation 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. + // Resumes the long-running operation 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. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -228,14 +227,14 @@ type ReplicasClientListOptions struct { // SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate // method. type SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete // method. type SharedPrivateLinkResourcesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go b/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go index bb900e340ec5..c845f9ef42e4 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go @@ -1,12 +1,99 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub import "encoding/json" +func unmarshalClientConnectionCountRuleClassification(rawMsg json.RawMessage) (ClientConnectionCountRuleClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ClientConnectionCountRuleClassification + switch m["type"] { + case string(ClientConnectionCountRuleDiscriminatorThrottleByJwtCustomClaimRule): + b = &ThrottleByJwtCustomClaimRule{} + case string(ClientConnectionCountRuleDiscriminatorThrottleByJwtSignatureRule): + b = &ThrottleByJwtSignatureRule{} + case string(ClientConnectionCountRuleDiscriminatorThrottleByUserIDRule): + b = &ThrottleByUserIDRule{} + default: + b = &ClientConnectionCountRule{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalClientConnectionCountRuleClassificationArray(rawMsg json.RawMessage) ([]ClientConnectionCountRuleClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ClientConnectionCountRuleClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalClientConnectionCountRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalClientTrafficControlRuleClassification(rawMsg json.RawMessage) (ClientTrafficControlRuleClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ClientTrafficControlRuleClassification + switch m["type"] { + case string(ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtCustomClaimRule): + b = &TrafficThrottleByJwtCustomClaimRule{} + case string(ClientTrafficControlRuleDiscriminatorTrafficThrottleByJwtSignatureRule): + b = &TrafficThrottleByJwtSignatureRule{} + case string(ClientTrafficControlRuleDiscriminatorTrafficThrottleByUserIDRule): + b = &TrafficThrottleByUserIDRule{} + default: + b = &ClientTrafficControlRule{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalClientTrafficControlRuleClassificationArray(rawMsg json.RawMessage) ([]ClientTrafficControlRuleClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ClientTrafficControlRuleClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalClientTrafficControlRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + func unmarshalEventListenerEndpointClassification(rawMsg json.RawMessage) (EventListenerEndpointClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go index 5db4b27b0bee..22dea504baa0 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// PrivateEndpointConnectionsClient contains the methods for the WebPubSubPrivateEndpointConnections group. +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. // Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. type PrivateEndpointConnectionsClient struct { internal *arm.Client @@ -27,7 +26,7 @@ type PrivateEndpointConnectionsClient struct { // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,21 +42,20 @@ 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 2024-03-01 -// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure 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) { +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -70,14 +68,14 @@ 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 2024-03-01 -func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2025-01-01-preview +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) if err != nil { return nil, err } @@ -93,12 +91,8 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - if privateEndpointConnectionName == "" { - 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") } @@ -111,33 +105,36 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 -// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure 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) { +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { var err error const operationName = "PrivateEndpointConnectionsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } @@ -154,12 +151,8 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, private } // getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - if privateEndpointConnectionName == "" { - 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") } @@ -172,12 +165,16 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -194,7 +191,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List private endpoint connections // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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 @@ -223,7 +220,7 @@ 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) { +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -242,7 +239,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -260,20 +257,20 @@ 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 2024-03-01 -// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure 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) { +func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { var err error const operationName = "PrivateEndpointConnectionsClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, parameters, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, parameters, options) if err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err } @@ -290,12 +287,8 @@ func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, priv } // updateCreateRequest creates the Update request. -func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, _ *PrivateEndpointConnectionsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}" - if privateEndpointConnectionName == "" { - 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") } @@ -308,14 +301,19 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go index 3ec205527120..1122ba18c195 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go @@ -1,106 +1,70 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubPrivateEndpointConnections_List.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateEndpointConnectionList = armwebpubsub.PrivateEndpointConnectionList{ - // Value: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("webpubsub")}, - // 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), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // } + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "myResourceGroup", "myWebPubSubService", "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.PrivateEndpointConnectionsClientDeleteResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubPrivateEndpointConnections_Get.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "myWebPubSubService", nil) + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armwebpubsub.PrivateEndpointConnection{ - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("webpubsub")}, + // res = armwebpubsub.PrivateEndpointConnectionsClientGetResponse{ + // PrivateEndpointConnection: &armwebpubsub.PrivateEndpointConnection{ + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ + // GroupIDs: []*string{ + // to.Ptr("webpubsub"), + // }, // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), // }, @@ -110,21 +74,87 @@ func ExamplePrivateEndpointConnectionsClient_Get() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // } + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-01-preview/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() + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.PrivateEndpointConnectionsClientListResponse{ + // PrivateEndpointConnectionList: armwebpubsub.PrivateEndpointConnectionList{ + // Value: []*armwebpubsub.PrivateEndpointConnection{ + // { + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ + // GroupIDs: []*string{ + // to.Ptr("webpubsub"), + // }, + // 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), + // }, + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // }, + // }, + // }, + // } + } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubPrivateEndpointConnections_Update.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Update(ctx, "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "myWebPubSubService", armwebpubsub.PrivateEndpointConnection{ + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Update(ctx, "myResourceGroup", "myWebPubSubService", "mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", armwebpubsub.PrivateEndpointConnection{ Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ PrivateEndpoint: &armwebpubsub.PrivateEndpoint{}, PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ @@ -139,21 +169,15 @@ func ExamplePrivateEndpointConnectionsClient_Update() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armwebpubsub.PrivateEndpointConnection{ - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("webpubsub")}, + // res = armwebpubsub.PrivateEndpointConnectionsClientUpdateResponse{ + // PrivateEndpointConnection: &armwebpubsub.PrivateEndpointConnection{ + // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), + // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ + // GroupIDs: []*string{ + // to.Ptr("webpubsub"), + // }, // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), // }, @@ -163,26 +187,14 @@ func ExamplePrivateEndpointConnectionsClient_Update() { // }, // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().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) - } + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go index f0cdee790671..78733f7eb863 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// PrivateLinkResourcesClient contains the methods for the WebPubSubPrivateLinkResources group. +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. // Don't use this type directly, use NewPrivateLinkResourcesClient() instead. type PrivateLinkResourcesClient struct { internal *arm.Client @@ -27,7 +26,7 @@ type PrivateLinkResourcesClient struct { // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,7 +41,7 @@ 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 2024-03-01 +// Generated from API version 2025-01-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 @@ -71,7 +70,7 @@ 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) { +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -90,7 +89,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 index f85dcb5b8385..b83560fc4fa7 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go @@ -1,27 +1,24 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubPrivateLinkResources_List.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,45 +33,52 @@ func ExamplePrivateLinkResourcesClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PrivateLinkResourceList = armwebpubsub.PrivateLinkResourceList{ - // Value: []*armwebpubsub.PrivateLinkResource{ - // { - // Name: to.Ptr("myPrivateLink"), - // Type: to.Ptr("privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateLinkResources/myPrivateLink"), - // Properties: &armwebpubsub.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("webpubsub"), - // RequiredMembers: []*string{ - // to.Ptr("webpubsub")}, + // page = armwebpubsub.PrivateLinkResourcesClientListResponse{ + // PrivateLinkResourceList: armwebpubsub.PrivateLinkResourceList{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToMoreResults..."), + // Value: []*armwebpubsub.PrivateLinkResource{ + // { + // Name: to.Ptr("myPrivateLink"), + // Type: to.Ptr("privateLinkResources"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateLinkResources/myPrivateLink"), + // Properties: &armwebpubsub.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("webpubsub"), + // RequiredMembers: []*string{ + // to.Ptr("webpubsub"), + // }, // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.webpubsub.azure.com")}, - // ShareablePrivateLinkResourceTypes: []*armwebpubsub.ShareablePrivateLinkResourceType{ - // { - // Name: to.Ptr("site"), - // Properties: &armwebpubsub.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.Web/sites"), - // Description: to.Ptr("Azure App Service can be used as an upstream"), - // GroupID: to.Ptr("sites"), - // }, + // to.Ptr("privatelink.webpubsub.azure.com"), + // }, + // ShareablePrivateLinkResourceTypes: []*armwebpubsub.ShareablePrivateLinkResourceType{ + // { + // Name: to.Ptr("site"), + // Properties: &armwebpubsub.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.Web/sites"), + // Description: to.Ptr("Azure App Service can be used as an upstream"), + // GroupID: to.Ptr("sites"), + // }, + // }, + // { + // Name: to.Ptr("vault"), + // Properties: &armwebpubsub.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.KeyVault/vaults"), + // Description: to.Ptr("Azure Key Vault can be used as credentials store"), + // GroupID: to.Ptr("vault"), // }, - // { - // Name: to.Ptr("vault"), - // Properties: &armwebpubsub.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.KeyVault/vaults"), - // Description: to.Ptr("Azure Key Vault can be used as credentials store"), - // GroupID: to.Ptr("vault"), - // }, + // }, + // { + // Name: to.Ptr("table"), + // Properties: &armwebpubsub.ShareablePrivateLinkResourceProperties{ + // Type: to.Ptr("Microsoft.Storage/storageAccounts"), + // Description: to.Ptr("Azure Storage Table can be used as message store"), + // GroupID: to.Ptr("table"), // }, - // { - // Name: to.Ptr("table"), - // Properties: &armwebpubsub.ShareablePrivateLinkResourceProperties{ - // Type: to.Ptr("Microsoft.Storage/storageAccounts"), - // Description: to.Ptr("Azure Storage Table can be used as message store"), - // GroupID: to.Ptr("table"), - // }, - // }}, + // }, // }, - // }}, - // } + // }, + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go index dbfc44a7b747..dc13f1e3dc5d 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// ReplicasClient contains the methods for the WebPubSubReplicas group. +// ReplicasClient contains the methods for the Replicas group. // Don't use this type directly, use NewReplicasClient() instead. type ReplicasClient struct { internal *arm.Client @@ -27,7 +26,7 @@ type ReplicasClient struct { // 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicasClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create or update a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -57,8 +56,7 @@ func (client *ReplicasClient) BeginCreateOrUpdate(ctx context.Context, resourceG return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -71,7 +69,7 @@ func (client *ReplicasClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *ReplicasClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginCreateOrUpdate" @@ -94,7 +92,7 @@ func (client *ReplicasClient) createOrUpdate(ctx context.Context, resourceGroupN } // 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) { +func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, _ *ReplicasClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -117,9 +115,10 @@ func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -129,7 +128,7 @@ func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, r // Delete - Operation to delete a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -156,7 +155,7 @@ func (client *ReplicasClient) Delete(ctx context.Context, resourceGroupName stri } // deleteCreateRequest creates the Delete request. -func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientDeleteOptions) (*policy.Request, error) { +func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, _ *ReplicasClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -179,16 +178,15 @@ func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 2024-03-01 +// Generated from API version 2025-01-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. @@ -216,7 +214,7 @@ func (client *ReplicasClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientGetOptions) (*policy.Request, error) { +func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, _ *ReplicasClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -239,7 +237,7 @@ func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -256,7 +254,7 @@ func (client *ReplicasClient) getHandleResponse(resp *http.Response) (ReplicasCl // NewListPager - List all replicas belong to this resource // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -284,7 +282,7 @@ func (client *ReplicasClient) NewListPager(resourceGroupName string, resourceNam } // listCreateRequest creates the List request. -func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, options *ReplicasClientListOptions) (*policy.Request, error) { +func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *ReplicasClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -303,7 +301,7 @@ func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +319,7 @@ func (client *ReplicasClient) listHandleResponse(resp *http.Response) (ReplicasC // BeginRestart - Operation to restart a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -333,8 +331,7 @@ func (client *ReplicasClient) BeginRestart(ctx context.Context, resourceGroupNam return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientRestartResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -347,7 +344,7 @@ func (client *ReplicasClient) BeginRestart(ctx context.Context, resourceGroupNam // Restart - Operation to restart a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *ReplicasClient) restart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginRestart" @@ -370,7 +367,7 @@ func (client *ReplicasClient) restart(ctx context.Context, resourceGroupName str } // restartCreateRequest creates the Restart request. -func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*policy.Request, error) { +func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, _ *ReplicasClientBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/restart" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -393,16 +390,15 @@ func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 2024-03-01 +// Generated from API version 2025-01-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. @@ -415,8 +411,7 @@ func (client *ReplicasClient) BeginUpdate(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -429,7 +424,7 @@ func (client *ReplicasClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Operation to update an exiting replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *ReplicasClient) update(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginUpdate" @@ -452,7 +447,7 @@ func (client *ReplicasClient) update(ctx context.Context, resourceGroupName stri } // 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) { +func (client *ReplicasClient) updateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, _ *ReplicasClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -475,9 +470,10 @@ func (client *ReplicasClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go index e076dd2c2936..5d7be2efb683 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go @@ -1,222 +1,249 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicas_List.json -func ExampleReplicasClient_NewListPager() { +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicas_CreateOrUpdate.json +func ExampleReplicasClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewReplicasClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReplicaList = armwebpubsub.ReplicaList{ - // Value: []*armwebpubsub.Replica{ - // { - // Name: to.Ptr("myWebPubSubService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, - // }}, - // } + poller, err := clientFactory.NewReplicasClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", armwebpubsub.Replica{ + Location: to.Ptr("eastus"), + Properties: &armwebpubsub.ReplicaProperties{ + ResourceStopped: to.Ptr("false"), + }, + SKU: &armwebpubsub.ResourceSKU{ + Name: to.Ptr("Premium_P1"), + Capacity: to.Ptr[int32](1), + Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + }, + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.ReplicasClientCreateOrUpdateResponse{ + // Replica: &armwebpubsub.Replica{ + // Name: to.Ptr("myWebPubSubService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.ReplicaProperties{ + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicas_Get.json -func ExampleReplicasClient_Get() { +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicas_Delete.json +func ExampleReplicasClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewReplicasClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", nil) + res, err := clientFactory.NewReplicasClient().Delete(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Replica = armwebpubsub.Replica{ - // Name: to.Ptr("myWebPubSubService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, + // res = armwebpubsub.ReplicasClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicas_CreateOrUpdate.json -func ExampleReplicasClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicas_Get.json +func ExampleReplicasClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewReplicasClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", armwebpubsub.Replica{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armwebpubsub.ReplicaProperties{ - ResourceStopped: to.Ptr("false"), - }, - SKU: &armwebpubsub.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - }, - }, nil) + res, err := clientFactory.NewReplicasClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Replica = armwebpubsub.Replica{ - // Name: to.Ptr("myWebPubSubService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // res = armwebpubsub.ReplicasClientGetResponse{ + // Replica: &armwebpubsub.Replica{ + // Name: to.Ptr("myWebPubSubService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.ReplicaProperties{ + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicas_Delete.json -func ExampleReplicasClient_Delete() { +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicas_List.json +func ExampleReplicasClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewReplicasClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.ReplicasClientListResponse{ + // ReplicaList: armwebpubsub.ReplicaList{ + // Value: []*armwebpubsub.Replica{ + // { + // Name: to.Ptr("myWebPubSubService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.ReplicaProperties{ + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicas_Restart.json +func ExampleReplicasClient_BeginRestart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewReplicasClient().Delete(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", nil) + poller, err := clientFactory.NewReplicasClient().BeginRestart(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicas_Update.json +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicas_Update.json func ExampleReplicasClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewReplicasClient().BeginUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", armwebpubsub.Replica{ Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, Properties: &armwebpubsub.ReplicaProperties{ ResourceStopped: to.Ptr("false"), }, @@ -225,6 +252,9 @@ func ExampleReplicasClient_BeginUpdate() { Capacity: to.Ptr[int32](1), Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), }, + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -236,53 +266,34 @@ func ExampleReplicasClient_BeginUpdate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Replica = armwebpubsub.Replica{ - // Name: to.Ptr("myWebPubSubService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // res = armwebpubsub.ReplicasClientUpdateResponse{ + // Replica: &armwebpubsub.Replica{ + // Name: to.Ptr("myWebPubSubService-eastus"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), + // Location: to.Ptr("eastus"), + // Properties: &armwebpubsub.ReplicaProperties{ + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RegionEndpointEnabled: to.Ptr("Enabled"), + // ResourceStopped: to.Ptr("false"), + // }, + // SKU: &armwebpubsub.ResourceSKU{ + // Name: to.Ptr("Premium_P1"), + // Capacity: to.Ptr[int32](1), + // Size: to.Ptr("P1"), + // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), + // }, + // SystemData: &armwebpubsub.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // CreatedBy: to.Ptr("string"), + // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06Z"); return t}()), + // LastModifiedBy: to.Ptr("string"), + // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // }, // }, // } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicas_Restart.json -func ExampleReplicasClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicasClient().BeginRestart(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", 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/replicasharedprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicasharedprivatelinkresources_client.go index ef12c4ad9745..cc877f385c74 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/replicasharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicasharedprivatelinkresources_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// ReplicaSharedPrivateLinkResourcesClient contains the methods for the WebPubSubReplicaSharedPrivateLinkResources group. +// ReplicaSharedPrivateLinkResourcesClient contains the methods for the ReplicaSharedPrivateLinkResources group. // Don't use this type directly, use NewReplicaSharedPrivateLinkResourcesClient() instead. type ReplicaSharedPrivateLinkResourcesClient struct { internal *arm.Client @@ -27,7 +26,7 @@ type ReplicaSharedPrivateLinkResourcesClient struct { // NewReplicaSharedPrivateLinkResourcesClient creates a new instance of ReplicaSharedPrivateLinkResourcesClient 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewReplicaSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicaSharedPrivateLinkResourcesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewReplicaSharedPrivateLinkResourcesClient(subscriptionID string, credentia // BeginCreateOrUpdate - Create or update a shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -58,8 +57,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx c return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicaSharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,7 +70,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx c // CreateOrUpdate - Create or update a shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-01-preview func (client *ReplicaSharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *ReplicaSharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicaSharedPrivateLinkResourcesClient.BeginCreateOrUpdate" @@ -95,7 +93,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) createOrUpdate(ctx contex } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ReplicaSharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *ReplicaSharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ReplicaSharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, _ *ReplicaSharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,9 +120,10 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) createOrUpdateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -134,7 +133,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) createOrUpdateCreateReque // Get - Get the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -164,7 +163,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) Get(ctx context.Context, } // getCreateRequest creates the Get request. -func (client *ReplicaSharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, options *ReplicaSharedPrivateLinkResourcesClientGetOptions) (*policy.Request, error) { +func (client *ReplicaSharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, _ *ReplicaSharedPrivateLinkResourcesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -191,7 +190,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -208,7 +207,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) getHandleResponse(resp *h // NewListPager - List shared private link resources // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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. @@ -238,7 +237,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) NewListPager(resourceGrou } // listCreateRequest creates the List request. -func (client *ReplicaSharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicaSharedPrivateLinkResourcesClientListOptions) (*policy.Request, error) { +func (client *ReplicaSharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, _ *ReplicaSharedPrivateLinkResourcesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -261,7 +260,7 @@ func (client *ReplicaSharedPrivateLinkResourcesClient) listCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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/replicasharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicasharedprivatelinkresources_client_example_test.go index 96ae7e9c60b9..e0cb7e04f86b 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/replicasharedprivatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicasharedprivatelinkresources_client_example_test.go @@ -1,68 +1,69 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicaSharedPrivateLinkResources_List.json -func ExampleReplicaSharedPrivateLinkResourcesClient_NewListPager() { +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicaSharedPrivateLinkResources_CreateOrUpdate.json +func ExampleReplicaSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewReplicaSharedPrivateLinkResourcesClient().NewListPager("myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedPrivateLinkResourceList = armwebpubsub.SharedPrivateLinkResourceList{ - // Value: []*armwebpubsub.SharedPrivateLinkResource{ - // { - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), - // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), - // }, - // }}, - // } + poller, err := clientFactory.NewReplicaSharedPrivateLinkResourcesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", "upstream", 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) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.ReplicaSharedPrivateLinkResourcesClientCreateOrUpdateResponse{ + // SharedPrivateLinkResource: &armwebpubsub.SharedPrivateLinkResource{ + // Name: to.Ptr("upstream"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), + // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("sites"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Please approve"), + // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicaSharedPrivateLinkResources_Get.json +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicaSharedPrivateLinkResources_Get.json func ExampleReplicaSharedPrivateLinkResourcesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -73,58 +74,61 @@ func ExampleReplicaSharedPrivateLinkResourcesClient_Get() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedPrivateLinkResource = armwebpubsub.SharedPrivateLinkResource{ - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), - // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), + // res = armwebpubsub.ReplicaSharedPrivateLinkResourcesClientGetResponse{ + // SharedPrivateLinkResource: &armwebpubsub.SharedPrivateLinkResource{ + // Name: to.Ptr("upstream"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), + // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("sites"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Please approve"), + // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubReplicaSharedPrivateLinkResources_CreateOrUpdate.json -func ExampleReplicaSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-01-01-preview/WebPubSubReplicaSharedPrivateLinkResources_List.json +func ExampleReplicaSharedPrivateLinkResourcesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewReplicaSharedPrivateLinkResourcesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", "upstream", 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) + pager := clientFactory.NewReplicaSharedPrivateLinkResourcesClient().NewListPager("myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.ReplicaSharedPrivateLinkResourcesClientListResponse{ + // SharedPrivateLinkResourceList: armwebpubsub.SharedPrivateLinkResourceList{ + // Value: []*armwebpubsub.SharedPrivateLinkResource{ + // { + // Name: to.Ptr("upstream"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), + // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("sites"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Please approve"), + // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), + // }, + // }, + // }, + // }, + // } } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedPrivateLinkResource = armwebpubsub.SharedPrivateLinkResource{ - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), - // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), - // }, - // } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/responses.go b/sdk/resourcemanager/webpubsub/armwebpubsub/responses.go index c615bd250b39..a4152ebf5147 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/responses.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/responses.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -146,7 +145,7 @@ type HubsClientListResponse struct { // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // Result of the request to list REST API operations. It contains a list of operations. + // Paged collection of Operation items OperationList } @@ -216,6 +215,7 @@ type ReplicasClientGetResponse struct { // ReplicasClientListResponse contains the response from method ReplicasClient.NewListPager. type ReplicasClientListResponse struct { + // Paged collection of Replica items ReplicaList } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go index cca3bb761192..1260a5457141 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -17,7 +16,7 @@ import ( "strings" ) -// SharedPrivateLinkResourcesClient contains the methods for the WebPubSubSharedPrivateLinkResources group. +// SharedPrivateLinkResourcesClient contains the methods for the SharedPrivateLinkResources group. // Don't use this type directly, use NewSharedPrivateLinkResourcesClient() instead. type SharedPrivateLinkResourcesClient struct { internal *arm.Client @@ -27,7 +26,7 @@ type SharedPrivateLinkResourcesClient struct { // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedPrivateLinkResourcesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,22 +42,21 @@ 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 2024-03-01 -// - sharedPrivateLinkResourceName - The name of the shared private link resource. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - sharedPrivateLinkResourceName - The name of the shared private link 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) { +func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*runtime.Poller[SharedPrivateLinkResourcesClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, resourceName, sharedPrivateLinkResourceName, parameters, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -71,14 +69,14 @@ 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 2024-03-01 -func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-01-01-preview +func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, sharedPrivateLinkResourceName, parameters, options) if err != nil { return nil, err } @@ -94,12 +92,8 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Conte } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, _ *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" - if sharedPrivateLinkResourceName == "" { - 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") } @@ -112,14 +106,19 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { return nil, err } @@ -129,21 +128,20 @@ 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 2024-03-01 -// - sharedPrivateLinkResourceName - The name of the shared private link resource. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - sharedPrivateLinkResourceName - The name of the shared private link 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) { +func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*runtime.Poller[SharedPrivateLinkResourcesClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, resourceName, sharedPrivateLinkResourceName, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -156,14 +154,14 @@ 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 2024-03-01 -func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2025-01-01-preview +func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) + req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, sharedPrivateLinkResourceName, options) if err != nil { return nil, err } @@ -179,12 +177,8 @@ func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, _ *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" - if sharedPrivateLinkResourceName == "" { - 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") } @@ -197,33 +191,36 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01 -// - sharedPrivateLinkResourceName - The name of the shared private link resource. +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. +// - sharedPrivateLinkResourceName - The name of the shared private link 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) { +func (client *SharedPrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, options *SharedPrivateLinkResourcesClientGetOptions) (SharedPrivateLinkResourcesClientGetResponse, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, sharedPrivateLinkResourceName, options) if err != nil { return SharedPrivateLinkResourcesClientGetResponse{}, err } @@ -240,12 +237,8 @@ func (client *SharedPrivateLinkResourcesClient) Get(ctx context.Context, sharedP } // getCreateRequest creates the Get request. -func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientGetOptions) (*policy.Request, error) { +func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, sharedPrivateLinkResourceName string, _ *SharedPrivateLinkResourcesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" - if sharedPrivateLinkResourceName == "" { - 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") } @@ -258,12 +251,16 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter resourceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +277,7 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res // NewListPager - List shared private link resources // -// Generated from API version 2024-03-01 +// Generated from API version 2025-01-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 @@ -309,7 +306,7 @@ 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) { +func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, _ *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") @@ -328,7 +325,7 @@ func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 index afcf39d21584..e2d9c01a15e5 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go @@ -1,151 +1,160 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubSharedPrivateLinkResources_List.json -func ExampleSharedPrivateLinkResourcesClient_NewListPager() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewSharedPrivateLinkResourcesClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SharedPrivateLinkResourceList = armwebpubsub.SharedPrivateLinkResourceList{ - // Value: []*armwebpubsub.SharedPrivateLinkResource{ - // { - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), - // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), - // }, - // }}, - // } + poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myWebPubSubService", "upstream", 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) } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armwebpubsub.SharedPrivateLinkResourcesClientCreateOrUpdateResponse{ + // SharedPrivateLinkResource: &armwebpubsub.SharedPrivateLinkResource{ + // Name: to.Ptr("upstream"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), + // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("sites"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Please approve"), + // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubSharedPrivateLinkResources_Get.json -func ExampleSharedPrivateLinkResourcesClient_Get() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSharedPrivateLinkResourcesClient().Get(ctx, "upstream", "myResourceGroup", "myWebPubSubService", nil) + poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().BeginDelete(ctx, "myResourceGroup", "myWebPubSubService", "upstream", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedPrivateLinkResource = armwebpubsub.SharedPrivateLinkResource{ - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), - // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), - // }, + // res = armwebpubsub.SharedPrivateLinkResourcesClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json -func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().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) + res, err := clientFactory.NewSharedPrivateLinkResourcesClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "upstream", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SharedPrivateLinkResource = armwebpubsub.SharedPrivateLinkResource{ - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), - // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), + // res = armwebpubsub.SharedPrivateLinkResourcesClientGetResponse{ + // SharedPrivateLinkResource: &armwebpubsub.SharedPrivateLinkResource{ + // Name: to.Ptr("upstream"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), + // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("sites"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Please approve"), + // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/WebPubSubSharedPrivateLinkResources_Delete.json -func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().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) + pager := clientFactory.NewSharedPrivateLinkResourcesClient().NewListPager("myResourceGroup", "myWebPubSubService", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armwebpubsub.SharedPrivateLinkResourcesClientListResponse{ + // SharedPrivateLinkResourceList: armwebpubsub.SharedPrivateLinkResourceList{ + // Value: []*armwebpubsub.SharedPrivateLinkResource{ + // { + // Name: to.Ptr("upstream"), + // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/upstream"), + // Properties: &armwebpubsub.SharedPrivateLinkResourceProperties{ + // GroupID: to.Ptr("sites"), + // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), + // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), + // RequestMessage: to.Ptr("Please approve"), + // Status: to.Ptr(armwebpubsub.SharedPrivateLinkResourceStatusApproved), + // }, + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/testdata/_metadata.json b/sdk/resourcemanager/webpubsub/armwebpubsub/testdata/_metadata.json new file mode 100644 index 000000000000..46c04f4a0332 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/testdata/_metadata.json @@ -0,0 +1,6 @@ +{ + "apiVersions": { + "Microsoft.SignalRService": "2025-01-01-preview" + }, + "emitterVersion": "0.10.2" +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go b/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go deleted file mode 100644 index 7ba7f3218445..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armwebpubsub - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/tsp-location.yaml b/sdk/resourcemanager/webpubsub/armwebpubsub/tsp-location.yaml new file mode 100644 index 000000000000..0059dba462ff --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/webpubsub/resource-manager/Microsoft.SignalRService/SignalRService +commit: aa822c9c01b9e83fbc8ad8ec4c308203a3c29287 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go index a1a1dbf463b4..cf5ad3df20fe 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armwebpubsub @@ -27,7 +26,7 @@ type UsagesClient struct { // NewUsagesClient creates a new instance of UsagesClient 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UsagesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -42,8 +41,8 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - List resource usage quotas by location. // -// Generated from API version 2024-03-01 -// - location - the location like "eastus" +// Generated from API version 2025-01-01-preview +// - location - The location name. // - 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]{ @@ -69,22 +68,22 @@ func (client *UsagesClient) NewListPager(location string, options *UsagesClientL } // listCreateRequest creates the List request. -func (client *UsagesClient) listCreateRequest(ctx context.Context, location string, options *UsagesClientListOptions) (*policy.Request, error) { +func (client *UsagesClient) listCreateRequest(ctx context.Context, location string, _ *UsagesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages" - if location == "" { - 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)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01") + reqQP.Set("api-version", "2025-01-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 index 374f2ae996c0..4879421f08b6 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go @@ -1,27 +1,24 @@ // 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. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. 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" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7189fb57f69468c56df76f9a4d68dd9ff04ab100/specification/webpubsub/resource-manager/Microsoft.SignalRService/stable/2024-03-01/examples/Usages_List.json +// Generated from example definition: 2025-01-01-preview/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() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) + clientFactory, err := armwebpubsub.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -36,28 +33,32 @@ func ExampleUsagesClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.SignalRServiceUsageList = armwebpubsub.SignalRServiceUsageList{ - // Value: []*armwebpubsub.SignalRServiceUsage{ - // { - // Name: &armwebpubsub.SignalRServiceUsageName{ - // LocalizedValue: to.Ptr("Usage1"), - // Value: to.Ptr("Usage1"), + // page = armwebpubsub.UsagesClientListResponse{ + // SignalRServiceUsageList: armwebpubsub.SignalRServiceUsageList{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToMoreResults..."), + // Value: []*armwebpubsub.SignalRServiceUsage{ + // { + // Name: &armwebpubsub.SignalRServiceUsageName{ + // LocalizedValue: to.Ptr("Usage1"), + // Value: to.Ptr("Usage1"), + // }, + // CurrentValue: to.Ptr[int64](0), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SignalRService/locations/eastus/usages/Usage1"), + // Limit: to.Ptr[int64](100), + // Unit: to.Ptr("Count"), // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SignalRService/locations/eastus/usages/Usage1"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr("Count"), - // }, - // { - // Name: &armwebpubsub.SignalRServiceUsageName{ - // LocalizedValue: to.Ptr("Usage2"), - // Value: to.Ptr("Usage2"), + // { + // Name: &armwebpubsub.SignalRServiceUsageName{ + // LocalizedValue: to.Ptr("Usage2"), + // Value: to.Ptr("Usage2"), + // }, + // CurrentValue: to.Ptr[int64](0), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SignalRService/locations/eastus/usages/Usage2"), + // Limit: to.Ptr[int64](100), + // Unit: to.Ptr("Count"), // }, - // CurrentValue: to.Ptr[int64](0), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SignalRService/locations/eastus/usages/Usage2"), - // Limit: to.Ptr[int64](100), - // Unit: to.Ptr("Count"), - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/version.go b/sdk/resourcemanager/webpubsub/armwebpubsub/version.go new file mode 100644 index 000000000000..fdf3ed36e609 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/version.go @@ -0,0 +1,10 @@ +// 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) Go Code Generator. + +package armwebpubsub + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + moduleVersion = "v2.0.0-beta.1" +) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/webpubsub_live_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/webpubsub_live_test.go index 416a31349fac..e3e77537f172 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/webpubsub_live_test.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/webpubsub_live_test.go @@ -14,7 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub/v2" "github.com/stretchr/testify/suite" )