diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md index ec9384ecaf5f..1189c4178bb5 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md @@ -1,5 +1,14 @@ # Release History +## 1.2.0-beta.2 (2023-08-18) +### Features Added + +- New struct `IPRule` +- New field `IPRules` in struct `NetworkACLs` +- New field `RegionEndpointEnabled`, `ResourceStopped` in struct `Properties` +- New field `RegionEndpointEnabled`, `ResourceStopped` in struct `ReplicaProperties` + + ## 1.2.0-beta.1 (2023-07-28) ### Features Added diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md index e9a6d3ff0f48..1a4d68a4b900 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/webpubsub/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/webpubsub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0-beta.1 -tag: package-2023-06-01-preview +module-version: 1.2.0-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go index d500f97fe446..a4eb8708b520 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -47,23 +46,26 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - location - the region // - parameters - Parameters supplied to the operation. // - options - ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. func (client *Client) CheckNameAvailability(ctx context.Context, location string, parameters NameAvailabilityParameters, options *ClientCheckNameAvailabilityOptions) (ClientCheckNameAvailabilityResponse, error) { + var err error req, err := client.checkNameAvailabilityCreateRequest(ctx, location, parameters, options) if err != nil { return ClientCheckNameAvailabilityResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientCheckNameAvailabilityResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientCheckNameAvailabilityResponse{}, err } - return client.checkNameAvailabilityHandleResponse(resp) + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. @@ -79,10 +81,13 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. @@ -97,7 +102,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 2023-06-01-preview +// Generated from API version 2023-08-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 @@ -108,9 +113,10 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -119,20 +125,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -152,16 +160,19 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -171,9 +182,10 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -182,20 +194,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -215,7 +229,7 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -224,23 +238,26 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName // Get - Get the resource and its properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceGroupName string, resourceName string, options *ClientGetOptions) (ClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -260,7 +277,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +294,7 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // NewListByResourceGroupPager - Handles requests to list all resources in a resource group. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -322,7 +339,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -339,7 +356,7 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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]{ @@ -378,7 +395,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -396,23 +413,26 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. func (client *Client) ListKeys(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListKeysOptions) (ClientListKeysResponse, error) { + var err error req, err := client.listKeysCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ClientListKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientListKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientListKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientListKeysResponse{}, err } - return client.listKeysHandleResponse(resp) + resp, err := client.listKeysHandleResponse(httpResp) + return resp, err } // listKeysCreateRequest creates the ListKeys request. @@ -432,7 +452,7 @@ func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -450,24 +470,27 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. // - options - ClientListReplicaSKUsOptions contains the optional parameters for the Client.ListReplicaSKUs method. func (client *Client) ListReplicaSKUs(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ClientListReplicaSKUsOptions) (ClientListReplicaSKUsResponse, error) { + var err error req, err := client.listReplicaSKUsCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) if err != nil { return ClientListReplicaSKUsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientListReplicaSKUsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientListReplicaSKUsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientListReplicaSKUsResponse{}, err } - return client.listReplicaSKUsHandleResponse(resp) + resp, err := client.listReplicaSKUsHandleResponse(httpResp) + return resp, err } // listReplicaSKUsCreateRequest creates the ListReplicaSKUs request. @@ -491,7 +514,7 @@ func (client *Client) listReplicaSKUsCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -509,23 +532,26 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. func (client *Client) ListSKUs(ctx context.Context, resourceGroupName string, resourceName string, options *ClientListSKUsOptions) (ClientListSKUsResponse, error) { + var err error req, err := client.listSKUsCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return ClientListSKUsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientListSKUsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientListSKUsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientListSKUsResponse{}, err } - return client.listSKUsHandleResponse(resp) + resp, err := client.listSKUsHandleResponse(httpResp) + return resp, err } // listSKUsCreateRequest creates the ListSKUs request. @@ -545,7 +571,7 @@ func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -564,7 +590,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 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -575,9 +601,10 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRegenerateKeyResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRegenerateKeyResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -587,20 +614,22 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName // time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *Client) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*http.Response, error) { + var err error req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // regenerateKeyCreateRequest creates the RegenerateKey request. @@ -620,16 +649,19 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginRestart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -639,9 +671,10 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRestartResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientRestartResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -650,20 +683,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *Client) restart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*http.Response, error) { + var err error req, err := client.restartCreateRequest(ctx, resourceGroupName, resourceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // restartCreateRequest creates the Restart request. @@ -683,7 +718,7 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -692,7 +727,7 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam // BeginUpdate - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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 @@ -703,9 +738,10 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -714,20 +750,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -747,8 +785,11 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go deleted file mode 100644 index faa6a28ce2d0..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go +++ /dev/null @@ -1,1032 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_CheckNameAvailability.json -func ExampleClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().CheckNameAvailability(ctx, "eastus", armwebpubsub.NameAvailabilityParameters{ - Name: to.Ptr("myWebPubSubService"), - Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_ListBySubscription.json -func ExampleClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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: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), - // }, - // 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), - // 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: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), - // }, - // 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), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ServerPort: to.Ptr[int32](443), - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_ListByResourceGroup.json -func ExampleClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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: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), - // }, - // 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), - // 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: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), - // }, - // 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), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ServerPort: to.Ptr[int32](443), - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_Get.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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: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), - // }, - // 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), - // 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: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), - // }, - // 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), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ServerPort: to.Ptr[int32](443), - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_CreateOrUpdate.json -func ExampleClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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), - 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"), - TLS: &armwebpubsub.TLSSettings{ - ClientCertEnabled: to.Ptr(false), - }, - }, - SKU: &armwebpubsub.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // 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: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), - // }, - // 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), - // 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: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), - // }, - // 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), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ServerPort: to.Ptr[int32](443), - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_Delete.json -func ExampleClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginDelete(ctx, "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_Update.json -func ExampleClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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"), - TLS: &armwebpubsub.TLSSettings{ - ClientCertEnabled: to.Ptr(false), - }, - }, - SKU: &armwebpubsub.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // 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: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), - // }, - // 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), - // 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: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), - // }, - // 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), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ServerPort: to.Ptr[int32](443), - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_ListKeys.json -func ExampleClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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) - } - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_RegenerateKey.json -func ExampleClient_BeginRegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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.Keys = armwebpubsub.Keys{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().ListReplicaSKUs(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.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), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub/replicas"), - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Free_F1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierFree), - // }, - // }, - // { - // 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.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), - // }, - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_Restart.json -func ExampleClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSub_ListSkus.json -func ExampleClient_ListSKUs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().ListSKUs(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.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), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Free_F1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierFree), - // }, - // }, - // { - // 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.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), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go b/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go index 4149d7a8600c..094baf221169 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -38,21 +37,11 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewClient() *Client { subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewUsagesClient() *UsagesClient { - subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - func (c *ClientFactory) NewCustomCertificatesClient() *CustomCertificatesClient { subClient, _ := NewCustomCertificatesClient(c.subscriptionID, c.credential, c.options) return subClient @@ -68,6 +57,11 @@ func (c *ClientFactory) NewHubsClient() *HubsClient { return subClient } +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) return subClient @@ -87,3 +81,8 @@ func (c *ClientFactory) NewSharedPrivateLinkResourcesClient() *SharedPrivateLink subClient, _ := NewSharedPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } + +func (c *ClientFactory) NewUsagesClient() *UsagesClient { + subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go index 443f20922b3f..a12774e84146 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub const ( moduleName = "armwebpubsub" - moduleVersion = "v1.2.0-beta.1" + moduleVersion = "v1.2.0-beta.2" ) // ACLAction - Azure Networking ACL Action. diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go index 833560eadb33..946263063e99 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -47,7 +46,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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -59,9 +58,10 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomCertificatesClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomCertificatesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CustomCertificatesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-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 req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, certificateName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -107,32 +109,37 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Delete - Delete a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name // - options - CustomCertificatesClientDeleteOptions contains the optional parameters for the CustomCertificatesClient.Delete // method. func (client *CustomCertificatesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, options *CustomCertificatesClientDeleteOptions) (CustomCertificatesClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, certificateName, options) if err != nil { return CustomCertificatesClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CustomCertificatesClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return CustomCertificatesClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CustomCertificatesClientDeleteResponse{}, err } return CustomCertificatesClientDeleteResponse{}, nil } @@ -158,7 +165,7 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -167,24 +174,27 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, // Get - Get a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name // - options - CustomCertificatesClientGetOptions contains the optional parameters for the CustomCertificatesClient.Get method. func (client *CustomCertificatesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, options *CustomCertificatesClientGetOptions) (CustomCertificatesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, certificateName, options) if err != nil { return CustomCertificatesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CustomCertificatesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CustomCertificatesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomCertificatesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -208,7 +218,7 @@ func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -225,7 +235,7 @@ func (client *CustomCertificatesClient) getHandleResponse(resp *http.Response) ( // NewListPager - List all custom certificates. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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 @@ -275,7 +285,7 @@ func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go deleted file mode 100644 index 35377dd2e9d6..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go +++ /dev/null @@ -1,147 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubCustomCertificates_List.json -func ExampleCustomCertificatesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubCustomCertificates_Get.json -func ExampleCustomCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomCertificatesClient().Get(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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubCustomCertificates_CreateOrUpdate.json -func ExampleCustomCertificatesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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) - 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubCustomCertificates_Delete.json -func ExampleCustomCertificatesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go index 257a8ebd786e..800902f749ea 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -47,7 +46,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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -59,9 +58,10 @@ func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, reso if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomDomainsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomDomainsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CustomDomainsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-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 req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, name, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -107,16 +109,19 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -128,9 +133,10 @@ func (client *CustomDomainsClient) BeginDelete(ctx context.Context, resourceGrou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomDomainsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CustomDomainsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[CustomDomainsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,20 +145,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *CustomDomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, name, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -176,7 +184,7 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,24 +193,27 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. // - options - CustomDomainsClientGetOptions contains the optional parameters for the CustomDomainsClient.Get method. func (client *CustomDomainsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientGetOptions) (CustomDomainsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, name, options) if err != nil { return CustomDomainsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return CustomDomainsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CustomDomainsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomDomainsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -226,7 +237,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,7 +254,7 @@ func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (Custo // NewListPager - List all custom domains. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -292,7 +303,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go deleted file mode 100644 index f9ac37f789b8..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go +++ /dev/null @@ -1,138 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubCustomDomains_List.json -func ExampleCustomDomainsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubCustomDomains_Get.json -func ExampleCustomDomainsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomDomainsClient().Get(ctx, "myResourceGroup", "myWebPubSubService", "example", 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.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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubCustomDomains_CreateOrUpdate.json -func ExampleCustomDomainsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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) - 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubCustomDomains_Delete.json -func ExampleCustomDomainsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod index 0edeec57abd8..51c99727d50b 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpub go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.7.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum index 21718b486698..727ce838bdc8 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go index 649571e20679..103ae5a36aae 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -47,7 +46,7 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - hubName - The hub name. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -60,9 +59,10 @@ func (client *HubsClient) BeginCreateOrUpdate(ctx context.Context, hubName strin if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[HubsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *HubsClient) createOrUpdate(ctx context.Context, hubName string, resourceGroupName string, resourceName string, parameters Hub, options *HubsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, hubName, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -108,16 +110,19 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - hubName - The hub name. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -128,9 +133,10 @@ func (client *HubsClient) BeginDelete(ctx context.Context, hubName string, resou if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HubsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[HubsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -139,20 +145,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *HubsClient) deleteOperation(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, hubName, resourceGroupName, resourceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -176,7 +184,7 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -185,24 +193,27 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin // Get - Get a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - hubName - The hub name. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - HubsClientGetOptions contains the optional parameters for the HubsClient.Get method. func (client *HubsClient) Get(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientGetOptions) (HubsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, hubName, resourceGroupName, resourceName, options) if err != nil { return HubsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return HubsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return HubsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HubsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -226,7 +237,7 @@ func (client *HubsClient) getCreateRequest(ctx context.Context, hubName string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,7 +254,7 @@ func (client *HubsClient) getHandleResponse(resp *http.Response) (HubsClientGetR // NewListPager - List hub settings. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -292,7 +303,7 @@ func (client *HubsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go deleted file mode 100644 index 0fdd347e1509..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go +++ /dev/null @@ -1,256 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubHubs_List.json -func ExampleHubsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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("*"), - // }, - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubHubs_Get.json -func ExampleHubsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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("*"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubHubs_CreateOrUpdate.json -func ExampleHubsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewHubsClient().BeginCreateOrUpdate(ctx, "exampleHub", "myResourceGroup", "myWebPubSubService", armwebpubsub.Hub{ - Properties: &armwebpubsub.HubProperties{ - AnonymousConnectPolicy: to.Ptr("allow"), - EventHandlers: []*armwebpubsub.EventHandler{ - { - Auth: &armwebpubsub.UpstreamAuthSettings{ - Type: to.Ptr(armwebpubsub.UpstreamAuthTypeManagedIdentity), - ManagedIdentity: &armwebpubsub.ManagedIdentitySettings{ - Resource: to.Ptr("abc"), - }, - }, - SystemEvents: []*string{ - to.Ptr("connect"), - to.Ptr("connected")}, - URLTemplate: to.Ptr("http://host.com"), - UserEventPattern: to.Ptr("*"), - }}, - EventListeners: []*armwebpubsub.EventListener{ - { - Endpoint: &armwebpubsub.EventHubEndpoint{ - Type: to.Ptr(armwebpubsub.EventListenerEndpointDiscriminatorEventHub), - EventHubName: to.Ptr("eventHubName1"), - FullyQualifiedNamespace: to.Ptr("example.servicebus.windows.net"), - }, - Filter: &armwebpubsub.EventNameFilter{ - Type: to.Ptr(armwebpubsub.EventListenerFilterDiscriminatorEventName), - SystemEvents: []*string{ - to.Ptr("connected"), - to.Ptr("disconnected")}, - UserEventPattern: to.Ptr("*"), - }, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // 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("*"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubHubs_Delete.json -func ExampleHubsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewHubsClient().BeginDelete(ctx, "exampleHub", "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/interfaces.go b/sdk/resourcemanager/webpubsub/armwebpubsub/interfaces.go new file mode 100644 index 000000000000..86b63c44cfca --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/interfaces.go @@ -0,0 +1,27 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armwebpubsub + +// 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: +// - *EventHubEndpoint, *EventListenerEndpoint +type EventListenerEndpointClassification interface { + // GetEventListenerEndpoint returns the EventListenerEndpoint content of the underlying type. + GetEventListenerEndpoint() *EventListenerEndpoint +} + +// EventListenerFilterClassification provides polymorphic access to related types. +// Call the interface's GetEventListenerFilter() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *EventListenerFilter, *EventNameFilter +type EventListenerFilterClassification interface { + // GetEventListenerFilter returns the EventListenerFilter content of the underlying type. + GetEventListenerFilter() *EventListenerFilter +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go index 68ea3b8f0052..061b20b16966 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go @@ -3,79 +3,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub import "time" -// ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. -type ClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. -type ClientBeginRegenerateKeyOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. -type ClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. -type ClientCheckNameAvailabilityOptions struct { - // placeholder for future optional parameters -} - -// ClientGetOptions contains the optional parameters for the Client.Get method. -type ClientGetOptions struct { - // placeholder for future optional parameters -} - -// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. -type ClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. -type ClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. -type ClientListKeysOptions struct { - // placeholder for future optional parameters -} - -// ClientListReplicaSKUsOptions contains the optional parameters for the Client.ListReplicaSKUs method. -type ClientListReplicaSKUsOptions struct { - // placeholder for future optional parameters -} - -// ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. -type ClientListSKUsOptions struct { - // placeholder for future optional parameters -} - // CustomCertificate - A custom certificate. type CustomCertificate struct { // REQUIRED; Custom certificate properties. @@ -118,28 +52,6 @@ type CustomCertificateProperties struct { ProvisioningState *ProvisioningState } -// CustomCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomCertificatesClient.BeginCreateOrUpdate -// method. -type CustomCertificatesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// CustomCertificatesClientDeleteOptions contains the optional parameters for the CustomCertificatesClient.Delete method. -type CustomCertificatesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// CustomCertificatesClientGetOptions contains the optional parameters for the CustomCertificatesClient.Get method. -type CustomCertificatesClientGetOptions struct { - // placeholder for future optional parameters -} - -// CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.NewListPager method. -type CustomCertificatesClientListOptions struct { - // placeholder for future optional parameters -} - // CustomDomain - A custom domain type CustomDomain struct { // REQUIRED; Properties of a custom domain. @@ -179,29 +91,6 @@ type CustomDomainProperties struct { ProvisioningState *ProvisioningState } -// CustomDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomDomainsClient.BeginCreateOrUpdate -// method. -type CustomDomainsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// CustomDomainsClientGetOptions contains the optional parameters for the CustomDomainsClient.Get method. -type CustomDomainsClientGetOptions struct { - // placeholder for future optional parameters -} - -// CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.NewListPager method. -type CustomDomainsClientListOptions struct { - // placeholder for future optional parameters -} - // Dimension - Specifications of the Dimension of metrics. type Dimension struct { // Localized friendly display name of the dimension. @@ -299,15 +188,6 @@ type EventListener struct { Filter EventListenerFilterClassification } -// 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: -// - *EventHubEndpoint, *EventListenerEndpoint -type EventListenerEndpointClassification interface { - // GetEventListenerEndpoint returns the EventListenerEndpoint content of the underlying type. - GetEventListenerEndpoint() *EventListenerEndpoint -} - // EventListenerEndpoint - An endpoint specifying where Web PubSub should send events to. type EventListenerEndpoint struct { // REQUIRED @@ -317,15 +197,6 @@ type EventListenerEndpoint struct { // GetEventListenerEndpoint implements the EventListenerEndpointClassification interface for type EventListenerEndpoint. func (e *EventListenerEndpoint) GetEventListenerEndpoint() *EventListenerEndpoint { return e } -// EventListenerFilterClassification provides polymorphic access to related types. -// Call the interface's GetEventListenerFilter() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *EventListenerFilter, *EventNameFilter -type EventListenerFilterClassification interface { - // GetEventListenerFilter returns the EventListenerFilter content of the underlying type. - GetEventListenerFilter() *EventListenerFilter -} - // EventListenerFilter - A base class for event filter which determines whether an event should be sent to an event listener. type EventListenerFilter struct { // REQUIRED @@ -401,26 +272,13 @@ type HubProperties struct { EventListeners []*EventListener } -// HubsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubsClient.BeginCreateOrUpdate method. -type HubsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// HubsClientGetOptions contains the optional parameters for the HubsClient.Get method. -type HubsClientGetOptions struct { - // placeholder for future optional parameters -} +// IPRule - An IP rule +type IPRule struct { + // Azure Networking ACL Action. + Action *ACLAction -// HubsClientListOptions contains the optional parameters for the HubsClient.NewListPager method. -type HubsClientListOptions struct { - // placeholder for future optional parameters + // An IP or CIDR or ServiceTag + Value *string } // Keys - A class represents the access keys of the resource. @@ -555,6 +413,9 @@ type NetworkACLs struct { // Azure Networking ACL Action. DefaultAction *ACLAction + // IP rules for filtering public traffic + IPRules []*IPRule + // ACLs for requests from private endpoints PrivateEndpoints []*PrivateEndpointACL @@ -611,11 +472,6 @@ type OperationProperties struct { ServiceSpecification *ServiceSpecification } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateEndpoint - Private endpoint type PrivateEndpoint struct { // Full qualified Id of the private endpoint @@ -677,31 +533,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *ProvisioningState } -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager -// method. -type PrivateEndpointConnectionsClientListOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update -// method. -type PrivateEndpointConnectionsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkResource - Private link resource type PrivateLinkResource struct { // Private link resource properties @@ -744,12 +575,6 @@ type PrivateLinkResourceProperties struct { ShareablePrivateLinkResourceTypes []*ShareablePrivateLinkResourceType } -// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager -// method. -type PrivateLinkResourcesClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkServiceConnectionState - Connection state of the private endpoint connection type PrivateLinkServiceConnectionState struct { // A message indicating if changes on the service provider require any updates on the consumer. @@ -781,9 +606,18 @@ type Properties struct { // 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. + 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. + ResourceStopped *string + // TLS settings for the resource TLS *TLSSettings @@ -871,41 +705,16 @@ type ReplicaList struct { } type ReplicaProperties struct { - // READ-ONLY; Provisioning state of the resource. - ProvisioningState *ProvisioningState -} - -// ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate method. -type ReplicasClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken 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. + RegionEndpointEnabled *string -// ReplicasClientBeginRestartOptions contains the optional parameters for the ReplicasClient.BeginRestart method. -type ReplicasClientBeginRestartOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ReplicasClientBeginUpdateOptions contains the optional parameters for the ReplicasClient.BeginUpdate method. -type ReplicasClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} + // 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 -// ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. -type ReplicasClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. -type ReplicasClientGetOptions struct { - // placeholder for future optional parameters -} - -// ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. -type ReplicasClientListOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources @@ -1125,32 +934,6 @@ type SharedPrivateLinkResourceProperties struct { Status *SharedPrivateLinkResourceStatus } -// SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate -// method. -type SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO 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. - ResumeToken string -} - -// SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get -// method. -type SharedPrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListPager -// method. -type SharedPrivateLinkResourcesClientListOptions struct { - // placeholder for future optional parameters -} - // SignalRServiceUsage - Object that describes a specific usage of the resources. type SignalRServiceUsage struct { // Current value for the usage quota. @@ -1246,11 +1029,6 @@ type UpstreamAuthSettings struct { Type *UpstreamAuthType } -// UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. -type UsagesClientListOptions struct { - // placeholder for future optional parameters -} - // UserAssignedIdentityProperty - Properties of user assigned identity. type UserAssignedIdentityProperty struct { // READ-ONLY; Get the client id for the user assigned identity diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go index e670ea75535e..c3b1d40251b0 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -681,6 +680,37 @@ func (h *HubProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type IPRule. +func (i IPRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", i.Action) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IPRule. +func (i *IPRule) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "action": + err = unpopulate(val, "Action", &i.Action) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Keys. func (k Keys) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1035,6 +1065,7 @@ func (n *NetworkACL) UnmarshalJSON(data []byte) error { func (n NetworkACLs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "defaultAction", n.DefaultAction) + populate(objectMap, "ipRules", n.IPRules) populate(objectMap, "privateEndpoints", n.PrivateEndpoints) populate(objectMap, "publicNetwork", n.PublicNetwork) return json.Marshal(objectMap) @@ -1052,6 +1083,9 @@ func (n *NetworkACLs) UnmarshalJSON(data []byte) error { case "defaultAction": err = unpopulate(val, "DefaultAction", &n.DefaultAction) delete(rawMsg, key) + case "ipRules": + err = unpopulate(val, "IPRules", &n.IPRules) + delete(rawMsg, key) case "privateEndpoints": err = unpopulate(val, "PrivateEndpoints", &n.PrivateEndpoints) delete(rawMsg, key) @@ -1543,7 +1577,9 @@ func (p Properties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", p.ProvisioningState) populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) populate(objectMap, "publicPort", p.PublicPort) + populate(objectMap, "regionEndpointEnabled", p.RegionEndpointEnabled) populate(objectMap, "resourceLogConfiguration", p.ResourceLogConfiguration) + populate(objectMap, "resourceStopped", p.ResourceStopped) populate(objectMap, "serverPort", p.ServerPort) populate(objectMap, "sharedPrivateLinkResources", p.SharedPrivateLinkResources) populate(objectMap, "tls", p.TLS) @@ -1593,9 +1629,15 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "publicPort": err = unpopulate(val, "PublicPort", &p.PublicPort) delete(rawMsg, key) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &p.RegionEndpointEnabled) + delete(rawMsg, key) case "resourceLogConfiguration": err = unpopulate(val, "ResourceLogConfiguration", &p.ResourceLogConfiguration) delete(rawMsg, key) + case "resourceStopped": + err = unpopulate(val, "ResourceStopped", &p.ResourceStopped) + delete(rawMsg, key) case "serverPort": err = unpopulate(val, "ServerPort", &p.ServerPort) delete(rawMsg, key) @@ -1772,6 +1814,8 @@ func (r *ReplicaList) UnmarshalJSON(data []byte) error { func (r ReplicaProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "regionEndpointEnabled", r.RegionEndpointEnabled) + populate(objectMap, "resourceStopped", r.ResourceStopped) return json.Marshal(objectMap) } @@ -1787,6 +1831,12 @@ func (r *ReplicaProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) delete(rawMsg, key) + case "regionEndpointEnabled": + err = unpopulate(val, "RegionEndpointEnabled", &r.RegionEndpointEnabled) + delete(rawMsg, key) + case "resourceStopped": + err = unpopulate(val, "ResourceStopped", &r.ResourceStopped) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go index 99cdadde2fb6..f5b4e95b53da 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations of the Microsoft.SignalRService provider. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go deleted file mode 100644 index e92b04b1672c..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.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{ - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/options.go b/sdk/resourcemanager/webpubsub/armwebpubsub/options.go new file mode 100644 index 000000000000..e789b76f6b82 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/options.go @@ -0,0 +1,241 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armwebpubsub + +// ClientBeginCreateOrUpdateOptions contains the optional parameters for the Client.BeginCreateOrUpdate method. +type ClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO 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. + ResumeToken string +} + +// ClientBeginRegenerateKeyOptions contains the optional parameters for the Client.BeginRegenerateKey method. +type ClientBeginRegenerateKeyOptions struct { + // Resumes the LRO 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. + ResumeToken string +} + +// ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. +type ClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. +type ClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ClientGetOptions contains the optional parameters for the Client.Get method. +type ClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. +type ClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. +type ClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. +type ClientListKeysOptions struct { + // placeholder for future optional parameters +} + +// ClientListReplicaSKUsOptions contains the optional parameters for the Client.ListReplicaSKUs method. +type ClientListReplicaSKUsOptions struct { + // placeholder for future optional parameters +} + +// ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. +type ClientListSKUsOptions struct { + // placeholder for future optional parameters +} + +// CustomCertificatesClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomCertificatesClient.BeginCreateOrUpdate +// method. +type CustomCertificatesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// CustomCertificatesClientDeleteOptions contains the optional parameters for the CustomCertificatesClient.Delete method. +type CustomCertificatesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// CustomCertificatesClientGetOptions contains the optional parameters for the CustomCertificatesClient.Get method. +type CustomCertificatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.NewListPager method. +type CustomCertificatesClientListOptions struct { + // placeholder for future optional parameters +} + +// CustomDomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the CustomDomainsClient.BeginCreateOrUpdate +// method. +type CustomDomainsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO 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. + ResumeToken string +} + +// CustomDomainsClientGetOptions contains the optional parameters for the CustomDomainsClient.Get method. +type CustomDomainsClientGetOptions struct { + // placeholder for future optional parameters +} + +// CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.NewListPager method. +type CustomDomainsClientListOptions struct { + // placeholder for future optional parameters +} + +// HubsClientBeginCreateOrUpdateOptions contains the optional parameters for the HubsClient.BeginCreateOrUpdate method. +type HubsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO 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. + ResumeToken string +} + +// HubsClientGetOptions contains the optional parameters for the HubsClient.Get method. +type HubsClientGetOptions struct { + // placeholder for future optional parameters +} + +// HubsClientListOptions contains the optional parameters for the HubsClient.NewListPager method. +type HubsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +type PrivateEndpointConnectionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +type PrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientBeginCreateOrUpdateOptions contains the optional parameters for the ReplicasClient.BeginCreateOrUpdate method. +type ReplicasClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientBeginRestartOptions contains the optional parameters for the ReplicasClient.BeginRestart method. +type ReplicasClientBeginRestartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientBeginUpdateOptions contains the optional parameters for the ReplicasClient.BeginUpdate method. +type ReplicasClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. +type ReplicasClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. +type ReplicasClientGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. +type ReplicasClientListOptions struct { + // placeholder for future optional parameters +} + +// SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreateOrUpdate +// method. +type SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO 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. + ResumeToken string +} + +// SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get +// method. +type SharedPrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListPager +// method. +type SharedPrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. +type UsagesClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go b/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go index 4536bed49d4c..fcc60c7417bc 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -26,7 +25,10 @@ func unmarshalEventListenerEndpointClassification(rawMsg json.RawMessage) (Event default: b = &EventListenerEndpoint{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } func unmarshalEventListenerFilterClassification(rawMsg json.RawMessage) (EventListenerFilterClassification, error) { @@ -44,5 +46,8 @@ func unmarshalEventListenerFilterClassification(rawMsg json.RawMessage) (EventLi default: b = &EventListenerFilter{} } - return b, json.Unmarshal(rawMsg, b) + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go index 434a8155fa64..82aa9adb9cbc 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -47,7 +46,7 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -59,9 +58,10 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -107,7 +109,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,25 +118,28 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Get the specified private endpoint connection // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -158,7 +163,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -175,7 +180,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List private endpoint connections // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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 @@ -225,7 +230,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -243,7 +248,7 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -251,18 +256,21 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // - 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) { + var err error req, err := client.updateCreateRequest(ctx, privateEndpointConnectionName, resourceGroupName, resourceName, parameters, options) if err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientUpdateResponse{}, err } - return client.updateHandleResponse(resp) + resp, err := client.updateHandleResponse(httpResp) + return resp, err } // updateCreateRequest creates the Update request. @@ -286,10 +294,13 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // updateHandleResponse handles the Update response. diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go deleted file mode 100644 index fa6501de75da..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,191 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubPrivateEndpointConnections_List.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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: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), - // }, - // 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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubPrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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) - 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: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), - // }, - // 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubPrivateEndpointConnections_Update.json -func ExamplePrivateEndpointConnectionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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{ - Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - PrivateEndpoint: &armwebpubsub.PrivateEndpoint{}, - PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // 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: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), - // }, - // 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubPrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go index 53cb475ed9f6..87f5213dd25e 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -46,7 +45,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 2023-06-01-preview +// Generated from API version 2023-08-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 @@ -96,7 +95,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go deleted file mode 100644 index 6bfba6ed7bf0..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,83 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubPrivateLinkResources_List.json -func ExamplePrivateLinkResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().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.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")}, - // 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"), - // }, - // }, - // { - // 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"), - // }, - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go index 02ddca4cdcf1..612892c282ef 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -47,7 +46,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 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -60,9 +59,10 @@ func (client *ReplicasClient) BeginCreateOrUpdate(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ReplicasClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-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 req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -108,31 +110,36 @@ func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Delete - Operation to delete a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. // - options - ReplicasClientDeleteOptions contains the optional parameters for the ReplicasClient.Delete method. func (client *ReplicasClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientDeleteOptions) (ReplicasClientDeleteResponse, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) if err != nil { return ReplicasClientDeleteResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicasClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ReplicasClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ReplicasClientDeleteResponse{}, err } return ReplicasClientDeleteResponse{}, nil } @@ -158,7 +165,7 @@ func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -167,24 +174,27 @@ func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get the replica and its properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. // - options - ReplicasClientGetOptions contains the optional parameters for the ReplicasClient.Get method. func (client *ReplicasClient) Get(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientGetOptions) (ReplicasClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) if err != nil { return ReplicasClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ReplicasClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ReplicasClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ReplicasClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -208,7 +218,7 @@ func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -225,7 +235,7 @@ func (client *ReplicasClient) getHandleResponse(resp *http.Response) (ReplicasCl // NewListPager - List all replicas belong to this resource // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -274,7 +284,7 @@ func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -292,7 +302,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 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -303,9 +313,10 @@ func (client *ReplicasClient) BeginRestart(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientRestartResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientRestartResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ReplicasClientRestartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -314,20 +325,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *ReplicasClient) restart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*http.Response, error) { + var err error req, err := client.restartCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // restartCreateRequest creates the Restart request. @@ -351,7 +364,7 @@ func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -360,7 +373,7 @@ func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resource // BeginUpdate - Operation to update an exiting replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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. @@ -372,9 +385,10 @@ func (client *ReplicasClient) BeginUpdate(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicasClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ReplicasClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -383,20 +397,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-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 req, err := client.updateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -420,8 +436,11 @@ func (client *ReplicasClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go deleted file mode 100644 index 4b4e0999d42b..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go +++ /dev/null @@ -1,279 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/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("", 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: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), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReplicasClient().Get(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: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), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/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) - 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{}, - SKU: &armwebpubsub.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // 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: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), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/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) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewReplicasClient().Delete(ctx, "myResourceGroup", "myWebPubSubService", "myWebPubSubService-eastus", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/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) - 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{}, - SKU: &armwebpubsub.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // 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: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), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // 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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/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/response_types.go b/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go index f4c963b40b40..349cd83b310b 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go @@ -3,19 +3,20 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub // ClientCheckNameAvailabilityResponse contains the response from method Client.CheckNameAvailability. type ClientCheckNameAvailabilityResponse struct { + // Result of the request to check name availability. It contains a flag and possible reason of failure. NameAvailability } // ClientCreateOrUpdateResponse contains the response from method Client.BeginCreateOrUpdate. type ClientCreateOrUpdateResponse struct { + // A class represent a resource. ResourceInfo } @@ -26,36 +27,43 @@ type ClientDeleteResponse struct { // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { + // A class represent a resource. ResourceInfo } // ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager. type ClientListByResourceGroupResponse struct { + // Object that includes an array of resources and a possible link for next set. ResourceInfoList } // ClientListBySubscriptionResponse contains the response from method Client.NewListBySubscriptionPager. type ClientListBySubscriptionResponse struct { + // Object that includes an array of resources and a possible link for next set. ResourceInfoList } // ClientListKeysResponse contains the response from method Client.ListKeys. type ClientListKeysResponse struct { + // A class represents the access keys of the resource. Keys } // ClientListReplicaSKUsResponse contains the response from method Client.ListReplicaSKUs. type ClientListReplicaSKUsResponse struct { + // The list skus operation response SKUList } // ClientListSKUsResponse contains the response from method Client.ListSKUs. type ClientListSKUsResponse struct { + // The list skus operation response SKUList } // ClientRegenerateKeyResponse contains the response from method Client.BeginRegenerateKey. type ClientRegenerateKeyResponse struct { + // A class represents the access keys of the resource. Keys } @@ -66,11 +74,13 @@ type ClientRestartResponse struct { // ClientUpdateResponse contains the response from method Client.BeginUpdate. type ClientUpdateResponse struct { + // A class represent a resource. ResourceInfo } // CustomCertificatesClientCreateOrUpdateResponse contains the response from method CustomCertificatesClient.BeginCreateOrUpdate. type CustomCertificatesClientCreateOrUpdateResponse struct { + // A custom certificate. CustomCertificate } @@ -81,16 +91,19 @@ type CustomCertificatesClientDeleteResponse struct { // CustomCertificatesClientGetResponse contains the response from method CustomCertificatesClient.Get. type CustomCertificatesClientGetResponse struct { + // A custom certificate. CustomCertificate } // CustomCertificatesClientListResponse contains the response from method CustomCertificatesClient.NewListPager. type CustomCertificatesClientListResponse struct { + // Custom certificates list. CustomCertificateList } // CustomDomainsClientCreateOrUpdateResponse contains the response from method CustomDomainsClient.BeginCreateOrUpdate. type CustomDomainsClientCreateOrUpdateResponse struct { + // A custom domain CustomDomain } @@ -101,16 +114,19 @@ type CustomDomainsClientDeleteResponse struct { // CustomDomainsClientGetResponse contains the response from method CustomDomainsClient.Get. type CustomDomainsClientGetResponse struct { + // A custom domain CustomDomain } // CustomDomainsClientListResponse contains the response from method CustomDomainsClient.NewListPager. type CustomDomainsClientListResponse struct { + // Custom domains list CustomDomainList } // HubsClientCreateOrUpdateResponse contains the response from method HubsClient.BeginCreateOrUpdate. type HubsClientCreateOrUpdateResponse struct { + // A hub setting Hub } @@ -121,16 +137,19 @@ type HubsClientDeleteResponse struct { // HubsClientGetResponse contains the response from method HubsClient.Get. type HubsClientGetResponse struct { + // A hub setting Hub } // HubsClientListResponse contains the response from method HubsClient.NewListPager. type HubsClientListResponse struct { + // Hub setting list HubList } // 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. OperationList } @@ -141,26 +160,31 @@ type PrivateEndpointConnectionsClientDeleteResponse struct { // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // A private endpoint connection to an azure resource PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. type PrivateEndpointConnectionsClientListResponse struct { + // A list of private endpoint connections PrivateEndpointConnectionList } // PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.Update. type PrivateEndpointConnectionsClientUpdateResponse struct { + // A private endpoint connection to an azure resource PrivateEndpointConnection } // PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. type PrivateLinkResourcesClientListResponse struct { + // Contains a list of PrivateLinkResource and a possible link to query more results PrivateLinkResourceList } // ReplicasClientCreateOrUpdateResponse contains the response from method ReplicasClient.BeginCreateOrUpdate. type ReplicasClientCreateOrUpdateResponse struct { + // A class represent a replica resource. Replica } @@ -171,6 +195,7 @@ type ReplicasClientDeleteResponse struct { // ReplicasClientGetResponse contains the response from method ReplicasClient.Get. type ReplicasClientGetResponse struct { + // A class represent a replica resource. Replica } @@ -186,11 +211,13 @@ type ReplicasClientRestartResponse struct { // ReplicasClientUpdateResponse contains the response from method ReplicasClient.BeginUpdate. type ReplicasClientUpdateResponse struct { + // A class represent a replica resource. Replica } // SharedPrivateLinkResourcesClientCreateOrUpdateResponse contains the response from method SharedPrivateLinkResourcesClient.BeginCreateOrUpdate. type SharedPrivateLinkResourcesClientCreateOrUpdateResponse struct { + // Describes a Shared Private Link Resource SharedPrivateLinkResource } @@ -201,15 +228,18 @@ type SharedPrivateLinkResourcesClientDeleteResponse struct { // SharedPrivateLinkResourcesClientGetResponse contains the response from method SharedPrivateLinkResourcesClient.Get. type SharedPrivateLinkResourcesClientGetResponse struct { + // Describes a Shared Private Link Resource SharedPrivateLinkResource } // SharedPrivateLinkResourcesClientListResponse contains the response from method SharedPrivateLinkResourcesClient.NewListPager. type SharedPrivateLinkResourcesClientListResponse struct { + // A list of shared private link resources SharedPrivateLinkResourceList } // UsagesClientListResponse contains the response from method UsagesClient.NewListPager. type UsagesClientListResponse struct { + // Object that includes an array of the resource usages and a possible link for next set. SignalRServiceUsageList } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go index 01eb95f82ad0..3218a11b1666 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -47,7 +46,7 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -60,9 +59,10 @@ func (client *SharedPrivateLinkResourcesClient) BeginCreateOrUpdate(ctx context. if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *SharedPrivateLinkResourcesClient) createOrUpdate(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, parameters SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -108,16 +110,19 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -129,9 +134,10 @@ func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[SharedPrivateLinkResourcesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -140,20 +146,22 @@ 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 2023-06-01-preview +// Generated from API version 2023-08-01-preview func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -177,7 +185,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -186,25 +194,28 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. // Get - Get the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - sharedPrivateLinkResourceName - The name of the shared private link resource // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get // method. func (client *SharedPrivateLinkResourcesClient) Get(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientGetOptions) (SharedPrivateLinkResourcesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, sharedPrivateLinkResourceName, resourceGroupName, resourceName, options) if err != nil { return SharedPrivateLinkResourcesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return SharedPrivateLinkResourcesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SharedPrivateLinkResourcesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SharedPrivateLinkResourcesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -228,7 +239,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,7 +256,7 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res // NewListPager - List shared private link resources // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-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 @@ -295,7 +306,7 @@ func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go deleted file mode 100644 index 87408a494250..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go +++ /dev/null @@ -1,154 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armwebpubsub_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubSharedPrivateLinkResources_List.json -func ExampleSharedPrivateLinkResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubSharedPrivateLinkResources_Get.json -func ExampleSharedPrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedPrivateLinkResourcesClient().Get(ctx, "upstream", "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.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/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json -func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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) - 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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/WebPubSubSharedPrivateLinkResources_Delete.json -func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", 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) - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go b/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go index 3205063dea3f..272c923f1848 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go index 2e65b3c9c2ee..e76c7581dbe9 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armwebpubsub @@ -46,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - List resource usage quotas by location. // -// Generated from API version 2023-06-01-preview +// Generated from API version 2023-08-01-preview // - location - the location like "eastus" // - options - UsagesClientListOptions contains the optional parameters for the UsagesClient.NewListPager method. func (client *UsagesClient) NewListPager(location string, options *UsagesClientListOptions) *runtime.Pager[UsagesClientListResponse] { @@ -90,7 +89,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-06-01-preview") + reqQP.Set("api-version", "2023-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go deleted file mode 100644 index a591854d156f..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go +++ /dev/null @@ -1,66 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// 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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c53808ba54beef57059371708f1fa6949a11a280/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-06-01-preview/examples/Usages_List.json -func ExampleUsagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewUsagesClient().NewListPager("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.SignalRServiceUsageList = armwebpubsub.SignalRServiceUsageList{ - // 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"), - // }, - // { - // 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"), - // }}, - // } - } -}