diff --git a/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md b/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md index dc25bd6df532..015bf7ca814c 100644 --- a/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md +++ b/sdk/resourcemanager/signalr/armsignalr/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.3.0-beta.2 (2024-03-13) +### Features Added + +- New function `*ClientFactory.NewReplicaClient() *ReplicaClient` +- New function `NewReplicaClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ReplicaClient, error)` +- New function `*ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate(context.Context, string, string, string, string, SharedPrivateLinkResource, *ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (*runtime.Poller[ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse], error)` +- New function `*ReplicaClient.SharedPrivateLinkResourcesGet(context.Context, string, string, string, string, *ReplicaClientSharedPrivateLinkResourcesGetOptions) (ReplicaClientSharedPrivateLinkResourcesGetResponse, error)` +- New function `*ReplicaClient.NewSharedPrivateLinkResourcesListPager(string, string, string, *ReplicaClientSharedPrivateLinkResourcesListOptions) *runtime.Pager[ReplicaClientSharedPrivateLinkResourcesListResponse]` + + ## 1.3.0-beta.1 (2023-11-30) ### Features Added diff --git a/sdk/resourcemanager/signalr/armsignalr/autorest.md b/sdk/resourcemanager/signalr/armsignalr/autorest.md index 2a410e780917..81dffa74b1c4 100644 --- a/sdk/resourcemanager/signalr/armsignalr/autorest.md +++ b/sdk/resourcemanager/signalr/armsignalr/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/signalr/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/signalr/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.3.0-beta.1 -tag: package-2023-08-01-preview +module-version: 1.3.0-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/signalr/armsignalr/client.go b/sdk/resourcemanager/signalr/armsignalr/client.go index fb247abc6fc7..eb298ce60184 100644 --- a/sdk/resourcemanager/signalr/armsignalr/client.go +++ b/sdk/resourcemanager/signalr/armsignalr/client.go @@ -46,7 +46,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - location - the region // - parameters - Parameters supplied to the operation. // - options - ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. @@ -88,7 +88,7 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -109,7 +109,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameters for the create or update operation @@ -135,7 +135,7 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName // CreateOrUpdate - Create or update a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginCreateOrUpdate" @@ -177,7 +177,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -189,7 +189,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG // BeginDelete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. @@ -214,7 +214,7 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, // Delete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "Client.BeginDelete" @@ -256,7 +256,7 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. @@ -311,7 +311,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +328,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager // method. @@ -371,7 +371,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -388,7 +388,7 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - options - ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListBySubscriptionResponse]{ @@ -425,7 +425,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -443,7 +443,7 @@ func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (Cli // ListKeys - Get the access keys of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. @@ -489,7 +489,7 @@ func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -507,7 +507,7 @@ func (client *Client) listKeysHandleResponse(resp *http.Response) (ClientListKey // ListReplicaSKUs - List all available skus of the replica resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -558,7 +558,7 @@ func (client *Client) listReplicaSKUsCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -576,7 +576,7 @@ func (client *Client) listReplicaSKUsHandleResponse(resp *http.Response) (Client // ListSKUs - List all available skus of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. @@ -622,7 +622,7 @@ func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -641,7 +641,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameter that describes the Regenerate Key Operation. @@ -668,7 +668,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName // time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRegenerateKey" @@ -710,7 +710,7 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -722,7 +722,7 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr // BeginRestart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. @@ -747,7 +747,7 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string // Restart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) restart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRestart" @@ -789,7 +789,7 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -798,7 +798,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameters for the update operation @@ -824,7 +824,7 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, // Update - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginUpdate" @@ -866,7 +866,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/client_example_test.go deleted file mode 100644 index 78b7c59f76e0..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/client_example_test.go +++ /dev/null @@ -1,1390 +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 armsignalr_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/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().CheckNameAvailability(ctx, "eastus", armsignalr.NameAvailabilityParameters{ - Name: to.Ptr("mySignalRService"), - Type: to.Ptr("Microsoft.SignalRService/SignalR"), - }, 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 = armsignalr.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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.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 = armsignalr.ResourceInfoList{ - // Value: []*armsignalr.ResourceInfo{ - // { - // Name: to.Ptr("mySignalRService"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armsignalr.ManagedIdentity{ - // Type: to.Ptr(armsignalr.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armsignalr.ServiceKindSignalR), - // Properties: &armsignalr.Properties{ - // Cors: &armsignalr.CorsSettings{ - // AllowedOrigins: []*string{ - // to.Ptr("https://foo.com"), - // to.Ptr("https://bar.com")}, - // }, - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // Features: []*armsignalr.Feature{ - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsServiceMode), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("Serverless"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableConnectivityLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("True"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableMessagingLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableLiveTrace), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }}, - // HostName: to.Ptr("mysignalrservice.service.signalr.net"), - // LiveTraceConfiguration: &armsignalr.LiveTraceConfiguration{ - // Categories: []*armsignalr.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armsignalr.NetworkACLs{ - // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), - // IPRules: []*armsignalr.IPRule{ - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ - // { - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeServerConnection)}, - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armsignalr.NetworkACL{ - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armsignalr.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Properties: &armsignalr.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsignalr.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ - // Categories: []*armsignalr.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // Serverless: &armsignalr.ServerlessSettings{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](5), - // }, - // TLS: &armsignalr.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), - // }, - // Upstream: &armsignalr.ServerlessUpstreamSettings{ - // Templates: []*armsignalr.UpstreamTemplate{ - // { - // URLTemplate: to.Ptr("http://foo.com"), - // }}, - // }, - // Version: to.Ptr("1.0"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.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 = armsignalr.ResourceInfoList{ - // Value: []*armsignalr.ResourceInfo{ - // { - // Name: to.Ptr("mySignalRService"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armsignalr.ManagedIdentity{ - // Type: to.Ptr(armsignalr.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armsignalr.ServiceKindSignalR), - // Properties: &armsignalr.Properties{ - // Cors: &armsignalr.CorsSettings{ - // AllowedOrigins: []*string{ - // to.Ptr("https://foo.com"), - // to.Ptr("https://bar.com")}, - // }, - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // Features: []*armsignalr.Feature{ - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsServiceMode), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("Serverless"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableConnectivityLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("True"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableMessagingLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableLiveTrace), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }}, - // HostName: to.Ptr("mysignalrservice.service.signalr.net"), - // LiveTraceConfiguration: &armsignalr.LiveTraceConfiguration{ - // Categories: []*armsignalr.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armsignalr.NetworkACLs{ - // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), - // IPRules: []*armsignalr.IPRule{ - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ - // { - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeServerConnection)}, - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armsignalr.NetworkACL{ - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armsignalr.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Properties: &armsignalr.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsignalr.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ - // Categories: []*armsignalr.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // Serverless: &armsignalr.ServerlessSettings{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](5), - // }, - // TLS: &armsignalr.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), - // }, - // Upstream: &armsignalr.ServerlessUpstreamSettings{ - // Templates: []*armsignalr.UpstreamTemplate{ - // { - // URLTemplate: to.Ptr("http://foo.com"), - // }}, - // }, - // Version: to.Ptr("1.0"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "myResourceGroup", "mySignalRService", 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 = armsignalr.ResourceInfo{ - // Name: to.Ptr("mySignalRService"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armsignalr.ManagedIdentity{ - // Type: to.Ptr(armsignalr.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armsignalr.ServiceKindSignalR), - // Properties: &armsignalr.Properties{ - // Cors: &armsignalr.CorsSettings{ - // AllowedOrigins: []*string{ - // to.Ptr("https://foo.com"), - // to.Ptr("https://bar.com")}, - // }, - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // Features: []*armsignalr.Feature{ - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsServiceMode), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("Serverless"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableConnectivityLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("True"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableMessagingLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableLiveTrace), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }}, - // HostName: to.Ptr("mysignalrservice.service.signalr.net"), - // LiveTraceConfiguration: &armsignalr.LiveTraceConfiguration{ - // Categories: []*armsignalr.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armsignalr.NetworkACLs{ - // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), - // IPRules: []*armsignalr.IPRule{ - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ - // { - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeServerConnection)}, - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armsignalr.NetworkACL{ - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armsignalr.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Properties: &armsignalr.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsignalr.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ - // Categories: []*armsignalr.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // Serverless: &armsignalr.ServerlessSettings{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](5), - // }, - // TLS: &armsignalr.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), - // }, - // Upstream: &armsignalr.ServerlessUpstreamSettings{ - // Templates: []*armsignalr.UpstreamTemplate{ - // { - // URLTemplate: to.Ptr("http://foo.com"), - // }}, - // }, - // Version: to.Ptr("1.0"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySignalRService", armsignalr.ResourceInfo{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Identity: &armsignalr.ManagedIdentity{ - Type: to.Ptr(armsignalr.ManagedIdentityTypeSystemAssigned), - }, - Kind: to.Ptr(armsignalr.ServiceKindSignalR), - Properties: &armsignalr.Properties{ - Cors: &armsignalr.CorsSettings{ - AllowedOrigins: []*string{ - to.Ptr("https://foo.com"), - to.Ptr("https://bar.com")}, - }, - DisableAADAuth: to.Ptr(false), - DisableLocalAuth: to.Ptr(false), - Features: []*armsignalr.Feature{ - { - Flag: to.Ptr(armsignalr.FeatureFlagsServiceMode), - Properties: map[string]*string{}, - Value: to.Ptr("Serverless"), - }, - { - Flag: to.Ptr(armsignalr.FeatureFlagsEnableConnectivityLogs), - Properties: map[string]*string{}, - Value: to.Ptr("True"), - }, - { - Flag: to.Ptr(armsignalr.FeatureFlagsEnableMessagingLogs), - Properties: map[string]*string{}, - Value: to.Ptr("False"), - }, - { - Flag: to.Ptr(armsignalr.FeatureFlagsEnableLiveTrace), - Properties: map[string]*string{}, - Value: to.Ptr("False"), - }}, - LiveTraceConfiguration: &armsignalr.LiveTraceConfiguration{ - Categories: []*armsignalr.LiveTraceCategory{ - { - Name: to.Ptr("ConnectivityLogs"), - Enabled: to.Ptr("true"), - }}, - Enabled: to.Ptr("false"), - }, - NetworkACLs: &armsignalr.NetworkACLs{ - DefaultAction: to.Ptr(armsignalr.ACLActionDeny), - PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ - { - Allow: []*armsignalr.SignalRRequestType{ - to.Ptr(armsignalr.SignalRRequestTypeServerConnection)}, - Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - }}, - PublicNetwork: &armsignalr.NetworkACL{ - Allow: []*armsignalr.SignalRRequestType{ - to.Ptr(armsignalr.SignalRRequestTypeClientConnection)}, - }, - }, - PublicNetworkAccess: to.Ptr("Enabled"), - Serverless: &armsignalr.ServerlessSettings{ - ConnectionTimeoutInSeconds: to.Ptr[int32](5), - }, - TLS: &armsignalr.TLSSettings{ - ClientCertEnabled: to.Ptr(false), - }, - Upstream: &armsignalr.ServerlessUpstreamSettings{ - Templates: []*armsignalr.UpstreamTemplate{ - { - Auth: &armsignalr.UpstreamAuthSettings{ - Type: to.Ptr(armsignalr.UpstreamAuthTypeManagedIdentity), - ManagedIdentity: &armsignalr.ManagedIdentitySettings{ - Resource: to.Ptr("api://example"), - }, - }, - CategoryPattern: to.Ptr("*"), - EventPattern: to.Ptr("connect,disconnect"), - HubPattern: to.Ptr("*"), - URLTemplate: to.Ptr("https://example.com/chat/api/connect"), - }}, - }, - }, - SKU: &armsignalr.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - }, - }, 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 = armsignalr.ResourceInfo{ - // Name: to.Ptr("mySignalRService"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armsignalr.ManagedIdentity{ - // Type: to.Ptr(armsignalr.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armsignalr.ServiceKindSignalR), - // Properties: &armsignalr.Properties{ - // Cors: &armsignalr.CorsSettings{ - // AllowedOrigins: []*string{ - // to.Ptr("https://foo.com"), - // to.Ptr("https://bar.com")}, - // }, - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // Features: []*armsignalr.Feature{ - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsServiceMode), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("Serverless"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableConnectivityLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("True"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableMessagingLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableLiveTrace), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }}, - // HostName: to.Ptr("mysignalrservice.service.signalr.net"), - // LiveTraceConfiguration: &armsignalr.LiveTraceConfiguration{ - // Categories: []*armsignalr.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armsignalr.NetworkACLs{ - // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), - // IPRules: []*armsignalr.IPRule{ - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ - // { - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeServerConnection)}, - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armsignalr.NetworkACL{ - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armsignalr.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Properties: &armsignalr.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsignalr.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ - // Categories: []*armsignalr.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // Serverless: &armsignalr.ServerlessSettings{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](5), - // }, - // TLS: &armsignalr.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), - // }, - // Upstream: &armsignalr.ServerlessUpstreamSettings{ - // Templates: []*armsignalr.UpstreamTemplate{ - // { - // URLTemplate: to.Ptr("http://foo.com"), - // }}, - // }, - // Version: to.Ptr("1.0"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginDelete(ctx, "myResourceGroup", "mySignalRService", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginUpdate(ctx, "myResourceGroup", "mySignalRService", armsignalr.ResourceInfo{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Identity: &armsignalr.ManagedIdentity{ - Type: to.Ptr(armsignalr.ManagedIdentityTypeSystemAssigned), - }, - Kind: to.Ptr(armsignalr.ServiceKindSignalR), - Properties: &armsignalr.Properties{ - Cors: &armsignalr.CorsSettings{ - AllowedOrigins: []*string{ - to.Ptr("https://foo.com"), - to.Ptr("https://bar.com")}, - }, - DisableAADAuth: to.Ptr(false), - DisableLocalAuth: to.Ptr(false), - Features: []*armsignalr.Feature{ - { - Flag: to.Ptr(armsignalr.FeatureFlagsServiceMode), - Properties: map[string]*string{}, - Value: to.Ptr("Serverless"), - }, - { - Flag: to.Ptr(armsignalr.FeatureFlagsEnableConnectivityLogs), - Properties: map[string]*string{}, - Value: to.Ptr("True"), - }, - { - Flag: to.Ptr(armsignalr.FeatureFlagsEnableMessagingLogs), - Properties: map[string]*string{}, - Value: to.Ptr("False"), - }, - { - Flag: to.Ptr(armsignalr.FeatureFlagsEnableLiveTrace), - Properties: map[string]*string{}, - Value: to.Ptr("False"), - }}, - LiveTraceConfiguration: &armsignalr.LiveTraceConfiguration{ - Categories: []*armsignalr.LiveTraceCategory{ - { - Name: to.Ptr("ConnectivityLogs"), - Enabled: to.Ptr("true"), - }}, - Enabled: to.Ptr("false"), - }, - NetworkACLs: &armsignalr.NetworkACLs{ - DefaultAction: to.Ptr(armsignalr.ACLActionDeny), - PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ - { - Allow: []*armsignalr.SignalRRequestType{ - to.Ptr(armsignalr.SignalRRequestTypeServerConnection)}, - Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - }}, - PublicNetwork: &armsignalr.NetworkACL{ - Allow: []*armsignalr.SignalRRequestType{ - to.Ptr(armsignalr.SignalRRequestTypeClientConnection)}, - }, - }, - PublicNetworkAccess: to.Ptr("Enabled"), - Serverless: &armsignalr.ServerlessSettings{ - ConnectionTimeoutInSeconds: to.Ptr[int32](5), - }, - TLS: &armsignalr.TLSSettings{ - ClientCertEnabled: to.Ptr(false), - }, - Upstream: &armsignalr.ServerlessUpstreamSettings{ - Templates: []*armsignalr.UpstreamTemplate{ - { - Auth: &armsignalr.UpstreamAuthSettings{ - Type: to.Ptr(armsignalr.UpstreamAuthTypeManagedIdentity), - ManagedIdentity: &armsignalr.ManagedIdentitySettings{ - Resource: to.Ptr("api://example"), - }, - }, - CategoryPattern: to.Ptr("*"), - EventPattern: to.Ptr("connect,disconnect"), - HubPattern: to.Ptr("*"), - URLTemplate: to.Ptr("https://example.com/chat/api/connect"), - }}, - }, - }, - SKU: &armsignalr.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - }, - }, 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 = armsignalr.ResourceInfo{ - // Name: to.Ptr("mySignalRService"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armsignalr.ManagedIdentity{ - // Type: to.Ptr(armsignalr.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armsignalr.ServiceKindSignalR), - // Properties: &armsignalr.Properties{ - // Cors: &armsignalr.CorsSettings{ - // AllowedOrigins: []*string{ - // to.Ptr("https://foo.com"), - // to.Ptr("https://bar.com")}, - // }, - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // Features: []*armsignalr.Feature{ - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsServiceMode), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("Serverless"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableConnectivityLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("True"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableMessagingLogs), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }, - // { - // Flag: to.Ptr(armsignalr.FeatureFlagsEnableLiveTrace), - // Properties: map[string]*string{ - // }, - // Value: to.Ptr("False"), - // }}, - // HostName: to.Ptr("mysignalrservice.service.signalr.net"), - // LiveTraceConfiguration: &armsignalr.LiveTraceConfiguration{ - // Categories: []*armsignalr.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armsignalr.NetworkACLs{ - // DefaultAction: to.Ptr(armsignalr.ACLActionDeny), - // IPRules: []*armsignalr.IPRule{ - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armsignalr.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armsignalr.PrivateEndpointACL{ - // { - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeServerConnection)}, - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armsignalr.NetworkACL{ - // Allow: []*armsignalr.SignalRRequestType{ - // to.Ptr(armsignalr.SignalRRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armsignalr.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Properties: &armsignalr.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armsignalr.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armsignalr.ResourceLogConfiguration{ - // Categories: []*armsignalr.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // Serverless: &armsignalr.ServerlessSettings{ - // ConnectionTimeoutInSeconds: to.Ptr[int32](5), - // }, - // TLS: &armsignalr.TLSSettings{ - // ClientCertEnabled: to.Ptr(true), - // }, - // Upstream: &armsignalr.ServerlessUpstreamSettings{ - // Templates: []*armsignalr.UpstreamTemplate{ - // { - // URLTemplate: to.Ptr("http://foo.com"), - // }}, - // }, - // Version: to.Ptr("1.0"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().ListKeys(ctx, "myResourceGroup", "mySignalRService", 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 = armsignalr.Keys{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginRegenerateKey(ctx, "myResourceGroup", "mySignalRService", armsignalr.RegenerateKeyParameters{ - KeyType: to.Ptr(armsignalr.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 = armsignalr.Keys{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().ListReplicaSKUs(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-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 = armsignalr.SKUList{ - // Value: []*armsignalr.SKU{ - // { - // Capacity: &armsignalr.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(armsignalr.ScaleTypeManual), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR/replicas"), - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Free_F1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierFree), - // }, - // }, - // { - // Capacity: &armsignalr.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(armsignalr.ScaleTypeManual), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR/replicas"), - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Standard_S1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierStandard), - // }, - // }, - // { - // Capacity: &armsignalr.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(armsignalr.ScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR/replicas"), - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierStandard), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginRestart(ctx, "myResourceGroup", "mySignalRService", 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalR_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().ListSKUs(ctx, "myResourceGroup", "mySignalRService", 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 = armsignalr.SKUList{ - // Value: []*armsignalr.SKU{ - // { - // Capacity: &armsignalr.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(armsignalr.ScaleTypeManual), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Free_F1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierFree), - // }, - // }, - // { - // Capacity: &armsignalr.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(armsignalr.ScaleTypeManual), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Standard_S1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierStandard), - // }, - // }, - // { - // Capacity: &armsignalr.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(armsignalr.ScaleTypeAutomatic), - // }, - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR/replicas"), - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierStandard), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/signalr/armsignalr/client_factory.go b/sdk/resourcemanager/signalr/armsignalr/client_factory.go index ba8d712211ba..a5b9011178fd 100644 --- a/sdk/resourcemanager/signalr/armsignalr/client_factory.go +++ b/sdk/resourcemanager/signalr/armsignalr/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,66 +26,91 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewClient creates a new instance of Client. func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) - return subClient + return &Client{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewCustomCertificatesClient creates a new instance of CustomCertificatesClient. func (c *ClientFactory) NewCustomCertificatesClient() *CustomCertificatesClient { - subClient, _ := NewCustomCertificatesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &CustomCertificatesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewCustomDomainsClient creates a new instance of CustomDomainsClient. func (c *ClientFactory) NewCustomDomainsClient() *CustomDomainsClient { - subClient, _ := NewCustomDomainsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &CustomDomainsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewReplicaClient creates a new instance of ReplicaClient. +func (c *ClientFactory) NewReplicaClient() *ReplicaClient { + return &ReplicaClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewReplicasClient creates a new instance of ReplicasClient. func (c *ClientFactory) NewReplicasClient() *ReplicasClient { - subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ReplicasClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient. func (c *ClientFactory) NewSharedPrivateLinkResourcesClient() *SharedPrivateLinkResourcesClient { - subClient, _ := NewSharedPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SharedPrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewUsagesClient creates a new instance of UsagesClient. func (c *ClientFactory) NewUsagesClient() *UsagesClient { - subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &UsagesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/signalr/armsignalr/constants.go b/sdk/resourcemanager/signalr/armsignalr/constants.go index 5a19134545a1..1a3c4f276137 100644 --- a/sdk/resourcemanager/signalr/armsignalr/constants.go +++ b/sdk/resourcemanager/signalr/armsignalr/constants.go @@ -10,7 +10,7 @@ package armsignalr const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" - moduleVersion = "v1.3.0-beta.1" + moduleVersion = "v1.3.0-beta.2" ) // ACLAction - Azure Networking ACL Action. diff --git a/sdk/resourcemanager/signalr/armsignalr/customcertificates_client.go b/sdk/resourcemanager/signalr/armsignalr/customcertificates_client.go index cb07f0248f3c..e6b993026883 100644 --- a/sdk/resourcemanager/signalr/armsignalr/customcertificates_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/customcertificates_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -73,7 +73,7 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Create or update a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *CustomCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, options *CustomCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomCertificatesClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -131,7 +131,7 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. // Delete - Delete a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -182,7 +182,7 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -242,7 +242,7 @@ func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +259,7 @@ func (client *CustomCertificatesClient) getHandleResponse(resp *http.Response) ( // NewListPager - List all custom certificates. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.NewListPager @@ -307,7 +307,7 @@ func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/customcertificates_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/customcertificates_client_example_test.go deleted file mode 100644 index d323bded677b..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/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 armsignalr_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/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomCertificatesClient().NewListPager("myResourceGroup", "mySignalRService", 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 = armsignalr.CustomCertificateList{ - // Value: []*armsignalr.CustomCertificate{ - // { - // Name: to.Ptr("myCert"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/customCertificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert"), - // Properties: &armsignalr.CustomCertificateProperties{ - // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), - // KeyVaultSecretName: to.Ptr("mycert"), - // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomCertificatesClient().Get(ctx, "myResourceGroup", "mySignalRService", "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 = armsignalr.CustomCertificate{ - // Name: to.Ptr("myCert"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/customCertificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert"), - // Properties: &armsignalr.CustomCertificateProperties{ - // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), - // KeyVaultSecretName: to.Ptr("mycert"), - // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCustomCertificatesClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySignalRService", "myCert", armsignalr.CustomCertificate{ - Properties: &armsignalr.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 = armsignalr.CustomCertificate{ - // Name: to.Ptr("myCert"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/customCertificates"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert"), - // Properties: &armsignalr.CustomCertificateProperties{ - // KeyVaultBaseURI: to.Ptr("https://myvault.keyvault.azure.net/"), - // KeyVaultSecretName: to.Ptr("mycert"), - // KeyVaultSecretVersion: to.Ptr("bb6a44b2743f47f68dad0d6cc9756432"), - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomCertificates_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCustomCertificatesClient().Delete(ctx, "myResourceGroup", "mySignalRService", "myCert", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/signalr/armsignalr/customdomains_client.go b/sdk/resourcemanager/signalr/armsignalr/customdomains_client.go index 2a9857868f30..8429d10f4a73 100644 --- a/sdk/resourcemanager/signalr/armsignalr/customdomains_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/customdomains_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -73,7 +73,7 @@ func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *CustomDomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, options *CustomDomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -131,7 +131,7 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -158,7 +158,7 @@ func (client *CustomDomainsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *CustomDomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginDelete" @@ -204,7 +204,7 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +213,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -264,7 +264,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (Custo // NewListPager - List all custom domains. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.NewListPager method. @@ -328,7 +328,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/customdomains_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/customdomains_client_example_test.go deleted file mode 100644 index 57742a4d0fd4..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/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 armsignalr_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/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomDomainsClient().NewListPager("myResourceGroup", "mySignalRService", 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 = armsignalr.CustomDomainList{ - // Value: []*armsignalr.CustomDomain{ - // { - // Name: to.Ptr("myDomain"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customDomains/myDomain"), - // Properties: &armsignalr.CustomDomainProperties{ - // CustomCertificate: &armsignalr.ResourceReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert"), - // }, - // DomainName: to.Ptr("example.com"), - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomDomainsClient().Get(ctx, "myResourceGroup", "mySignalRService", "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 = armsignalr.CustomDomain{ - // Name: to.Ptr("myDomain"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customDomains/myDomain"), - // Properties: &armsignalr.CustomDomainProperties{ - // CustomCertificate: &armsignalr.ResourceReference{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert"), - // }, - // DomainName: to.Ptr("example.com"), - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCustomDomainsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySignalRService", "myDomain", armsignalr.CustomDomain{ - Properties: &armsignalr.CustomDomainProperties{ - CustomCertificate: &armsignalr.ResourceReference{ - ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRCustomDomains_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCustomDomainsClient().BeginDelete(ctx, "myResourceGroup", "mySignalRService", "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/signalr/armsignalr/fake/replica_server.go b/sdk/resourcemanager/signalr/armsignalr/fake/replica_server.go new file mode 100644 index 000000000000..2a667cd1b32b --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/fake/replica_server.go @@ -0,0 +1,228 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" + "net/http" + "net/url" + "regexp" +) + +// ReplicaServer is a fake server for instances of the armsignalr.ReplicaClient type. +type ReplicaServer struct { + // BeginSharedPrivateLinkResourcesCreateOrUpdate is the fake for method ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginSharedPrivateLinkResourcesCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters armsignalr.SharedPrivateLinkResource, options *armsignalr.ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (resp azfake.PollerResponder[armsignalr.ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // SharedPrivateLinkResourcesGet is the fake for method ReplicaClient.SharedPrivateLinkResourcesGet + // HTTP status codes to indicate success: http.StatusOK + SharedPrivateLinkResourcesGet func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, options *armsignalr.ReplicaClientSharedPrivateLinkResourcesGetOptions) (resp azfake.Responder[armsignalr.ReplicaClientSharedPrivateLinkResourcesGetResponse], errResp azfake.ErrorResponder) + + // NewSharedPrivateLinkResourcesListPager is the fake for method ReplicaClient.NewSharedPrivateLinkResourcesListPager + // HTTP status codes to indicate success: http.StatusOK + NewSharedPrivateLinkResourcesListPager func(resourceGroupName string, resourceName string, replicaName string, options *armsignalr.ReplicaClientSharedPrivateLinkResourcesListOptions) (resp azfake.PagerResponder[armsignalr.ReplicaClientSharedPrivateLinkResourcesListResponse]) +} + +// NewReplicaServerTransport creates a new instance of ReplicaServerTransport with the provided implementation. +// The returned ReplicaServerTransport instance is connected to an instance of armsignalr.ReplicaClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewReplicaServerTransport(srv *ReplicaServer) *ReplicaServerTransport { + return &ReplicaServerTransport{ + srv: srv, + beginSharedPrivateLinkResourcesCreateOrUpdate: newTracker[azfake.PollerResponder[armsignalr.ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse]](), + newSharedPrivateLinkResourcesListPager: newTracker[azfake.PagerResponder[armsignalr.ReplicaClientSharedPrivateLinkResourcesListResponse]](), + } +} + +// ReplicaServerTransport connects instances of armsignalr.ReplicaClient to instances of ReplicaServer. +// Don't use this type directly, use NewReplicaServerTransport instead. +type ReplicaServerTransport struct { + srv *ReplicaServer + beginSharedPrivateLinkResourcesCreateOrUpdate *tracker[azfake.PollerResponder[armsignalr.ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse]] + newSharedPrivateLinkResourcesListPager *tracker[azfake.PagerResponder[armsignalr.ReplicaClientSharedPrivateLinkResourcesListResponse]] +} + +// Do implements the policy.Transporter interface for ReplicaServerTransport. +func (r *ReplicaServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate": + resp, err = r.dispatchBeginSharedPrivateLinkResourcesCreateOrUpdate(req) + case "ReplicaClient.SharedPrivateLinkResourcesGet": + resp, err = r.dispatchSharedPrivateLinkResourcesGet(req) + case "ReplicaClient.NewSharedPrivateLinkResourcesListPager": + resp, err = r.dispatchNewSharedPrivateLinkResourcesListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *ReplicaServerTransport) dispatchBeginSharedPrivateLinkResourcesCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginSharedPrivateLinkResourcesCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSharedPrivateLinkResourcesCreateOrUpdate not implemented")} + } + beginSharedPrivateLinkResourcesCreateOrUpdate := r.beginSharedPrivateLinkResourcesCreateOrUpdate.get(req) + if beginSharedPrivateLinkResourcesCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsignalr.SharedPrivateLinkResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginSharedPrivateLinkResourcesCreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, sharedPrivateLinkResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSharedPrivateLinkResourcesCreateOrUpdate = &respr + r.beginSharedPrivateLinkResourcesCreateOrUpdate.add(req, beginSharedPrivateLinkResourcesCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginSharedPrivateLinkResourcesCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginSharedPrivateLinkResourcesCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSharedPrivateLinkResourcesCreateOrUpdate) { + r.beginSharedPrivateLinkResourcesCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *ReplicaServerTransport) dispatchSharedPrivateLinkResourcesGet(req *http.Request) (*http.Response, error) { + if r.srv.SharedPrivateLinkResourcesGet == nil { + return nil, &nonRetriableError{errors.New("fake for method SharedPrivateLinkResourcesGet not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.SharedPrivateLinkResourcesGet(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, sharedPrivateLinkResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SharedPrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ReplicaServerTransport) dispatchNewSharedPrivateLinkResourcesListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewSharedPrivateLinkResourcesListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewSharedPrivateLinkResourcesListPager not implemented")} + } + newSharedPrivateLinkResourcesListPager := r.newSharedPrivateLinkResourcesListPager.get(req) + if newSharedPrivateLinkResourcesListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/signalR/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + resp := r.srv.NewSharedPrivateLinkResourcesListPager(resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + newSharedPrivateLinkResourcesListPager = &resp + r.newSharedPrivateLinkResourcesListPager.add(req, newSharedPrivateLinkResourcesListPager) + server.PagerResponderInjectNextLinks(newSharedPrivateLinkResourcesListPager, req, func(page *armsignalr.ReplicaClientSharedPrivateLinkResourcesListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newSharedPrivateLinkResourcesListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newSharedPrivateLinkResourcesListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newSharedPrivateLinkResourcesListPager) { + r.newSharedPrivateLinkResourcesListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/signalr/armsignalr/fake/server_factory.go b/sdk/resourcemanager/signalr/armsignalr/fake/server_factory.go index 1e7c73b07ce2..18eaa7862574 100644 --- a/sdk/resourcemanager/signalr/armsignalr/fake/server_factory.go +++ b/sdk/resourcemanager/signalr/armsignalr/fake/server_factory.go @@ -25,6 +25,7 @@ type ServerFactory struct { OperationsServer OperationsServer PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer PrivateLinkResourcesServer PrivateLinkResourcesServer + ReplicaServer ReplicaServer ReplicasServer ReplicasServer SharedPrivateLinkResourcesServer SharedPrivateLinkResourcesServer UsagesServer UsagesServer @@ -50,6 +51,7 @@ type ServerFactoryTransport struct { trOperationsServer *OperationsServerTransport trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trReplicaServer *ReplicaServerTransport trReplicasServer *ReplicasServerTransport trSharedPrivateLinkResourcesServer *SharedPrivateLinkResourcesServerTransport trUsagesServer *UsagesServerTransport @@ -94,6 +96,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) + case "ReplicaClient": + initServer(s, &s.trReplicaServer, func() *ReplicaServerTransport { return NewReplicaServerTransport(&s.srv.ReplicaServer) }) + resp, err = s.trReplicaServer.Do(req) case "ReplicasClient": initServer(s, &s.trReplicasServer, func() *ReplicasServerTransport { return NewReplicasServerTransport(&s.srv.ReplicasServer) }) resp, err = s.trReplicasServer.Do(req) diff --git a/sdk/resourcemanager/signalr/armsignalr/fake/time_rfc3339.go b/sdk/resourcemanager/signalr/armsignalr/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/signalr/armsignalr/fake/time_rfc3339.go +++ b/sdk/resourcemanager/signalr/armsignalr/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/signalr/armsignalr/go.mod b/sdk/resourcemanager/signalr/armsignalr/go.mod index 02673e5f666c..00d91068e15e 100644 --- a/sdk/resourcemanager/signalr/armsignalr/go.mod +++ b/sdk/resourcemanager/signalr/armsignalr/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.2.0 // indirect diff --git a/sdk/resourcemanager/signalr/armsignalr/models.go b/sdk/resourcemanager/signalr/armsignalr/models.go index 1769ee7076d5..d05d3fa76e91 100644 --- a/sdk/resourcemanager/signalr/armsignalr/models.go +++ b/sdk/resourcemanager/signalr/armsignalr/models.go @@ -647,12 +647,13 @@ type ResourceReference struct { // ResourceSKU - The billing information of the resource. type ResourceSKU struct { // REQUIRED; The name of the SKU. Required. - // Allowed values: StandardS1, FreeF1, Premium_P1 + // Allowed values: StandardS1, FreeF1, PremiumP1, PremiumP2 Name *string - // Optional, integer. The unit count of the resource. 1 by default. - // If present, following values are allowed: Free: 1; Standard: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; Premium: - // 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + // Optional, integer. The unit count of the resource. 1 for FreeF1/StandardS1/PremiumP1, 100 for PremiumP2 by default. + // If present, following values are allowed: FreeF1: 1; StandardS1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; PremiumP1: + // 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; PremiumP2: + // 100,200,300,400,500,600,700,800,900,1000; Capacity *int32 // Optional tier of this particular SKU. 'Standard' or 'Free'. diff --git a/sdk/resourcemanager/signalr/armsignalr/models_serde.go b/sdk/resourcemanager/signalr/armsignalr/models_serde.go index f0ee3e4eb801..2432aeb122b2 100644 --- a/sdk/resourcemanager/signalr/armsignalr/models_serde.go +++ b/sdk/resourcemanager/signalr/armsignalr/models_serde.go @@ -2374,7 +2374,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/operations_client.go b/sdk/resourcemanager/signalr/armsignalr/operations_client.go index 24176b969039..b81894b9de01 100644 --- a/sdk/resourcemanager/signalr/armsignalr/operations_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/operations_client.go @@ -39,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-08-01-preview +// Generated from API version 2024-01-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/operations_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/operations_client_example_test.go deleted file mode 100644 index 16a1964ea81e..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/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 armsignalr_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsignalr.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 = armsignalr.OperationList{ - // Value: []*armsignalr.Operation{ - // { - // Name: to.Ptr("Microsoft.SignalRService/SignalR/read"), - // Display: &armsignalr.OperationDisplay{ - // Description: to.Ptr("View the resource settings and configurations in the management portal or through API"), - // Operation: to.Ptr("Manage SignalR (read-only)"), - // Provider: to.Ptr("Microsoft.SignalRService"), - // Resource: to.Ptr("SignalR"), - // }, - // IsDataAction: to.Ptr(false), - // Properties: &armsignalr.OperationProperties{ - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/signalr/armsignalr/options.go b/sdk/resourcemanager/signalr/armsignalr/options.go index dd5236936463..f55dce74275d 100644 --- a/sdk/resourcemanager/signalr/armsignalr/options.go +++ b/sdk/resourcemanager/signalr/armsignalr/options.go @@ -154,6 +154,25 @@ type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } +// ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions contains the optional parameters for the ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate +// method. +type ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicaClientSharedPrivateLinkResourcesGetOptions contains the optional parameters for the ReplicaClient.SharedPrivateLinkResourcesGet +// method. +type ReplicaClientSharedPrivateLinkResourcesGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicaClientSharedPrivateLinkResourcesListOptions contains the optional parameters for the ReplicaClient.NewSharedPrivateLinkResourcesListPager +// method. +type ReplicaClientSharedPrivateLinkResourcesListOptions 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. diff --git a/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client.go b/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client.go index a339096ee576..b1c5e52ef11f 100644 --- a/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-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. @@ -73,7 +73,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -119,7 +119,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -128,7 +128,7 @@ 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-08-01-preview +// Generated from API version 2024-01-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. @@ -180,7 +180,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,7 +197,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List private endpoint connections // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -245,7 +245,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +263,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-08-01-preview +// Generated from API version 2024-01-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. @@ -316,7 +316,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/privateendpointconnections_client_example_test.go deleted file mode 100644 index d28ac6905229..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/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 armsignalr_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/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("myResourceGroup", "mySignalRService", 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 = armsignalr.PrivateEndpointConnectionList{ - // Value: []*armsignalr.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Properties: &armsignalr.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("signalr")}, - // PrivateEndpoint: &armsignalr.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "mySignalRService", 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 = armsignalr.PrivateEndpointConnection{ - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Properties: &armsignalr.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("signalr")}, - // PrivateEndpoint: &armsignalr.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Update(ctx, "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "mySignalRService", armsignalr.PrivateEndpointConnection{ - Properties: &armsignalr.PrivateEndpointConnectionProperties{ - PrivateEndpoint: &armsignalr.PrivateEndpoint{}, - PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - ActionsRequired: to.Ptr("None"), - Status: to.Ptr(armsignalr.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 = armsignalr.PrivateEndpointConnection{ - // Name: to.Ptr("mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Properties: &armsignalr.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("signalr")}, - // PrivateEndpoint: &armsignalr.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armsignalr.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armsignalr.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateEndpointConnections_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", "myResourceGroup", "mySignalRService", 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/signalr/armsignalr/privatelinkresources_client.go b/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client.go index d456e8fd4c10..babaabd2fb8c 100644 --- a/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client.go @@ -45,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager @@ -93,7 +93,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/privatelinkresources_client_example_test.go deleted file mode 100644 index 8484259461c1..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/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 armsignalr_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRPrivateLinkResources_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListPager("myResourceGroup", "mySignalRService", 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 = armsignalr.PrivateLinkResourceList{ - // Value: []*armsignalr.PrivateLinkResource{ - // { - // Name: to.Ptr("myPrivateLink"), - // Type: to.Ptr("privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateLinkResources/myPrivateLink"), - // Properties: &armsignalr.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("signalr"), - // RequiredMembers: []*string{ - // to.Ptr("signalr")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.service.signalr.net")}, - // ShareablePrivateLinkResourceTypes: []*armsignalr.ShareablePrivateLinkResourceType{ - // { - // Name: to.Ptr("site"), - // Properties: &armsignalr.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: &armsignalr.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: &armsignalr.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/signalr/armsignalr/replica_client.go b/sdk/resourcemanager/signalr/armsignalr/replica_client.go new file mode 100644 index 000000000000..eb5767256a97 --- /dev/null +++ b/sdk/resourcemanager/signalr/armsignalr/replica_client.go @@ -0,0 +1,280 @@ +//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 armsignalr + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReplicaClient contains the methods for the SignalRReplica group. +// Don't use this type directly, use NewReplicaClient() instead. +type ReplicaClient struct { + internal *arm.Client + subscriptionID string +} + +// NewReplicaClient creates a new instance of ReplicaClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicaClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ReplicaClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginSharedPrivateLinkResourcesCreateOrUpdate - Create or update a shared private link resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - sharedPrivateLinkResourceName - The name of the shared private link resource +// - parameters - The shared private link resource +// - options - ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions contains the optional parameters for the ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate +// method. +func (client *ReplicaClient) BeginSharedPrivateLinkResourcesCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (*runtime.Poller[ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sharedPrivateLinkResourcesCreateOrUpdate(ctx, resourceGroupName, resourceName, replicaName, sharedPrivateLinkResourceName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SharedPrivateLinkResourcesCreateOrUpdate - Create or update a shared private link resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01-preview +func (client *ReplicaClient) sharedPrivateLinkResourcesCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sharedPrivateLinkResourcesCreateOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, sharedPrivateLinkResourceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// sharedPrivateLinkResourcesCreateOrUpdateCreateRequest creates the SharedPrivateLinkResourcesCreateOrUpdate request. +func (client *ReplicaClient) sharedPrivateLinkResourcesCreateOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// SharedPrivateLinkResourcesGet - Get the specified shared private link resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - sharedPrivateLinkResourceName - The name of the shared private link resource +// - options - ReplicaClientSharedPrivateLinkResourcesGetOptions contains the optional parameters for the ReplicaClient.SharedPrivateLinkResourcesGet +// method. +func (client *ReplicaClient) SharedPrivateLinkResourcesGet(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, options *ReplicaClientSharedPrivateLinkResourcesGetOptions) (ReplicaClientSharedPrivateLinkResourcesGetResponse, error) { + var err error + const operationName = "ReplicaClient.SharedPrivateLinkResourcesGet" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sharedPrivateLinkResourcesGetCreateRequest(ctx, resourceGroupName, resourceName, replicaName, sharedPrivateLinkResourceName, options) + if err != nil { + return ReplicaClientSharedPrivateLinkResourcesGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ReplicaClientSharedPrivateLinkResourcesGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ReplicaClientSharedPrivateLinkResourcesGetResponse{}, err + } + resp, err := client.sharedPrivateLinkResourcesGetHandleResponse(httpResp) + return resp, err +} + +// sharedPrivateLinkResourcesGetCreateRequest creates the SharedPrivateLinkResourcesGet request. +func (client *ReplicaClient) sharedPrivateLinkResourcesGetCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, options *ReplicaClientSharedPrivateLinkResourcesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// sharedPrivateLinkResourcesGetHandleResponse handles the SharedPrivateLinkResourcesGet response. +func (client *ReplicaClient) sharedPrivateLinkResourcesGetHandleResponse(resp *http.Response) (ReplicaClientSharedPrivateLinkResourcesGetResponse, error) { + result := ReplicaClientSharedPrivateLinkResourcesGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResource); err != nil { + return ReplicaClientSharedPrivateLinkResourcesGetResponse{}, err + } + return result, nil +} + +// NewSharedPrivateLinkResourcesListPager - List shared private link resources +// +// Generated from API version 2024-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicaClientSharedPrivateLinkResourcesListOptions contains the optional parameters for the ReplicaClient.NewSharedPrivateLinkResourcesListPager +// method. +func (client *ReplicaClient) NewSharedPrivateLinkResourcesListPager(resourceGroupName string, resourceName string, replicaName string, options *ReplicaClientSharedPrivateLinkResourcesListOptions) *runtime.Pager[ReplicaClientSharedPrivateLinkResourcesListResponse] { + return runtime.NewPager(runtime.PagingHandler[ReplicaClientSharedPrivateLinkResourcesListResponse]{ + More: func(page ReplicaClientSharedPrivateLinkResourcesListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ReplicaClientSharedPrivateLinkResourcesListResponse) (ReplicaClientSharedPrivateLinkResourcesListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ReplicaClient.NewSharedPrivateLinkResourcesListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.sharedPrivateLinkResourcesListCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + }, nil) + if err != nil { + return ReplicaClientSharedPrivateLinkResourcesListResponse{}, err + } + return client.sharedPrivateLinkResourcesListHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// sharedPrivateLinkResourcesListCreateRequest creates the SharedPrivateLinkResourcesList request. +func (client *ReplicaClient) sharedPrivateLinkResourcesListCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicaClientSharedPrivateLinkResourcesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// sharedPrivateLinkResourcesListHandleResponse handles the SharedPrivateLinkResourcesList response. +func (client *ReplicaClient) sharedPrivateLinkResourcesListHandleResponse(resp *http.Response) (ReplicaClientSharedPrivateLinkResourcesListResponse, error) { + result := ReplicaClientSharedPrivateLinkResourcesListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResourceList); err != nil { + return ReplicaClientSharedPrivateLinkResourcesListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/signalr/armsignalr/replicas_client.go b/sdk/resourcemanager/signalr/armsignalr/replicas_client.go index 8bea58845f38..d2630f9a91cf 100644 --- a/sdk/resourcemanager/signalr/armsignalr/replicas_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/replicas_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -74,7 +74,7 @@ func (client *ReplicasClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *ReplicasClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,7 +132,7 @@ func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, r // Delete - Operation to delete a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -182,7 +182,7 @@ func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -242,7 +242,7 @@ func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +259,7 @@ func (client *ReplicasClient) getHandleResponse(resp *http.Response) (ReplicasCl // NewListPager - List all replicas belong to this resource // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. @@ -306,7 +306,7 @@ func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -324,7 +324,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -350,7 +350,7 @@ func (client *ReplicasClient) BeginRestart(ctx context.Context, resourceGroupNam // Restart - Operation to restart a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *ReplicasClient) restart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginRestart" @@ -396,7 +396,7 @@ func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -405,7 +405,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -432,7 +432,7 @@ func (client *ReplicasClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Operation to update an exiting replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *ReplicasClient) update(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginUpdate" @@ -478,7 +478,7 @@ func (client *ReplicasClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/signalr/armsignalr/replicas_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/replicas_client_example_test.go deleted file mode 100644 index 65bd2cccec33..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/replicas_client_example_test.go +++ /dev/null @@ -1,291 +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 armsignalr_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/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReplicasClient().NewListPager("myResourceGroup", "mySignalRService", 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 = armsignalr.ReplicaList{ - // Value: []*armsignalr.Replica{ - // { - // Name: to.Ptr("mySignalRService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/replicas/mySignalRService-eastus"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armsignalr.ReplicaProperties{ - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReplicasClient().Get(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-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 = armsignalr.Replica{ - // Name: to.Ptr("mySignalRService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/replicas/mySignalRService-eastus"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armsignalr.ReplicaProperties{ - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicasClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-eastus", armsignalr.Replica{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armsignalr.ReplicaProperties{ - ResourceStopped: to.Ptr("false"), - }, - SKU: &armsignalr.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - }, - }, 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 = armsignalr.Replica{ - // Name: to.Ptr("mySignalRService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/replicas/mySignalRService-eastus"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armsignalr.ReplicaProperties{ - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewReplicasClient().Delete(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicasClient().BeginUpdate(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-eastus", armsignalr.Replica{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - Properties: &armsignalr.ReplicaProperties{ - ResourceStopped: to.Ptr("false"), - }, - SKU: &armsignalr.ResourceSKU{ - Name: to.Ptr("Premium_P1"), - Capacity: to.Ptr[int32](1), - Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - }, - }, 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 = armsignalr.Replica{ - // Name: to.Ptr("mySignalRService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/replicas/mySignalRService-eastus"), - // SystemData: &armsignalr.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armsignalr.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armsignalr.ReplicaProperties{ - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armsignalr.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armsignalr.SignalRSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRReplicas_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicasClient().BeginRestart(ctx, "myResourceGroup", "mySignalRService", "mySignalRService-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/signalr/armsignalr/response_types.go b/sdk/resourcemanager/signalr/armsignalr/responses.go similarity index 90% rename from sdk/resourcemanager/signalr/armsignalr/response_types.go rename to sdk/resourcemanager/signalr/armsignalr/responses.go index 4076cc5243a5..148c09935ad7 100644 --- a/sdk/resourcemanager/signalr/armsignalr/response_types.go +++ b/sdk/resourcemanager/signalr/armsignalr/responses.go @@ -159,6 +159,24 @@ type PrivateLinkResourcesClientListResponse struct { PrivateLinkResourceList } +// ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse contains the response from method ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate. +type ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse struct { + // Describes a Shared Private Link Resource + SharedPrivateLinkResource +} + +// ReplicaClientSharedPrivateLinkResourcesGetResponse contains the response from method ReplicaClient.SharedPrivateLinkResourcesGet. +type ReplicaClientSharedPrivateLinkResourcesGetResponse struct { + // Describes a Shared Private Link Resource + SharedPrivateLinkResource +} + +// ReplicaClientSharedPrivateLinkResourcesListResponse contains the response from method ReplicaClient.NewSharedPrivateLinkResourcesListPager. +type ReplicaClientSharedPrivateLinkResourcesListResponse struct { + // A list of shared private link resources + SharedPrivateLinkResourceList +} + // ReplicasClientCreateOrUpdateResponse contains the response from method ReplicasClient.BeginCreateOrUpdate. type ReplicasClientCreateOrUpdateResponse struct { // A class represent a replica resource. diff --git a/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client.go b/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client.go index 6eee0447fc86..21feea89577b 100644 --- a/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-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. @@ -74,7 +74,7 @@ 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-08-01-preview +// Generated from API version 2024-01-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 const operationName = "SharedPrivateLinkResourcesClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,7 +132,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-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. @@ -159,7 +159,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.BeginDelete" @@ -205,7 +205,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ 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-08-01-preview +// Generated from API version 2024-01-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. @@ -266,7 +266,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res // NewListPager - List shared private link resources // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListPager @@ -331,7 +331,7 @@ func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/sharedprivatelinkresources_client_example_test.go deleted file mode 100644 index e329bbea54d6..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/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 armsignalr_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/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSharedPrivateLinkResourcesClient().NewListPager("myResourceGroup", "mySignalRService", 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 = armsignalr.SharedPrivateLinkResourceList{ - // Value: []*armsignalr.SharedPrivateLinkResource{ - // { - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/upstream"), - // Properties: &armsignalr.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armsignalr.SharedPrivateLinkResourceStatusApproved), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSharedPrivateLinkResourcesClient().Get(ctx, "upstream", "myResourceGroup", "mySignalRService", 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 = armsignalr.SharedPrivateLinkResource{ - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/upstream"), - // Properties: &armsignalr.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armsignalr.SharedPrivateLinkResourceStatusApproved), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().BeginCreateOrUpdate(ctx, "upstream", "myResourceGroup", "mySignalRService", armsignalr.SharedPrivateLinkResource{ - Properties: &armsignalr.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 = armsignalr.SharedPrivateLinkResource{ - // Name: to.Ptr("upstream"), - // Type: to.Ptr("Microsoft.SignalRService/SignalR/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/upstream"), - // Properties: &armsignalr.SharedPrivateLinkResourceProperties{ - // GroupID: to.Ptr("sites"), - // PrivateLinkResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp"), - // ProvisioningState: to.Ptr(armsignalr.ProvisioningStateSucceeded), - // RequestMessage: to.Ptr("Please approve"), - // Status: to.Ptr(armsignalr.SharedPrivateLinkResourceStatusApproved), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/SignalRSharedPrivateLinkResources_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 := armsignalr.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().BeginDelete(ctx, "upstream", "myResourceGroup", "mySignalRService", 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/signalr/armsignalr/time_rfc3339.go b/sdk/resourcemanager/signalr/armsignalr/time_rfc3339.go index e2de6af4d0f5..15ec78418feb 100644 --- a/sdk/resourcemanager/signalr/armsignalr/time_rfc3339.go +++ b/sdk/resourcemanager/signalr/armsignalr/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/signalr/armsignalr/usages_client.go b/sdk/resourcemanager/signalr/armsignalr/usages_client.go index f9eb5ece59fa..0a0b7fc0d2e6 100644 --- a/sdk/resourcemanager/signalr/armsignalr/usages_client.go +++ b/sdk/resourcemanager/signalr/armsignalr/usages_client.go @@ -45,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - List resource usage quotas by location. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-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] { @@ -87,7 +87,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/signalr/armsignalr/usages_client_example_test.go b/sdk/resourcemanager/signalr/armsignalr/usages_client_example_test.go deleted file mode 100644 index 9eaf8d8b88dd..000000000000 --- a/sdk/resourcemanager/signalr/armsignalr/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 armsignalr_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/signalr/armsignalr" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/signalr/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Usages_List.json -func ExampleUsagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsignalr.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.UsageList = armsignalr.UsageList{ - // Value: []*armsignalr.Usage{ - // { - // Name: &armsignalr.UsageName{ - // 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: &armsignalr.UsageName{ - // 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"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md index 6f83c76516ab..d4bf4eaaee81 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/CHANGELOG.md @@ -1,5 +1,18 @@ # Release History +## 1.3.0-beta.2 (2024-03-13) +### Features Added + +- New function `*ClientFactory.NewReplicaClient() *ReplicaClient` +- New function `NewReplicaClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ReplicaClient, error)` +- New function `*ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate(context.Context, string, string, string, string, SharedPrivateLinkResource, *ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (*runtime.Poller[ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse], error)` +- New function `*ReplicaClient.SharedPrivateLinkResourcesGet(context.Context, string, string, string, string, *ReplicaClientSharedPrivateLinkResourcesGetOptions) (ReplicaClientSharedPrivateLinkResourcesGetResponse, error)` +- New function `*ReplicaClient.NewSharedPrivateLinkResourcesListPager(string, string, string, *ReplicaClientSharedPrivateLinkResourcesListOptions) *runtime.Pager[ReplicaClientSharedPrivateLinkResourcesListResponse]` +- New struct `SocketIOSettings` +- New field `WebSocketKeepAliveIntervalInSeconds` in struct `HubProperties` +- New field `SocketIO` in struct `Properties` + + ## 1.3.0-beta.1 (2023-11-30) ### Features Added diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md b/sdk/resourcemanager/webpubsub/armwebpubsub/autorest.md index f09f9a303265..2a8a8de285b1 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/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.3.0-beta.1 -tag: package-2023-08-01-preview +module-version: 1.3.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 98d448631e70..e71d9a445d64 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client.go @@ -46,7 +46,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - location - the region // - parameters - Parameters supplied to the operation. // - options - ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. @@ -88,7 +88,7 @@ func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, lo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -109,7 +109,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameters for the create or update operation @@ -135,7 +135,7 @@ func (client *Client) BeginCreateOrUpdate(ctx context.Context, resourceGroupName // CreateOrUpdate - Create or update a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginCreateOrUpdate" @@ -177,7 +177,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -189,7 +189,7 @@ func (client *Client) createOrUpdateCreateRequest(ctx context.Context, resourceG // BeginDelete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. @@ -214,7 +214,7 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, // Delete - Operation to delete a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "Client.BeginDelete" @@ -256,7 +256,7 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +265,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. @@ -311,7 +311,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +328,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager // method. @@ -371,7 +371,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -388,7 +388,7 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - options - ClientListBySubscriptionOptions contains the optional parameters for the Client.NewListBySubscriptionPager method. func (client *Client) NewListBySubscriptionPager(options *ClientListBySubscriptionOptions) *runtime.Pager[ClientListBySubscriptionResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListBySubscriptionResponse]{ @@ -425,7 +425,7 @@ func (client *Client) listBySubscriptionCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -443,7 +443,7 @@ func (client *Client) listBySubscriptionHandleResponse(resp *http.Response) (Cli // ListKeys - Get the access keys of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListKeysOptions contains the optional parameters for the Client.ListKeys method. @@ -489,7 +489,7 @@ func (client *Client) listKeysCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -507,7 +507,7 @@ func (client *Client) listKeysHandleResponse(resp *http.Response) (ClientListKey // ListReplicaSKUs - List all available skus of the replica resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -558,7 +558,7 @@ func (client *Client) listReplicaSKUsCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -576,7 +576,7 @@ func (client *Client) listReplicaSKUsHandleResponse(resp *http.Response) (Client // ListSKUs - List all available skus of the resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientListSKUsOptions contains the optional parameters for the Client.ListSKUs method. @@ -622,7 +622,7 @@ func (client *Client) listSKUsCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -641,7 +641,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameter that describes the Regenerate Key Operation. @@ -668,7 +668,7 @@ func (client *Client) BeginRegenerateKey(ctx context.Context, resourceGroupName // time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) regenerateKey(ctx context.Context, resourceGroupName string, resourceName string, parameters RegenerateKeyParameters, options *ClientBeginRegenerateKeyOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRegenerateKey" @@ -710,7 +710,7 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -722,7 +722,7 @@ func (client *Client) regenerateKeyCreateRequest(ctx context.Context, resourceGr // BeginRestart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ClientBeginRestartOptions contains the optional parameters for the Client.BeginRestart method. @@ -747,7 +747,7 @@ func (client *Client) BeginRestart(ctx context.Context, resourceGroupName string // Restart - Operation to restart a resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) restart(ctx context.Context, resourceGroupName string, resourceName string, options *ClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "Client.BeginRestart" @@ -789,7 +789,7 @@ func (client *Client) restartCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -798,7 +798,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - parameters - Parameters for the update operation @@ -824,7 +824,7 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, // Update - Operation to update an exiting resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceInfo, options *ClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "Client.BeginUpdate" @@ -866,7 +866,7 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != 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 f90c38fb8810..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_example_test.go +++ /dev/null @@ -1,1107 +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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_CheckNameAvailability.json -func ExampleClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListBySubscription.json -func ExampleClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceInfoList = armwebpubsub.ResourceInfoList{ - // Value: []*armwebpubsub.ResourceInfo{ - // { - // Name: to.Ptr("myWebPubSubService"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - // Categories: []*armwebpubsub.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armwebpubsub.NetworkACLs{ - // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armwebpubsub.NetworkACL{ - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListByResourceGroup.json -func ExampleClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ResourceInfoList = armwebpubsub.ResourceInfoList{ - // Value: []*armwebpubsub.ResourceInfo{ - // { - // Name: to.Ptr("myWebPubSubService"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - // Categories: []*armwebpubsub.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armwebpubsub.NetworkACLs{ - // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armwebpubsub.NetworkACL{ - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Get.json -func ExampleClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armwebpubsub.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "myResourceGroup", "myWebPubSubService", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ResourceInfo = armwebpubsub.ResourceInfo{ - // Name: to.Ptr("myWebPubSubService"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - // Categories: []*armwebpubsub.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armwebpubsub.NetworkACLs{ - // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armwebpubsub.NetworkACL{ - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_CreateOrUpdate.json -func ExampleClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - // Categories: []*armwebpubsub.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armwebpubsub.NetworkACLs{ - // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armwebpubsub.NetworkACL{ - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Delete.json -func ExampleClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Update.json -func ExampleClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Identity: &armwebpubsub.ManagedIdentity{ - // Type: to.Ptr(armwebpubsub.ManagedIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Kind: to.Ptr(armwebpubsub.ServiceKindWebPubSub), - // Properties: &armwebpubsub.Properties{ - // DisableAADAuth: to.Ptr(false), - // DisableLocalAuth: to.Ptr(false), - // ExternalIP: to.Ptr("10.0.0.1"), - // HostName: to.Ptr("mywebpubsubservice.webpubsub.azure.com"), - // LiveTraceConfiguration: &armwebpubsub.LiveTraceConfiguration{ - // Categories: []*armwebpubsub.LiveTraceCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // Enabled: to.Ptr("false"), - // }, - // NetworkACLs: &armwebpubsub.NetworkACLs{ - // DefaultAction: to.Ptr(armwebpubsub.ACLActionDeny), - // IPRules: []*armwebpubsub.IPRule{ - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123/24"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("123.456.789.123"), - // }, - // { - // Action: to.Ptr(armwebpubsub.ACLActionAllow), - // Value: to.Ptr("AppService"), - // }}, - // PrivateEndpoints: []*armwebpubsub.PrivateEndpointACL{ - // { - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeServerConnection)}, - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // }}, - // PublicNetwork: &armwebpubsub.NetworkACL{ - // Allow: []*armwebpubsub.WebPubSubRequestType{ - // to.Ptr(armwebpubsub.WebPubSubRequestTypeClientConnection)}, - // }, - // }, - // PrivateEndpointConnections: []*armwebpubsub.PrivateEndpointConnection{ - // { - // Name: to.Ptr("mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/privateEndpointConnections/mywebpubsubservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // PublicNetworkAccess: to.Ptr("Enabled"), - // PublicPort: to.Ptr[int32](443), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceLogConfiguration: &armwebpubsub.ResourceLogConfiguration{ - // Categories: []*armwebpubsub.ResourceLogCategory{ - // { - // Name: to.Ptr("ConnectivityLogs"), - // Enabled: to.Ptr("true"), - // }}, - // }, - // ResourceStopped: to.Ptr("false"), - // ServerPort: to.Ptr[int32](443), - // 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListKeys.json -func ExampleClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_RegenerateKey.json -func ExampleClient_BeginRegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_Restart.json -func ExampleClient_BeginRestart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSub_ListSkus.json -func ExampleClient_ListSKUs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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 c4a9c7117c83..e02668c8fe28 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/client_factory.go @@ -17,8 +17,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,72 +26,99 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewClient creates a new instance of Client. func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) - return subClient + return &Client{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewCustomCertificatesClient creates a new instance of CustomCertificatesClient. func (c *ClientFactory) NewCustomCertificatesClient() *CustomCertificatesClient { - subClient, _ := NewCustomCertificatesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &CustomCertificatesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewCustomDomainsClient creates a new instance of CustomDomainsClient. func (c *ClientFactory) NewCustomDomainsClient() *CustomDomainsClient { - subClient, _ := NewCustomDomainsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &CustomDomainsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewHubsClient creates a new instance of HubsClient. func (c *ClientFactory) NewHubsClient() *HubsClient { - subClient, _ := NewHubsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &HubsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewReplicaClient creates a new instance of ReplicaClient. +func (c *ClientFactory) NewReplicaClient() *ReplicaClient { + return &ReplicaClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewReplicasClient creates a new instance of ReplicasClient. func (c *ClientFactory) NewReplicasClient() *ReplicasClient { - subClient, _ := NewReplicasClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ReplicasClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient. func (c *ClientFactory) NewSharedPrivateLinkResourcesClient() *SharedPrivateLinkResourcesClient { - subClient, _ := NewSharedPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &SharedPrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewUsagesClient creates a new instance of UsagesClient. func (c *ClientFactory) NewUsagesClient() *UsagesClient { - subClient, _ := NewUsagesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &UsagesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go index 2d3e2a43ec0e..36a86de6063f 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/constants.go @@ -10,7 +10,7 @@ package armwebpubsub const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" - moduleVersion = "v1.3.0-beta.1" + moduleVersion = "v1.3.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 fe1954564d12..8590af4b541c 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -73,7 +73,7 @@ func (client *CustomCertificatesClient) BeginCreateOrUpdate(ctx context.Context, // CreateOrUpdate - Create or update a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *CustomCertificatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, certificateName string, parameters CustomCertificate, options *CustomCertificatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomCertificatesClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -131,7 +131,7 @@ func (client *CustomCertificatesClient) createOrUpdateCreateRequest(ctx context. // Delete - Delete a custom certificate. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -182,7 +182,7 @@ func (client *CustomCertificatesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - certificateName - Custom certificate name @@ -242,7 +242,7 @@ func (client *CustomCertificatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +259,7 @@ func (client *CustomCertificatesClient) getHandleResponse(resp *http.Response) ( // NewListPager - List all custom certificates. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - CustomCertificatesClientListOptions contains the optional parameters for the CustomCertificatesClient.NewListPager @@ -307,7 +307,7 @@ func (client *CustomCertificatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customcertificates_client_example_test.go deleted file mode 100644 index 270fd9ed9e81..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_List.json -func ExampleCustomCertificatesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_Get.json -func ExampleCustomCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_CreateOrUpdate.json -func ExampleCustomCertificatesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomCertificates_Delete.json -func ExampleCustomCertificatesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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 0da420194967..814e78ef3a9a 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -73,7 +73,7 @@ func (client *CustomDomainsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create or update a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *CustomDomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, name string, parameters CustomDomain, options *CustomDomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginCreateOrUpdate" @@ -119,7 +119,7 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -131,7 +131,7 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -158,7 +158,7 @@ func (client *CustomDomainsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a custom domain. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *CustomDomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, resourceName string, name string, options *CustomDomainsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CustomDomainsClient.BeginDelete" @@ -204,7 +204,7 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +213,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - name - Custom domain name. @@ -264,7 +264,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (Custo // NewListPager - List all custom domains. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - CustomDomainsClientListOptions contains the optional parameters for the CustomDomainsClient.NewListPager method. @@ -328,7 +328,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/customdomains_client_example_test.go deleted file mode 100644 index 32106f13bb94..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_List.json -func ExampleCustomDomainsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_Get.json -func ExampleCustomDomainsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_CreateOrUpdate.json -func ExampleCustomDomainsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubCustomDomains_Delete.json -func ExampleCustomDomainsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/fake/replica_server.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replica_server.go new file mode 100644 index 000000000000..26bff3cac175 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/replica_server.go @@ -0,0 +1,228 @@ +//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 fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/webpubsub/armwebpubsub" + "net/http" + "net/url" + "regexp" +) + +// ReplicaServer is a fake server for instances of the armwebpubsub.ReplicaClient type. +type ReplicaServer struct { + // BeginSharedPrivateLinkResourcesCreateOrUpdate is the fake for method ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginSharedPrivateLinkResourcesCreateOrUpdate func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters armwebpubsub.SharedPrivateLinkResource, options *armwebpubsub.ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (resp azfake.PollerResponder[armwebpubsub.ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // SharedPrivateLinkResourcesGet is the fake for method ReplicaClient.SharedPrivateLinkResourcesGet + // HTTP status codes to indicate success: http.StatusOK + SharedPrivateLinkResourcesGet func(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, options *armwebpubsub.ReplicaClientSharedPrivateLinkResourcesGetOptions) (resp azfake.Responder[armwebpubsub.ReplicaClientSharedPrivateLinkResourcesGetResponse], errResp azfake.ErrorResponder) + + // NewSharedPrivateLinkResourcesListPager is the fake for method ReplicaClient.NewSharedPrivateLinkResourcesListPager + // HTTP status codes to indicate success: http.StatusOK + NewSharedPrivateLinkResourcesListPager func(resourceGroupName string, resourceName string, replicaName string, options *armwebpubsub.ReplicaClientSharedPrivateLinkResourcesListOptions) (resp azfake.PagerResponder[armwebpubsub.ReplicaClientSharedPrivateLinkResourcesListResponse]) +} + +// NewReplicaServerTransport creates a new instance of ReplicaServerTransport with the provided implementation. +// The returned ReplicaServerTransport instance is connected to an instance of armwebpubsub.ReplicaClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewReplicaServerTransport(srv *ReplicaServer) *ReplicaServerTransport { + return &ReplicaServerTransport{ + srv: srv, + beginSharedPrivateLinkResourcesCreateOrUpdate: newTracker[azfake.PollerResponder[armwebpubsub.ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse]](), + newSharedPrivateLinkResourcesListPager: newTracker[azfake.PagerResponder[armwebpubsub.ReplicaClientSharedPrivateLinkResourcesListResponse]](), + } +} + +// ReplicaServerTransport connects instances of armwebpubsub.ReplicaClient to instances of ReplicaServer. +// Don't use this type directly, use NewReplicaServerTransport instead. +type ReplicaServerTransport struct { + srv *ReplicaServer + beginSharedPrivateLinkResourcesCreateOrUpdate *tracker[azfake.PollerResponder[armwebpubsub.ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse]] + newSharedPrivateLinkResourcesListPager *tracker[azfake.PagerResponder[armwebpubsub.ReplicaClientSharedPrivateLinkResourcesListResponse]] +} + +// Do implements the policy.Transporter interface for ReplicaServerTransport. +func (r *ReplicaServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate": + resp, err = r.dispatchBeginSharedPrivateLinkResourcesCreateOrUpdate(req) + case "ReplicaClient.SharedPrivateLinkResourcesGet": + resp, err = r.dispatchSharedPrivateLinkResourcesGet(req) + case "ReplicaClient.NewSharedPrivateLinkResourcesListPager": + resp, err = r.dispatchNewSharedPrivateLinkResourcesListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (r *ReplicaServerTransport) dispatchBeginSharedPrivateLinkResourcesCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginSharedPrivateLinkResourcesCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginSharedPrivateLinkResourcesCreateOrUpdate not implemented")} + } + beginSharedPrivateLinkResourcesCreateOrUpdate := r.beginSharedPrivateLinkResourcesCreateOrUpdate.get(req) + if beginSharedPrivateLinkResourcesCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armwebpubsub.SharedPrivateLinkResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginSharedPrivateLinkResourcesCreateOrUpdate(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, sharedPrivateLinkResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginSharedPrivateLinkResourcesCreateOrUpdate = &respr + r.beginSharedPrivateLinkResourcesCreateOrUpdate.add(req, beginSharedPrivateLinkResourcesCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginSharedPrivateLinkResourcesCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginSharedPrivateLinkResourcesCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginSharedPrivateLinkResourcesCreateOrUpdate) { + r.beginSharedPrivateLinkResourcesCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *ReplicaServerTransport) dispatchSharedPrivateLinkResourcesGet(req *http.Request) (*http.Response, error) { + if r.srv.SharedPrivateLinkResourcesGet == nil { + return nil, &nonRetriableError{errors.New("fake for method SharedPrivateLinkResourcesGet not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.SharedPrivateLinkResourcesGet(req.Context(), resourceGroupNameParam, resourceNameParam, replicaNameParam, sharedPrivateLinkResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SharedPrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ReplicaServerTransport) dispatchNewSharedPrivateLinkResourcesListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewSharedPrivateLinkResourcesListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewSharedPrivateLinkResourcesListPager not implemented")} + } + newSharedPrivateLinkResourcesListPager := r.newSharedPrivateLinkResourcesListPager.get(req) + if newSharedPrivateLinkResourcesListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SignalRService/webPubSub/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) + if err != nil { + return nil, err + } + replicaNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicaName")]) + if err != nil { + return nil, err + } + resp := r.srv.NewSharedPrivateLinkResourcesListPager(resourceGroupNameParam, resourceNameParam, replicaNameParam, nil) + newSharedPrivateLinkResourcesListPager = &resp + r.newSharedPrivateLinkResourcesListPager.add(req, newSharedPrivateLinkResourcesListPager) + server.PagerResponderInjectNextLinks(newSharedPrivateLinkResourcesListPager, req, func(page *armwebpubsub.ReplicaClientSharedPrivateLinkResourcesListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newSharedPrivateLinkResourcesListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newSharedPrivateLinkResourcesListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newSharedPrivateLinkResourcesListPager) { + r.newSharedPrivateLinkResourcesListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go index a4d983504f7d..b01c5f1c8599 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/server_factory.go @@ -26,6 +26,7 @@ type ServerFactory struct { OperationsServer OperationsServer PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer PrivateLinkResourcesServer PrivateLinkResourcesServer + ReplicaServer ReplicaServer ReplicasServer ReplicasServer SharedPrivateLinkResourcesServer SharedPrivateLinkResourcesServer UsagesServer UsagesServer @@ -52,6 +53,7 @@ type ServerFactoryTransport struct { trOperationsServer *OperationsServerTransport trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trReplicaServer *ReplicaServerTransport trReplicasServer *ReplicasServerTransport trSharedPrivateLinkResourcesServer *SharedPrivateLinkResourcesServerTransport trUsagesServer *UsagesServerTransport @@ -99,6 +101,9 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) }) resp, err = s.trPrivateLinkResourcesServer.Do(req) + case "ReplicaClient": + initServer(s, &s.trReplicaServer, func() *ReplicaServerTransport { return NewReplicaServerTransport(&s.srv.ReplicaServer) }) + resp, err = s.trReplicaServer.Do(req) case "ReplicasClient": initServer(s, &s.trReplicasServer, func() *ReplicasServerTransport { return NewReplicasServerTransport(&s.srv.ReplicasServer) }) resp, err = s.trReplicasServer.Do(req) diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/time_rfc3339.go b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/fake/time_rfc3339.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod index 5bb98d7dffa5..2a3690e173c2 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/go.mod @@ -4,7 +4,6 @@ go 1.18 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v2 v2.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dnaeon/go-vcr v1.2.0 // indirect diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go index cc0d32e15bee..d7d4b1755d42 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-01-preview // - hubName - The hub name. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -74,7 +74,7 @@ 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-08-01-preview +// Generated from API version 2024-01-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 const operationName = "HubsClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,7 +132,7 @@ func (client *HubsClient) createOrUpdateCreateRequest(ctx context.Context, hubNa // BeginDelete - Delete a hub setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - hubName - The hub name. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -158,7 +158,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview func (client *HubsClient) deleteOperation(ctx context.Context, hubName string, resourceGroupName string, resourceName string, options *HubsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "HubsClient.BeginDelete" @@ -204,7 +204,7 @@ func (client *HubsClient) deleteCreateRequest(ctx context.Context, hubName strin return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +213,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - hubName - The hub name. // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. @@ -264,7 +264,7 @@ func (client *HubsClient) getCreateRequest(ctx context.Context, hubName string, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +281,7 @@ func (client *HubsClient) getHandleResponse(resp *http.Response) (HubsClientGetR // NewListPager - List hub settings. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - HubsClientListOptions contains the optional parameters for the HubsClient.NewListPager method. @@ -328,7 +328,7 @@ func (client *HubsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/hubs_client_example_test.go deleted file mode 100644 index 40cd291ecd4a..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_List.json -func ExampleHubsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_Get.json -func ExampleHubsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_CreateOrUpdate.json -func ExampleHubsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubHubs_Delete.json -func ExampleHubsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/models.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go index ba4a5ea91789..feaa324ac461 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models.go @@ -236,6 +236,10 @@ type HubProperties struct { // the array elements doesn't matter. Maximum count of event listeners among all // hubs is 10. EventListeners []*EventListener + + // The settings for configuring the WebSocket ping-pong interval in seconds for all clients in the hub. Valid range: 1 to + // 120. Default to 20 seconds. + WebSocketKeepAliveIntervalInSeconds *int32 } // IPRule - An IP rule @@ -580,10 +584,13 @@ type Properties struct { // 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, + // Stop or start the resource. Default to "False". When it's true, the data plane of the resource is shutdown. When it's false, // the data plane of the resource is started. ResourceStopped *string + // SocketIO settings for the resource + SocketIO *SocketIOSettings + // TLS settings for the resource TLS *TLSSettings @@ -733,12 +740,13 @@ type ResourceReference struct { // ResourceSKU - The billing information of the resource. type ResourceSKU struct { // REQUIRED; The name of the SKU. Required. - // Allowed values: StandardS1, FreeF1, Premium_P1 + // Allowed values: StandardS1, FreeF1, PremiumP1, PremiumP2 Name *string - // Optional, integer. The unit count of the resource. 1 by default. - // If present, following values are allowed: Free: 1; Standard: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; Premium: - // 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + // Optional, integer. The unit count of the resource. 1 for FreeF1/StandardS1/PremiumP1, 100 for PremiumP2 by default. + // If present, following values are allowed: FreeF1: 1; StandardS1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; PremiumP1: + // 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; PremiumP2: + // 100,200,300,400,500,600,700,800,900,1000; Capacity *int32 // Optional tier of this particular SKU. 'Standard' or 'Free'. @@ -905,6 +913,13 @@ type SignalRServiceUsageName struct { Value *string } +// SocketIOSettings - SocketIO settings for the resource +type SocketIOSettings struct { + // The service mode of Web PubSub for Socket.IO. Values allowed: "Default": have your own backend Socket.IO server "Serverless": + // your application doesn't have a backend server + ServiceMode *string +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go index d84b2b6b6d10..539abca6dc1c 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/models_serde.go @@ -550,6 +550,7 @@ func (h HubProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "anonymousConnectPolicy", h.AnonymousConnectPolicy) populate(objectMap, "eventHandlers", h.EventHandlers) populate(objectMap, "eventListeners", h.EventListeners) + populate(objectMap, "webSocketKeepAliveIntervalInSeconds", h.WebSocketKeepAliveIntervalInSeconds) return json.Marshal(objectMap) } @@ -571,6 +572,9 @@ func (h *HubProperties) UnmarshalJSON(data []byte) error { case "eventListeners": err = unpopulate(val, "EventListeners", &h.EventListeners) delete(rawMsg, key) + case "webSocketKeepAliveIntervalInSeconds": + err = unpopulate(val, "WebSocketKeepAliveIntervalInSeconds", &h.WebSocketKeepAliveIntervalInSeconds) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", h, err) @@ -1481,6 +1485,7 @@ func (p Properties) MarshalJSON() ([]byte, error) { populate(objectMap, "resourceStopped", p.ResourceStopped) populate(objectMap, "serverPort", p.ServerPort) populate(objectMap, "sharedPrivateLinkResources", p.SharedPrivateLinkResources) + populate(objectMap, "socketIO", p.SocketIO) populate(objectMap, "tls", p.TLS) populate(objectMap, "version", p.Version) return json.Marshal(objectMap) @@ -1543,6 +1548,9 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "sharedPrivateLinkResources": err = unpopulate(val, "SharedPrivateLinkResources", &p.SharedPrivateLinkResources) delete(rawMsg, key) + case "socketIO": + err = unpopulate(val, "SocketIO", &p.SocketIO) + delete(rawMsg, key) case "tls": err = unpopulate(val, "TLS", &p.TLS) delete(rawMsg, key) @@ -2355,6 +2363,33 @@ func (s *SignalRServiceUsageName) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SocketIOSettings. +func (s SocketIOSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "serviceMode", s.ServiceMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SocketIOSettings. +func (s *SocketIOSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceMode": + err = unpopulate(val, "ServiceMode", &s.ServiceMode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2502,7 +2537,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go index acf165c13863..d7f3ed1231d6 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client.go @@ -39,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-08-01-preview +// Generated from API version 2024-01-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/operations_client_example_test.go deleted file mode 100644 index b854869dfded..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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 index e789b76f6b82..843b830391a0 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/options.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/options.go @@ -176,6 +176,25 @@ type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } +// ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions contains the optional parameters for the ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate +// method. +type ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ReplicaClientSharedPrivateLinkResourcesGetOptions contains the optional parameters for the ReplicaClient.SharedPrivateLinkResourcesGet +// method. +type ReplicaClientSharedPrivateLinkResourcesGetOptions struct { + // placeholder for future optional parameters +} + +// ReplicaClientSharedPrivateLinkResourcesListOptions contains the optional parameters for the ReplicaClient.NewSharedPrivateLinkResourcesListPager +// method. +type ReplicaClientSharedPrivateLinkResourcesListOptions 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. diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go b/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go index fcc60c7417bc..f1ad6dfa5ade 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/polymorphic_helpers.go @@ -11,7 +11,7 @@ package armwebpubsub import "encoding/json" func unmarshalEventListenerEndpointClassification(rawMsg json.RawMessage) (EventListenerEndpointClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -32,7 +32,7 @@ func unmarshalEventListenerEndpointClassification(rawMsg json.RawMessage) (Event } func unmarshalEventListenerFilterClassification(rawMsg json.RawMessage) (EventListenerFilterClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go index 60bfa08fa12d..b70ec74b1e8e 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privateendpointconnections_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-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. @@ -73,7 +73,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, privateEndpointConnectionName string, resourceGroupName string, resourceName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -119,7 +119,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -128,7 +128,7 @@ 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-08-01-preview +// Generated from API version 2024-01-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. @@ -180,7 +180,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,7 +197,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - List private endpoint connections // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -245,7 +245,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +263,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-08-01-preview +// Generated from API version 2024-01-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. @@ -316,7 +316,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { 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 d3d6876bb40d..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_List.json -func ExamplePrivateEndpointConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("webpubsub")}, - // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Get.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("webpubsub")}, - // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Update.json -func ExamplePrivateEndpointConnectionsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Properties: &armwebpubsub.PrivateEndpointConnectionProperties{ - // GroupIDs: []*string{ - // to.Ptr("webpubsub")}, - // PrivateEndpoint: &armwebpubsub.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armwebpubsub.PrivateLinkServiceConnectionState{ - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armwebpubsub.PrivateLinkServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateEndpointConnections_Delete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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 edd567bb495c..367dbb4573e9 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client.go @@ -45,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager @@ -93,7 +93,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/privatelinkresources_client_example_test.go deleted file mode 100644 index e90fbab0b076..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubPrivateLinkResources_List.json -func ExamplePrivateLinkResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/replica_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replica_client.go new file mode 100644 index 000000000000..87b973d3acf2 --- /dev/null +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replica_client.go @@ -0,0 +1,280 @@ +//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 + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReplicaClient contains the methods for the WebPubSubReplica group. +// Don't use this type directly, use NewReplicaClient() instead. +type ReplicaClient struct { + internal *arm.Client + subscriptionID string +} + +// NewReplicaClient creates a new instance of ReplicaClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewReplicaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicaClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ReplicaClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginSharedPrivateLinkResourcesCreateOrUpdate - Create or update a shared private link resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - sharedPrivateLinkResourceName - The name of the shared private link resource +// - parameters - The shared private link resource +// - options - ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions contains the optional parameters for the ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate +// method. +func (client *ReplicaClient) BeginSharedPrivateLinkResourcesCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (*runtime.Poller[ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.sharedPrivateLinkResourcesCreateOrUpdate(ctx, resourceGroupName, resourceName, replicaName, sharedPrivateLinkResourceName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// SharedPrivateLinkResourcesCreateOrUpdate - Create or update a shared private link resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01-preview +func (client *ReplicaClient) sharedPrivateLinkResourcesCreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sharedPrivateLinkResourcesCreateOrUpdateCreateRequest(ctx, resourceGroupName, resourceName, replicaName, sharedPrivateLinkResourceName, parameters, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// sharedPrivateLinkResourcesCreateOrUpdateCreateRequest creates the SharedPrivateLinkResourcesCreateOrUpdate request. +func (client *ReplicaClient) sharedPrivateLinkResourcesCreateOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, parameters SharedPrivateLinkResource, options *ReplicaClientBeginSharedPrivateLinkResourcesCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil +} + +// SharedPrivateLinkResourcesGet - Get the specified shared private link resource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - sharedPrivateLinkResourceName - The name of the shared private link resource +// - options - ReplicaClientSharedPrivateLinkResourcesGetOptions contains the optional parameters for the ReplicaClient.SharedPrivateLinkResourcesGet +// method. +func (client *ReplicaClient) SharedPrivateLinkResourcesGet(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, options *ReplicaClientSharedPrivateLinkResourcesGetOptions) (ReplicaClientSharedPrivateLinkResourcesGetResponse, error) { + var err error + const operationName = "ReplicaClient.SharedPrivateLinkResourcesGet" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.sharedPrivateLinkResourcesGetCreateRequest(ctx, resourceGroupName, resourceName, replicaName, sharedPrivateLinkResourceName, options) + if err != nil { + return ReplicaClientSharedPrivateLinkResourcesGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ReplicaClientSharedPrivateLinkResourcesGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ReplicaClientSharedPrivateLinkResourcesGetResponse{}, err + } + resp, err := client.sharedPrivateLinkResourcesGetHandleResponse(httpResp) + return resp, err +} + +// sharedPrivateLinkResourcesGetCreateRequest creates the SharedPrivateLinkResourcesGet request. +func (client *ReplicaClient) sharedPrivateLinkResourcesGetCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, sharedPrivateLinkResourceName string, options *ReplicaClientSharedPrivateLinkResourcesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// sharedPrivateLinkResourcesGetHandleResponse handles the SharedPrivateLinkResourcesGet response. +func (client *ReplicaClient) sharedPrivateLinkResourcesGetHandleResponse(resp *http.Response) (ReplicaClientSharedPrivateLinkResourcesGetResponse, error) { + result := ReplicaClientSharedPrivateLinkResourcesGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResource); err != nil { + return ReplicaClientSharedPrivateLinkResourcesGetResponse{}, err + } + return result, nil +} + +// NewSharedPrivateLinkResourcesListPager - List shared private link resources +// +// Generated from API version 2024-01-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceName - The name of the resource. +// - replicaName - The name of the replica. +// - options - ReplicaClientSharedPrivateLinkResourcesListOptions contains the optional parameters for the ReplicaClient.NewSharedPrivateLinkResourcesListPager +// method. +func (client *ReplicaClient) NewSharedPrivateLinkResourcesListPager(resourceGroupName string, resourceName string, replicaName string, options *ReplicaClientSharedPrivateLinkResourcesListOptions) *runtime.Pager[ReplicaClientSharedPrivateLinkResourcesListResponse] { + return runtime.NewPager(runtime.PagingHandler[ReplicaClientSharedPrivateLinkResourcesListResponse]{ + More: func(page ReplicaClientSharedPrivateLinkResourcesListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ReplicaClientSharedPrivateLinkResourcesListResponse) (ReplicaClientSharedPrivateLinkResourcesListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ReplicaClient.NewSharedPrivateLinkResourcesListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.sharedPrivateLinkResourcesListCreateRequest(ctx, resourceGroupName, resourceName, replicaName, options) + }, nil) + if err != nil { + return ReplicaClientSharedPrivateLinkResourcesListResponse{}, err + } + return client.sharedPrivateLinkResourcesListHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// sharedPrivateLinkResourcesListCreateRequest creates the SharedPrivateLinkResourcesList request. +func (client *ReplicaClient) sharedPrivateLinkResourcesListCreateRequest(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicaClientSharedPrivateLinkResourcesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/webPubSub/{resourceName}/replicas/{replicaName}/sharedPrivateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if resourceName == "" { + return nil, errors.New("parameter resourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) + if replicaName == "" { + return nil, errors.New("parameter replicaName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{replicaName}", url.PathEscape(replicaName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// sharedPrivateLinkResourcesListHandleResponse handles the SharedPrivateLinkResourcesList response. +func (client *ReplicaClient) sharedPrivateLinkResourcesListHandleResponse(resp *http.Response) (ReplicaClientSharedPrivateLinkResourcesListResponse, error) { + result := ReplicaClientSharedPrivateLinkResourcesListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResourceList); err != nil { + return ReplicaClientSharedPrivateLinkResourcesListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go index 814fc9094237..702a6f9b6f9b 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -74,7 +74,7 @@ func (client *ReplicasClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create or update a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *ReplicasClient) createOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,7 +132,7 @@ func (client *ReplicasClient) createOrUpdateCreateRequest(ctx context.Context, r // Delete - Operation to delete a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -182,7 +182,7 @@ func (client *ReplicasClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -242,7 +242,7 @@ func (client *ReplicasClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -259,7 +259,7 @@ func (client *ReplicasClient) getHandleResponse(resp *http.Response) (ReplicasCl // NewListPager - List all replicas belong to this resource // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - ReplicasClientListOptions contains the optional parameters for the ReplicasClient.NewListPager method. @@ -306,7 +306,7 @@ func (client *ReplicasClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -324,7 +324,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -350,7 +350,7 @@ func (client *ReplicasClient) BeginRestart(ctx context.Context, resourceGroupNam // Restart - Operation to restart a replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *ReplicasClient) restart(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, options *ReplicasClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginRestart" @@ -396,7 +396,7 @@ func (client *ReplicasClient) restartCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -405,7 +405,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-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - replicaName - The name of the replica. @@ -432,7 +432,7 @@ func (client *ReplicasClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Operation to update an exiting replica. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview func (client *ReplicasClient) update(ctx context.Context, resourceGroupName string, resourceName string, replicaName string, parameters Replica, options *ReplicasClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ReplicasClient.BeginUpdate" @@ -478,7 +478,7 @@ func (client *ReplicasClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != 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 946baebb13bd..000000000000 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/replicas_client_example_test.go +++ /dev/null @@ -1,291 +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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-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:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-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:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-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{ - ResourceStopped: 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.Replica = armwebpubsub.Replica{ - // Name: to.Ptr("myWebPubSubService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-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{ - ResourceStopped: 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.Replica = armwebpubsub.Replica{ - // Name: to.Ptr("myWebPubSubService-eastus"), - // Type: to.Ptr("Microsoft.SignalRService/WebPubSub"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/WebPubSub/myWebPubSubService/replicas/myWebPubSubService-eastus"), - // SystemData: &armwebpubsub.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // CreatedBy: to.Ptr("string"), - // CreatedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-02-03T04:05:06.000Z"); return t}()), - // LastModifiedBy: to.Ptr("string"), - // LastModifiedByType: to.Ptr(armwebpubsub.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armwebpubsub.ReplicaProperties{ - // ProvisioningState: to.Ptr(armwebpubsub.ProvisioningStateSucceeded), - // RegionEndpointEnabled: to.Ptr("Enabled"), - // ResourceStopped: to.Ptr("false"), - // }, - // SKU: &armwebpubsub.ResourceSKU{ - // Name: to.Ptr("Premium_P1"), - // Capacity: to.Ptr[int32](1), - // Size: to.Ptr("P1"), - // Tier: to.Ptr(armwebpubsub.WebPubSubSKUTierPremium), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-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/responses.go similarity index 91% rename from sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go rename to sdk/resourcemanager/webpubsub/armwebpubsub/responses.go index 349cd83b310b..3a81f4376f52 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/response_types.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/responses.go @@ -182,6 +182,24 @@ type PrivateLinkResourcesClientListResponse struct { PrivateLinkResourceList } +// ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse contains the response from method ReplicaClient.BeginSharedPrivateLinkResourcesCreateOrUpdate. +type ReplicaClientSharedPrivateLinkResourcesCreateOrUpdateResponse struct { + // Describes a Shared Private Link Resource + SharedPrivateLinkResource +} + +// ReplicaClientSharedPrivateLinkResourcesGetResponse contains the response from method ReplicaClient.SharedPrivateLinkResourcesGet. +type ReplicaClientSharedPrivateLinkResourcesGetResponse struct { + // Describes a Shared Private Link Resource + SharedPrivateLinkResource +} + +// ReplicaClientSharedPrivateLinkResourcesListResponse contains the response from method ReplicaClient.NewSharedPrivateLinkResourcesListPager. +type ReplicaClientSharedPrivateLinkResourcesListResponse struct { + // A list of shared private link resources + SharedPrivateLinkResourceList +} + // ReplicasClientCreateOrUpdateResponse contains the response from method ReplicasClient.BeginCreateOrUpdate. type ReplicasClientCreateOrUpdateResponse struct { // A class represent a replica resource. diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go index b0bdf2eefe0a..8c78c22e45ff 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client.go @@ -46,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-08-01-preview +// Generated from API version 2024-01-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. @@ -74,7 +74,7 @@ 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-08-01-preview +// Generated from API version 2024-01-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 const operationName = "SharedPrivateLinkResourcesClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,7 +132,7 @@ func (client *SharedPrivateLinkResourcesClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete the specified shared private link resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-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. @@ -159,7 +159,7 @@ 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-08-01-preview +// Generated from API version 2024-01-01-preview func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, sharedPrivateLinkResourceName string, resourceGroupName string, resourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "SharedPrivateLinkResourcesClient.BeginDelete" @@ -205,7 +205,7 @@ func (client *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +214,7 @@ 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-08-01-preview +// Generated from API version 2024-01-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. @@ -266,7 +266,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +283,7 @@ func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Res // NewListPager - List shared private link resources // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - resourceName - The name of the resource. // - options - SharedPrivateLinkResourcesClientListOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListPager @@ -331,7 +331,7 @@ func (client *SharedPrivateLinkResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/sharedprivatelinkresources_client_example_test.go deleted file mode 100644 index 971feb70880b..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_List.json -func ExampleSharedPrivateLinkResourcesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_Get.json -func ExampleSharedPrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_CreateOrUpdate.json -func ExampleSharedPrivateLinkResourcesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/WebPubSubSharedPrivateLinkResources_Delete.json -func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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 3798d3585c99..bc2cc7e4f9e3 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go index be44390702f8..9be787f6ca65 100644 --- a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go +++ b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client.go @@ -45,7 +45,7 @@ func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, o // NewListPager - List resource usage quotas by location. // -// Generated from API version 2023-08-01-preview +// Generated from API version 2024-01-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] { @@ -87,7 +87,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01-preview") + reqQP.Set("api-version", "2024-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go b/sdk/resourcemanager/webpubsub/armwebpubsub/usages_client_example_test.go deleted file mode 100644 index 718c679e51d2..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/9ec0fcc278aa2128c4fbb2b8a1aa93432d72cce0/specification/webpubsub/resource-manager/Microsoft.SignalRService/preview/2023-08-01-preview/examples/Usages_List.json -func ExampleUsagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - 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"), - // }}, - // } - } -}