From a5b94d66f70420d11cafffedf989f827076e9e35 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 3 Oct 2023 06:43:41 +0000 Subject: [PATCH] CodeGen from PR 26028 in Azure/azure-rest-api-specs Merge b3bfebcfd2fac5d6d14d2bd83b33b87d27bdff37 into c67016198d67ef0d833f12fe867b1adbad513315 --- .../armredisenterprise/CHANGELOG.md | 44 ++ .../armredisenterprise/autorest.md | 6 +- .../armredisenterprise/client.go | 137 ++++-- .../armredisenterprise/client_example_test.go | 318 ------------ .../armredisenterprise/client_factory.go | 24 +- .../armredisenterprise/constants.go | 72 ++- .../armredisenterprise/databases_client.go | 280 ++++++++--- .../databases_client_example_test.go | 462 ------------------ .../redisenterprise/armredisenterprise/go.mod | 22 +- .../redisenterprise/armredisenterprise/go.sum | 38 +- .../armredisenterprise/models.go | 289 ++++++----- .../armredisenterprise/models_serde.go | 458 ++++++++++++++++- .../armredisenterprise/operations_client.go | 7 +- .../operations_client_example_test.go | 64 --- .../operationsstatus_client.go | 22 +- .../operationsstatus_client_example_test.go | 45 -- .../armredisenterprise/options.go | 157 ++++++ .../privateendpointconnections_client.go | 91 ++-- ...endpointconnections_client_example_test.go | 160 ------ .../privatelinkresources_client.go | 7 +- ...rivatelinkresources_client_example_test.go | 58 --- .../armredisenterprise/response_types.go | 38 +- .../armredisenterprise/skus_client.go | 102 ++++ .../armredisenterprise/time_rfc3339.go | 86 ++++ 24 files changed, 1523 insertions(+), 1464 deletions(-) delete mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/client_example_test.go delete mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client_example_test.go delete mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client_example_test.go create mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/options.go delete mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client_example_test.go delete mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client_example_test.go create mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/skus_client.go create mode 100644 sdk/resourcemanager/redisenterprise/armredisenterprise/time_rfc3339.go diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/CHANGELOG.md b/sdk/resourcemanager/redisenterprise/armredisenterprise/CHANGELOG.md index 016ad5c0ffff..409391a73f53 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/CHANGELOG.md +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/CHANGELOG.md @@ -1,5 +1,49 @@ # Release History +## 2.0.0-beta.1 (2023-10-03) +### Breaking Changes + +- Operation `*PrivateEndpointConnectionsClient.Delete` has been changed to LRO, use `*PrivateEndpointConnectionsClient.BeginDelete` instead. + +### Features Added + +- New value `ResourceStateScaling`, `ResourceStateScalingFailed` added to enum type `ResourceState` +- New value `SKUNameEnterpriseE200`, `SKUNameEnterpriseE400`, `SKUNameEnterpriseE5` added to enum type `SKUName` +- New enum type `CmkIdentityType` with values `CmkIdentityTypeSystemAssignedIdentity`, `CmkIdentityTypeUserAssignedIdentity` +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New function `*Client.CheckNameAvailability(context.Context, CheckNameAvailabilityParameters, *ClientCheckNameAvailabilityOptions) (ClientCheckNameAvailabilityResponse, error)` +- New function `*ClientFactory.NewSKUsClient() *SKUsClient` +- New function `*DatabasesClient.BeginFlush(context.Context, string, string, string, FlushParameters, *DatabasesClientBeginFlushOptions) (*runtime.Poller[DatabasesClientFlushResponse], error)` +- New function `NewSKUsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SKUsClient, error)` +- New function `*SKUsClient.NewListPager(string, *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse]` +- New function `timeRFC3339.MarshalText() ([]byte, error)` +- New function `*timeRFC3339.Parse(string) error` +- New function `*timeRFC3339.UnmarshalText([]byte) error` +- New struct `Capability` +- New struct `CheckNameAvailabilityParameters` +- New struct `ClusterPropertiesEncryption` +- New struct `ClusterPropertiesEncryptionCustomerManagedKeyEncryption` +- New struct `ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity` +- New struct `FlushParameters` +- New struct `LocationInfo` +- New struct `ManagedServiceIdentity` +- New struct `RegionSKUDetail` +- New struct `RegionSKUDetails` +- New struct `SKUDetail` +- New struct `SystemData` +- New struct `UserAssignedIdentity` +- New field `Identity`, `SystemData` in struct `Cluster` +- New field `Encryption` in struct `ClusterProperties` +- New field `Identity` in struct `ClusterUpdate` +- New field `SystemData` in struct `Database` +- New field `SystemData` in struct `PrivateEndpointConnection` +- New field `SystemData` in struct `PrivateLinkResource` +- New field `SystemData` in struct `ProxyResource` +- New field `SystemData` in struct `Resource` +- New field `SystemData` in struct `TrackedResource` + + ## 1.1.1 (2023-04-14) ### Bug Fixes diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/autorest.md b/sdk/resourcemanager/redisenterprise/armredisenterprise/autorest.md index 036ff36fc832..0c31df154a81 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/autorest.md +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/redisenterprise/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/redisenterprise/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.1 +module-version: 2.0.0-beta.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/client.go index 85854c24fb20..c3b8b6aa538b 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise @@ -44,10 +43,54 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options return client, nil } +// CheckNameAvailability - Checks that the Redis Enterprise cache name is valid and is not already in use. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - parameters - Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redisenterprise' +// - options - ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. +func (client *Client) CheckNameAvailability(ctx context.Context, parameters CheckNameAvailabilityParameters, options *ClientCheckNameAvailabilityOptions) (ClientCheckNameAvailabilityResponse, error) { + var err error + req, err := client.checkNameAvailabilityCreateRequest(ctx, parameters, options) + if err != nil { + return ClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ClientCheckNameAvailabilityResponse{}, err + } + return ClientCheckNameAvailabilityResponse{}, nil +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *Client) checkNameAvailabilityCreateRequest(ctx context.Context, parameters CheckNameAvailabilityParameters, options *ClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-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 +} + // BeginCreate - Creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - parameters - Parameters supplied to the Create RedisEnterprise operation. @@ -58,9 +101,10 @@ func (client *Client) BeginCreate(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaOriginalURI, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -69,20 +113,22 @@ func (client *Client) BeginCreate(ctx context.Context, resourceGroupName string, // Create - Creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *Client) create(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -105,16 +151,19 @@ func (client *Client) createCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a RedisEnterprise cache cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - options - ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. @@ -124,9 +173,10 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -135,20 +185,22 @@ func (client *Client) BeginDelete(ctx context.Context, resourceGroupName string, // Delete - Deletes a RedisEnterprise cache cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -171,7 +223,7 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,23 +232,26 @@ func (client *Client) deleteCreateRequest(ctx context.Context, resourceGroupName // Get - Gets information about a RedisEnterprise cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - options - ClientGetOptions contains the optional parameters for the Client.Get method. func (client *Client) Get(ctx context.Context, resourceGroupName string, clusterName string, options *ClientGetOptions) (ClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return ClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return ClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -219,7 +274,7 @@ func (client *Client) getCreateRequest(ctx context.Context, resourceGroupName st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +291,7 @@ func (client *Client) getHandleResponse(resp *http.Response) (ClientGetResponse, // NewListPager - Gets all RedisEnterprise clusters in the specified subscription. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - options - ClientListOptions contains the optional parameters for the Client.NewListPager method. func (client *Client) NewListPager(options *ClientListOptions) *runtime.Pager[ClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ClientListResponse]{ @@ -278,7 +333,7 @@ func (client *Client) listCreateRequest(ctx context.Context, options *ClientList return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +350,7 @@ func (client *Client) listHandleResponse(resp *http.Response) (ClientListRespons // NewListByResourceGroupPager - Lists all RedisEnterprise clusters in a resource group. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-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. @@ -343,7 +398,7 @@ func (client *Client) listByResourceGroupCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -361,7 +416,7 @@ func (client *Client) listByResourceGroupHandleResponse(resp *http.Response) (Cl // BeginUpdate - Updates an existing RedisEnterprise cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - parameters - Parameters supplied to the Update RedisEnterprise operation. @@ -372,9 +427,10 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[ClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -383,20 +439,22 @@ func (client *Client) BeginUpdate(ctx context.Context, resourceGroupName string, // Update - Updates an existing RedisEnterprise cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *ClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -419,8 +477,11 @@ func (client *Client) updateCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/client_example_test.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/client_example_test.go deleted file mode 100644 index fa4911e3bf66..000000000000 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/client_example_test.go +++ /dev/null @@ -1,318 +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 armredisenterprise_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/redisenterprise/armredisenterprise" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseCreate.json -func ExampleClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginCreate(ctx, "rg1", "cache1", armredisenterprise.Cluster{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - Properties: &armredisenterprise.ClusterProperties{ - MinimumTLSVersion: to.Ptr(armredisenterprise.TLSVersionOne2), - }, - SKU: &armredisenterprise.SKU{ - Name: to.Ptr(armredisenterprise.SKUNameEnterpriseFlashF300), - Capacity: to.Ptr[int32](3), - }, - Zones: []*string{ - to.Ptr("1"), - to.Ptr("2"), - to.Ptr("3")}, - }, 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.Cluster = armredisenterprise.Cluster{ - // Name: to.Ptr("cache1"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // }, - // Properties: &armredisenterprise.ClusterProperties{ - // HostName: to.Ptr("cache1.westus.something.azure.net"), - // MinimumTLSVersion: to.Ptr(armredisenterprise.TLSVersionOne2), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // RedisVersion: to.Ptr("5"), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateRunning), - // }, - // SKU: &armredisenterprise.SKU{ - // Name: to.Ptr(armredisenterprise.SKUNameEnterpriseFlashF300), - // Capacity: to.Ptr[int32](3), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseUpdate.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 := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginUpdate(ctx, "rg1", "cache1", armredisenterprise.ClusterUpdate{ - Properties: &armredisenterprise.ClusterProperties{ - MinimumTLSVersion: to.Ptr(armredisenterprise.TLSVersionOne2), - }, - SKU: &armredisenterprise.SKU{ - Name: to.Ptr(armredisenterprise.SKUNameEnterpriseFlashF300), - Capacity: to.Ptr[int32](9), - }, - Tags: map[string]*string{ - "tag1": to.Ptr("value1"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Cluster = armredisenterprise.Cluster{ - // Name: to.Ptr("cache1"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("value1"), - // }, - // Properties: &armredisenterprise.ClusterProperties{ - // HostName: to.Ptr("cache1.westus.something.azure.com"), - // MinimumTLSVersion: to.Ptr(armredisenterprise.TLSVersionOne2), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // RedisVersion: to.Ptr("5"), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateUpdating), - // }, - // SKU: &armredisenterprise.SKU{ - // Name: to.Ptr(armredisenterprise.SKUNameEnterpriseFlashF300), - // Capacity: to.Ptr[int32](9), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDelete.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 := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClient().BeginDelete(ctx, "rg1", "cache1", 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseGet.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 := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClient().Get(ctx, "rg1", "cache1", 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.Cluster = armredisenterprise.Cluster{ - // Name: to.Ptr("cache1"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armredisenterprise.ClusterProperties{ - // HostName: to.Ptr("cache1.westus.something.azure.com"), - // MinimumTLSVersion: to.Ptr(armredisenterprise.TLSVersionOne2), - // PrivateEndpointConnections: []*armredisenterprise.PrivateEndpointConnection{ - // { - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/privateEndpointConnections/cachePec"), - // Properties: &armredisenterprise.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armredisenterprise.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/cachePe"), - // }, - // PrivateLinkServiceConnectionState: &armredisenterprise.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my connection"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armredisenterprise.PrivateEndpointServiceConnectionStatusApproved), - // }, - // }, - // }}, - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // RedisVersion: to.Ptr("6"), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateRunning), - // }, - // SKU: &armredisenterprise.SKU{ - // Name: to.Ptr(armredisenterprise.SKUNameEnterpriseFlashF300), - // Capacity: to.Ptr[int32](3), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseListByResourceGroup.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 := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().NewListByResourceGroupPager("rg1", 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.ClusterList = armredisenterprise.ClusterList{ - // Value: []*armredisenterprise.Cluster{ - // { - // Name: to.Ptr("cache1"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armredisenterprise.ClusterProperties{ - // HostName: to.Ptr("cache1.westus.something.azure.com"), - // MinimumTLSVersion: to.Ptr(armredisenterprise.TLSVersionOne2), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // RedisVersion: to.Ptr("5"), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateRunning), - // }, - // SKU: &armredisenterprise.SKU{ - // Name: to.Ptr(armredisenterprise.SKUNameEnterpriseFlashF300), - // Capacity: to.Ptr[int32](3), - // }, - // Zones: []*string{ - // to.Ptr("1"), - // to.Ptr("2"), - // to.Ptr("3")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseList.json -func ExampleClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClient().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.ClusterList = armredisenterprise.ClusterList{ - // Value: []*armredisenterprise.Cluster{ - // { - // Name: to.Ptr("cache1"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // }, - // Properties: &armredisenterprise.ClusterProperties{ - // HostName: to.Ptr("cache1.westus.something.azure.com"), - // MinimumTLSVersion: to.Ptr(armredisenterprise.TLSVersionOne2), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // RedisVersion: to.Ptr("6"), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateRunning), - // }, - // SKU: &armredisenterprise.SKU{ - // Name: to.Ptr(armredisenterprise.SKUNameEnterpriseFlashF300), - // Capacity: to.Ptr[int32](3), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/client_factory.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/client_factory.go index 772ae663657a..fbc5231c79b1 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/client_factory.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/client_factory.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise @@ -38,23 +37,23 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewClient() *Client { + subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewOperationsStatusClient() *OperationsStatusClient { - subClient, _ := NewOperationsStatusClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { + subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) return subClient } -func (c *ClientFactory) NewClient() *Client { - subClient, _ := NewClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } -func (c *ClientFactory) NewDatabasesClient() *DatabasesClient { - subClient, _ := NewDatabasesClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsStatusClient() *OperationsStatusClient { + subClient, _ := NewOperationsStatusClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -67,3 +66,8 @@ func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesCli subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) return subClient } + +func (c *ClientFactory) NewSKUsClient() *SKUsClient { + subClient, _ := NewSKUsClient(c.subscriptionID, c.credential, c.options) + return subClient +} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/constants.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/constants.go index fd5e276e6e62..57dc53f56b26 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/constants.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/constants.go @@ -3,15 +3,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise const ( moduleName = "armredisenterprise" - moduleVersion = "v1.1.1" + moduleVersion = "v2.0.0-beta.1" ) // AccessKeyType - Which access key to regenerate. @@ -76,6 +75,42 @@ func PossibleClusteringPolicyValues() []ClusteringPolicy { } } +// CmkIdentityType - Only userAssignedIdentity is supported in this API version; other types may be supported in the future +type CmkIdentityType string + +const ( + CmkIdentityTypeSystemAssignedIdentity CmkIdentityType = "systemAssignedIdentity" + CmkIdentityTypeUserAssignedIdentity CmkIdentityType = "userAssignedIdentity" +) + +// PossibleCmkIdentityTypeValues returns the possible values for the CmkIdentityType const type. +func PossibleCmkIdentityTypeValues() []CmkIdentityType { + return []CmkIdentityType{ + CmkIdentityTypeSystemAssignedIdentity, + CmkIdentityTypeUserAssignedIdentity, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + // EvictionPolicy - Redis eviction policy - default is VolatileLRU type EvictionPolicy string @@ -126,6 +161,26 @@ func PossibleLinkStateValues() []LinkState { } } +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + // Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" type Origin string @@ -255,6 +310,8 @@ const ( ResourceStateEnableFailed ResourceState = "EnableFailed" ResourceStateEnabling ResourceState = "Enabling" ResourceStateRunning ResourceState = "Running" + ResourceStateScaling ResourceState = "Scaling" + ResourceStateScalingFailed ResourceState = "ScalingFailed" ResourceStateUpdateFailed ResourceState = "UpdateFailed" ResourceStateUpdating ResourceState = "Updating" ) @@ -272,18 +329,22 @@ func PossibleResourceStateValues() []ResourceState { ResourceStateEnableFailed, ResourceStateEnabling, ResourceStateRunning, + ResourceStateScaling, + ResourceStateScalingFailed, ResourceStateUpdateFailed, ResourceStateUpdating, } } -// SKUName - The type of RedisEnterprise cluster to deploy. Possible values: (EnterpriseE10, EnterpriseFlashF300 etc.) type SKUName string const ( SKUNameEnterpriseE10 SKUName = "Enterprise_E10" SKUNameEnterpriseE100 SKUName = "Enterprise_E100" SKUNameEnterpriseE20 SKUName = "Enterprise_E20" + SKUNameEnterpriseE200 SKUName = "Enterprise_E200" + SKUNameEnterpriseE400 SKUName = "Enterprise_E400" + SKUNameEnterpriseE5 SKUName = "Enterprise_E5" SKUNameEnterpriseE50 SKUName = "Enterprise_E50" SKUNameEnterpriseFlashF1500 SKUName = "EnterpriseFlash_F1500" SKUNameEnterpriseFlashF300 SKUName = "EnterpriseFlash_F300" @@ -296,6 +357,9 @@ func PossibleSKUNameValues() []SKUName { SKUNameEnterpriseE10, SKUNameEnterpriseE100, SKUNameEnterpriseE20, + SKUNameEnterpriseE200, + SKUNameEnterpriseE400, + SKUNameEnterpriseE5, SKUNameEnterpriseE50, SKUNameEnterpriseFlashF1500, SKUNameEnterpriseFlashF300, diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client.go index 506266859c64..196dba29b8cc 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise @@ -47,7 +46,7 @@ func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreate - Creates a database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. @@ -59,9 +58,10 @@ func (client *DatabasesClient) BeginCreate(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaOriginalURI, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *DatabasesClient) BeginCreate(ctx context.Context, resourceGroupNam // Create - Creates a database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *DatabasesClient) create(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -110,16 +112,19 @@ func (client *DatabasesClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Deletes a single database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. @@ -130,9 +135,10 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -141,20 +147,22 @@ func (client *DatabasesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Deletes a single database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -181,7 +189,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,7 +198,7 @@ func (client *DatabasesClient) deleteCreateRequest(ctx context.Context, resource // BeginExport - Exports a database file from target database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. @@ -202,9 +210,10 @@ func (client *DatabasesClient) BeginExport(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientExportResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientExportResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientExportResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -213,20 +222,22 @@ func (client *DatabasesClient) BeginExport(ctx context.Context, resourceGroupNam // Export - Exports a database file from target database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *DatabasesClient) export(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ExportClusterParameters, options *DatabasesClientBeginExportOptions) (*http.Response, error) { + var err error req, err := client.exportCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // exportCreateRequest creates the Export request. @@ -253,16 +264,97 @@ func (client *DatabasesClient) exportCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-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 +} + +// BeginFlush - Flushes all the keys in this database and also from its linked databases. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - clusterName - The name of the RedisEnterprise cluster. +// - databaseName - The name of the database. +// - parameters - Information identifying the databases to be flushed +// - options - DatabasesClientBeginFlushOptions contains the optional parameters for the DatabasesClient.BeginFlush method. +func (client *DatabasesClient) BeginFlush(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters FlushParameters, options *DatabasesClientBeginFlushOptions) (*runtime.Poller[DatabasesClientFlushResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.flush(ctx, resourceGroupName, clusterName, databaseName, parameters, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientFlushResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[DatabasesClientFlushResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Flush - Flushes all the keys in this database and also from its linked databases. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *DatabasesClient) flush(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters FlushParameters, options *DatabasesClientBeginFlushOptions) (*http.Response, error) { + var err error + req, err := client.flushCreateRequest(ctx, resourceGroupName, clusterName, databaseName, 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.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// flushCreateRequest creates the Flush request. +func (client *DatabasesClient) flushCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters FlushParameters, options *DatabasesClientBeginFlushOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/flush" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginForceUnlink - Forcibly removes the link to the specified database resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. @@ -275,9 +367,10 @@ func (client *DatabasesClient) BeginForceUnlink(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientForceUnlinkResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientForceUnlinkResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientForceUnlinkResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -286,20 +379,22 @@ func (client *DatabasesClient) BeginForceUnlink(ctx context.Context, resourceGro // ForceUnlink - Forcibly removes the link to the specified database resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *DatabasesClient) forceUnlink(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ForceUnlinkParameters, options *DatabasesClientBeginForceUnlinkOptions) (*http.Response, error) { + var err error req, err := client.forceUnlinkCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // forceUnlinkCreateRequest creates the ForceUnlink request. @@ -326,33 +421,39 @@ func (client *DatabasesClient) forceUnlinkCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // Get - Gets information about a database in a RedisEnterprise cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. // - options - DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. func (client *DatabasesClient) Get(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientGetOptions) (DatabasesClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) if err != nil { return DatabasesClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -379,7 +480,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -397,7 +498,7 @@ func (client *DatabasesClient) getHandleResponse(resp *http.Response) (Databases // BeginImport - Imports database files to target database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. @@ -409,9 +510,10 @@ func (client *DatabasesClient) BeginImport(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientImportResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientImportResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientImportResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -420,20 +522,22 @@ func (client *DatabasesClient) BeginImport(ctx context.Context, resourceGroupNam // Import - Imports database files to target database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *DatabasesClient) importOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ImportClusterParameters, options *DatabasesClientBeginImportOptions) (*http.Response, error) { + var err error req, err := client.importCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // importCreateRequest creates the Import request. @@ -460,15 +564,18 @@ func (client *DatabasesClient) importCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // NewListByClusterPager - Gets all databases in the specified RedisEnterprise cluster. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - options - DatabasesClientListByClusterOptions contains the optional parameters for the DatabasesClient.NewListByClusterPager @@ -521,7 +628,7 @@ func (client *DatabasesClient) listByClusterCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -539,24 +646,27 @@ func (client *DatabasesClient) listByClusterHandleResponse(resp *http.Response) // ListKeys - Retrieves the access keys for the RedisEnterprise database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. // - options - DatabasesClientListKeysOptions contains the optional parameters for the DatabasesClient.ListKeys method. func (client *DatabasesClient) ListKeys(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientListKeysOptions) (DatabasesClientListKeysResponse, error) { + var err error req, err := client.listKeysCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) if err != nil { return DatabasesClientListKeysResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return DatabasesClientListKeysResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DatabasesClientListKeysResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DatabasesClientListKeysResponse{}, err } - return client.listKeysHandleResponse(resp) + resp, err := client.listKeysHandleResponse(httpResp) + return resp, err } // listKeysCreateRequest creates the ListKeys request. @@ -583,7 +693,7 @@ func (client *DatabasesClient) listKeysCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -601,7 +711,7 @@ func (client *DatabasesClient) listKeysHandleResponse(resp *http.Response) (Data // BeginRegenerateKey - Regenerates the RedisEnterprise database's access keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. @@ -614,9 +724,10 @@ func (client *DatabasesClient) BeginRegenerateKey(ctx context.Context, resourceG if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientRegenerateKeyResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientRegenerateKeyResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -625,20 +736,22 @@ func (client *DatabasesClient) BeginRegenerateKey(ctx context.Context, resourceG // RegenerateKey - Regenerates the RedisEnterprise database's access keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *DatabasesClient) regenerateKey(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters RegenerateKeyParameters, options *DatabasesClientBeginRegenerateKeyOptions) (*http.Response, error) { + var err error req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // regenerateKeyCreateRequest creates the RegenerateKey request. @@ -665,16 +778,19 @@ func (client *DatabasesClient) regenerateKeyCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } // BeginUpdate - Updates a database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - databaseName - The name of the database. @@ -686,9 +802,10 @@ func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[DatabasesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -697,20 +814,22 @@ func (client *DatabasesClient) BeginUpdate(ctx context.Context, resourceGroupNam // Update - Updates a database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *DatabasesClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate, options *DatabasesClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // updateCreateRequest creates the Update request. @@ -737,8 +856,11 @@ func (client *DatabasesClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, parameters) + if err := runtime.MarshalAsJSON(req, parameters); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client_example_test.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client_example_test.go deleted file mode 100644 index 3af64f1181f4..000000000000 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client_example_test.go +++ /dev/null @@ -1,462 +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 armredisenterprise_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/redisenterprise/armredisenterprise" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesListByCluster.json -func ExampleDatabasesClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatabasesClient().NewListByClusterPager("rg1", "cache1", 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.DatabaseList = armredisenterprise.DatabaseList{ - // Value: []*armredisenterprise.Database{ - // { - // Name: to.Ptr("cache1/default"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/databases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"), - // Properties: &armredisenterprise.DatabaseProperties{ - // ClientProtocol: to.Ptr(armredisenterprise.ProtocolEncrypted), - // ClusteringPolicy: to.Ptr(armredisenterprise.ClusteringPolicyOSSCluster), - // EvictionPolicy: to.Ptr(armredisenterprise.EvictionPolicyAllKeysLRU), - // Modules: []*armredisenterprise.Module{ - // { - // Name: to.Ptr("RediSearch"), - // Args: to.Ptr(""), - // Version: to.Ptr("1.0.0"), - // }}, - // Persistence: &armredisenterprise.Persistence{ - // RdbEnabled: to.Ptr(true), - // RdbFrequency: to.Ptr(armredisenterprise.RdbFrequencyTwelveH), - // }, - // Port: to.Ptr[int32](10000), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateRunning), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesCreate.json -func ExampleDatabasesClient_BeginCreate_redisEnterpriseDatabasesCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreate(ctx, "rg1", "cache1", "default", armredisenterprise.Database{ - Properties: &armredisenterprise.DatabaseProperties{ - ClientProtocol: to.Ptr(armredisenterprise.ProtocolEncrypted), - ClusteringPolicy: to.Ptr(armredisenterprise.ClusteringPolicyEnterpriseCluster), - EvictionPolicy: to.Ptr(armredisenterprise.EvictionPolicyAllKeysLRU), - Modules: []*armredisenterprise.Module{ - { - Name: to.Ptr("RedisBloom"), - Args: to.Ptr("ERROR_RATE 0.00 INITIAL_SIZE 400"), - }, - { - Name: to.Ptr("RedisTimeSeries"), - Args: to.Ptr("RETENTION_POLICY 20"), - }, - { - Name: to.Ptr("RediSearch"), - }}, - Persistence: &armredisenterprise.Persistence{ - AofEnabled: to.Ptr(true), - AofFrequency: to.Ptr(armredisenterprise.AofFrequencyOneS), - }, - Port: to.Ptr[int32](10000), - }, - }, 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.Database = armredisenterprise.Database{ - // Name: to.Ptr("cache1/default"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/databases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"), - // Properties: &armredisenterprise.DatabaseProperties{ - // ClientProtocol: to.Ptr(armredisenterprise.ProtocolEncrypted), - // ClusteringPolicy: to.Ptr(armredisenterprise.ClusteringPolicyEnterpriseCluster), - // EvictionPolicy: to.Ptr(armredisenterprise.EvictionPolicyAllKeysLRU), - // Modules: []*armredisenterprise.Module{ - // { - // Name: to.Ptr("RedisBloom"), - // Args: to.Ptr("ERROR_RATE 0.00 INITIAL_SIZE 400"), - // Version: to.Ptr("1.0.0"), - // }, - // { - // Name: to.Ptr("RedisTimeSeries"), - // Args: to.Ptr("RETENTION_POLICY 20"), - // Version: to.Ptr("1.0.0"), - // }, - // { - // Name: to.Ptr("RediSearch"), - // Args: to.Ptr(""), - // Version: to.Ptr("1.0.0"), - // }}, - // Persistence: &armredisenterprise.Persistence{ - // AofEnabled: to.Ptr(true), - // AofFrequency: to.Ptr(armredisenterprise.AofFrequencyOneS), - // }, - // Port: to.Ptr[int32](10000), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateUpdating), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesCreateWithGeoReplication.json -func ExampleDatabasesClient_BeginCreate_redisEnterpriseDatabasesCreateWithActiveGeoReplication() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginCreate(ctx, "rg1", "cache1", "default", armredisenterprise.Database{ - Properties: &armredisenterprise.DatabaseProperties{ - ClientProtocol: to.Ptr(armredisenterprise.ProtocolEncrypted), - ClusteringPolicy: to.Ptr(armredisenterprise.ClusteringPolicyEnterpriseCluster), - EvictionPolicy: to.Ptr(armredisenterprise.EvictionPolicyNoEviction), - GeoReplication: &armredisenterprise.DatabasePropertiesGeoReplication{ - GroupNickname: to.Ptr("groupName"), - LinkedDatabases: []*armredisenterprise.LinkedDatabase{ - { - ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"), - }, - { - ID: to.Ptr("/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default"), - }}, - }, - Port: to.Ptr[int32](10000), - }, - }, 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.Database = armredisenterprise.Database{ - // Name: to.Ptr("cache1/default"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/databases"), - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"), - // Properties: &armredisenterprise.DatabaseProperties{ - // ClientProtocol: to.Ptr(armredisenterprise.ProtocolEncrypted), - // ClusteringPolicy: to.Ptr(armredisenterprise.ClusteringPolicyEnterpriseCluster), - // EvictionPolicy: to.Ptr(armredisenterprise.EvictionPolicyNoEviction), - // GeoReplication: &armredisenterprise.DatabasePropertiesGeoReplication{ - // GroupNickname: to.Ptr("groupName"), - // LinkedDatabases: []*armredisenterprise.LinkedDatabase{ - // { - // ID: to.Ptr("/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"), - // State: to.Ptr(armredisenterprise.LinkStateLinking), - // }, - // { - // ID: to.Ptr("/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default"), - // State: to.Ptr(armredisenterprise.LinkStateLinking), - // }}, - // }, - // Port: to.Ptr[int32](10000), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateUpdating), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesUpdate.json -func ExampleDatabasesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginUpdate(ctx, "rg1", "cache1", "default", armredisenterprise.DatabaseUpdate{ - Properties: &armredisenterprise.DatabaseProperties{ - ClientProtocol: to.Ptr(armredisenterprise.ProtocolEncrypted), - EvictionPolicy: to.Ptr(armredisenterprise.EvictionPolicyAllKeysLRU), - Persistence: &armredisenterprise.Persistence{ - RdbEnabled: to.Ptr(true), - RdbFrequency: to.Ptr(armredisenterprise.RdbFrequencyTwelveH), - }, - }, - }, 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.Database = armredisenterprise.Database{ - // Name: to.Ptr("cache1/default"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/databases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"), - // Properties: &armredisenterprise.DatabaseProperties{ - // ClientProtocol: to.Ptr(armredisenterprise.ProtocolEncrypted), - // ClusteringPolicy: to.Ptr(armredisenterprise.ClusteringPolicyOSSCluster), - // EvictionPolicy: to.Ptr(armredisenterprise.EvictionPolicyAllKeysLRU), - // Modules: []*armredisenterprise.Module{ - // { - // Name: to.Ptr("RediSearch"), - // Args: to.Ptr(""), - // Version: to.Ptr("1.0.0"), - // }}, - // Persistence: &armredisenterprise.Persistence{ - // RdbEnabled: to.Ptr(true), - // RdbFrequency: to.Ptr(armredisenterprise.RdbFrequencyTwelveH), - // }, - // Port: to.Ptr[int32](10000), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateUpdating), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesGet.json -func ExampleDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().Get(ctx, "rg1", "cache1", "default", 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.Database = armredisenterprise.Database{ - // Name: to.Ptr("cache1/default"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/databases"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default"), - // Properties: &armredisenterprise.DatabaseProperties{ - // ClientProtocol: to.Ptr(armredisenterprise.ProtocolEncrypted), - // ClusteringPolicy: to.Ptr(armredisenterprise.ClusteringPolicyOSSCluster), - // EvictionPolicy: to.Ptr(armredisenterprise.EvictionPolicyAllKeysLRU), - // Modules: []*armredisenterprise.Module{ - // { - // Name: to.Ptr("RediSearch"), - // Args: to.Ptr(""), - // Version: to.Ptr("1.0.0"), - // }}, - // Persistence: &armredisenterprise.Persistence{ - // RdbEnabled: to.Ptr(true), - // RdbFrequency: to.Ptr(armredisenterprise.RdbFrequencyTwelveH), - // }, - // Port: to.Ptr[int32](10000), - // ProvisioningState: to.Ptr(armredisenterprise.ProvisioningStateSucceeded), - // ResourceState: to.Ptr(armredisenterprise.ResourceStateRunning), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesDelete.json -func ExampleDatabasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginDelete(ctx, "rg1", "cache1", "db1", 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesListKeys.json -func ExampleDatabasesClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatabasesClient().ListKeys(ctx, "rg1", "cache1", "default", 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.AccessKeys = armredisenterprise.AccessKeys{ - // PrimaryKey: to.Ptr(""), - // SecondaryKey: to.Ptr(""), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesRegenerateKey.json -func ExampleDatabasesClient_BeginRegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginRegenerateKey(ctx, "rg1", "cache1", "default", armredisenterprise.RegenerateKeyParameters{ - KeyType: to.Ptr(armredisenterprise.AccessKeyTypePrimary), - }, 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.AccessKeys = armredisenterprise.AccessKeys{ - // PrimaryKey: to.Ptr(""), - // SecondaryKey: to.Ptr(""), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesImport.json -func ExampleDatabasesClient_BeginImport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginImport(ctx, "rg1", "cache1", "default", armredisenterprise.ImportClusterParameters{ - SasUris: []*string{ - to.Ptr("https://contosostorage.blob.core.window.net/urltoBlobFile1?sasKeyParameters"), - to.Ptr("https://contosostorage.blob.core.window.net/urltoBlobFile2?sasKeyParameters")}, - }, 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesExport.json -func ExampleDatabasesClient_BeginExport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginExport(ctx, "rg1", "cache1", "default", armredisenterprise.ExportClusterParameters{ - SasURI: to.Ptr("https://contosostorage.blob.core.window.net/urlToBlobContainer?sasKeyParameters"), - }, 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDatabasesForceUnlink.json -func ExampleDatabasesClient_BeginForceUnlink() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatabasesClient().BeginForceUnlink(ctx, "rg1", "cache1", "default", armredisenterprise.ForceUnlinkParameters{ - IDs: []*string{ - to.Ptr("/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default")}, - }, 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/redisenterprise/armredisenterprise/go.mod b/sdk/resourcemanager/redisenterprise/armredisenterprise/go.mod index a6548c6bef3d..579741444fd3 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/go.mod +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/go.mod @@ -1,21 +1,13 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.6.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/go.sum b/sdk/resourcemanager/redisenterprise/armredisenterprise/go.sum index 8ba445a8c4da..5c6bee428364 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/go.sum +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0 h1:rTnT/Jrcm+figWlYz4Ixzt0SJVR2cMC8lvZcimipiEY= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.4.0/go.mod h1:ON4tFdPTwRcgWEaVDrN3584Ef+b7GgSJaXxe5fW9t4M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2 h1:uqM+VoHjVH6zdlkLF2b6O0ZANcHoj3rO0PoQ3jglUJA= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.2/go.mod h1:twTKAa1E6hLmSDjLhaCkbTMQKc7p/rNLU40rLxGEOCI= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0 h1:leh5DwKv6Ihwi+h60uHtn6UWAxBbZ0q8DwQVMzf61zw= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.2.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0 h1:UE9n9rkJF62ArLb1F3DEjRt8O3jLwMWdSoypKV4f3MU= -github.com/AzureAD/microsoft-authentication-library-for-go v0.9.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc= -golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/models.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/models.go index 8f95796be774..8f0d25d316a3 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/models.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/models.go @@ -3,12 +3,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise +import "time" + // AccessKeys - The secret access keys used for authenticating connections to redis type AccessKeys struct { // READ-ONLY; The current primary key that clients can use to authenticate @@ -18,37 +19,23 @@ type AccessKeys struct { SecondaryKey *string } -// ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method. -type ClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. -type ClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. -type ClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} +// Capability - Information about the features the location supports +type Capability struct { + // Feature name + Name *string -// ClientGetOptions contains the optional parameters for the Client.Get method. -type ClientGetOptions struct { - // placeholder for future optional parameters + // Indicates whether feature is supported or not + Value *bool } -// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. -type ClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} +// CheckNameAvailabilityParameters - Parameters body to pass for resource name availability check. +type CheckNameAvailabilityParameters struct { + // REQUIRED; Resource name. + Name *string -// ClientListOptions contains the optional parameters for the Client.NewListPager method. -type ClientListOptions struct { - // placeholder for future optional parameters + // REQUIRED; Resource type. The only legal value of this property for checking redis enterprise cache name availability is + // 'Microsoft.Cache/redisenterprise'. + Type *string } // Cluster - Describes the RedisEnterprise cluster @@ -59,6 +46,9 @@ type Cluster struct { // REQUIRED; The SKU to create, which affects price, performance, and features. SKU *SKU + // The identity of the resource. + Identity *ManagedServiceIdentity + // Other properties of the cluster. Properties *ClusterProperties @@ -74,6 +64,9 @@ type Cluster struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -89,6 +82,9 @@ type ClusterList struct { // ClusterProperties - Properties of RedisEnterprise clusters, as opposed to general resource properties like location, tags type ClusterProperties struct { + // Encryption-at-rest configuration for the cluster. + Encryption *ClusterPropertiesEncryption + // The minimum TLS version for the cluster to support, e.g. '1.2' MinimumTLSVersion *TLSVersion @@ -108,8 +104,38 @@ type ClusterProperties struct { ResourceState *ResourceState } +// ClusterPropertiesEncryption - Encryption-at-rest configuration for the cluster. +type ClusterPropertiesEncryption struct { + // All Customer-managed key encryption properties for the resource. Set this to an empty object to use Microsoft-managed key + // encryption. + CustomerManagedKeyEncryption *ClusterPropertiesEncryptionCustomerManagedKeyEncryption +} + +// ClusterPropertiesEncryptionCustomerManagedKeyEncryption - All Customer-managed key encryption properties for the resource. +// Set this to an empty object to use Microsoft-managed key encryption. +type ClusterPropertiesEncryptionCustomerManagedKeyEncryption struct { + // All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. + KeyEncryptionKeyIdentity *ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity + + // Key encryption key Url, versioned only. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 + KeyEncryptionKeyURL *string +} + +// ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity - All identity configuration for Customer-managed key +// settings defining which identity should be used to auth to Key Vault. +type ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity struct { + // Only userAssignedIdentity is supported in this API version; other types may be supported in the future + IdentityType *CmkIdentityType + + // User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions//resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. + UserAssignedIdentityResourceID *string +} + // ClusterUpdate - A partial update to the RedisEnterprise cluster type ClusterUpdate struct { + // The identity of the resource. + Identity *ManagedServiceIdentity + // Other properties of the cluster. Properties *ClusterProperties @@ -131,6 +157,9 @@ type Database struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -190,63 +219,6 @@ type DatabaseUpdate struct { Properties *DatabaseProperties } -// DatabasesClientBeginCreateOptions contains the optional parameters for the DatabasesClient.BeginCreate method. -type DatabasesClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. -type DatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginExportOptions contains the optional parameters for the DatabasesClient.BeginExport method. -type DatabasesClientBeginExportOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginForceUnlinkOptions contains the optional parameters for the DatabasesClient.BeginForceUnlink method. -type DatabasesClientBeginForceUnlinkOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginImportOptions contains the optional parameters for the DatabasesClient.BeginImport method. -type DatabasesClientBeginImportOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginRegenerateKeyOptions contains the optional parameters for the DatabasesClient.BeginRegenerateKey method. -type DatabasesClientBeginRegenerateKeyOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientBeginUpdateOptions contains the optional parameters for the DatabasesClient.BeginUpdate method. -type DatabasesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. -type DatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListByClusterOptions contains the optional parameters for the DatabasesClient.NewListByClusterPager method. -type DatabasesClientListByClusterOptions struct { - // placeholder for future optional parameters -} - -// DatabasesClientListKeysOptions contains the optional parameters for the DatabasesClient.ListKeys method. -type DatabasesClientListKeysOptions struct { - // placeholder for future optional parameters -} - // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -287,6 +259,12 @@ type ExportClusterParameters struct { SasURI *string } +// FlushParameters - Parameters for a Redis Enterprise active geo-replication flush operation +type FlushParameters struct { + // The identifiers of all the other database resources in the georeplication group to be flushed. + IDs []*string +} + // ForceUnlinkParameters - Parameters for a Redis Enterprise Active Geo Replication Force Unlink operation. type ForceUnlinkParameters struct { // REQUIRED; The resource IDs of the database resources to be unlinked. @@ -308,6 +286,35 @@ type LinkedDatabase struct { State *LinkState } +// LocationInfo - Information about location (for example: features that it supports) +type LocationInfo struct { + // List of capabilities + Capabilities []*Capability + + // Location name + Location *string +} + +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + // Module - Specifies configuration of a redis module type Module struct { // REQUIRED; The name of the module, e.g. 'RedisBloom', 'RediSearch', 'RedisTimeSeries' @@ -390,16 +397,6 @@ type OperationStatus struct { Status *string } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// OperationsStatusClientGetOptions contains the optional parameters for the OperationsStatusClient.Get method. -type OperationsStatusClientGetOptions struct { - // placeholder for future optional parameters -} - // Persistence-related configuration for the RedisEnterprise database type Persistence struct { // Sets whether AOF is enabled. @@ -432,6 +429,9 @@ type PrivateEndpointConnection struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -454,31 +454,6 @@ type PrivateEndpointConnectionProperties struct { ProvisioningState *PrivateEndpointConnectionProvisioningState } -// PrivateEndpointConnectionsClientBeginPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginPut -// method. -type PrivateEndpointConnectionsClientBeginPutOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete -// method. -type PrivateEndpointConnectionsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager -// method. -type PrivateEndpointConnectionsClientListOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkResource - A private link resource type PrivateLinkResource struct { // Resource properties. @@ -490,6 +465,9 @@ type PrivateLinkResource struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -512,12 +490,6 @@ type PrivateLinkResourceProperties struct { RequiredMembers []*string } -// PrivateLinkResourcesClientListByClusterOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByClusterPager -// method. -type PrivateLinkResourcesClientListByClusterOptions struct { - // placeholder for future optional parameters -} - // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer // and provider. type PrivateLinkServiceConnectionState struct { @@ -540,6 +512,9 @@ type ProxyResource struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -550,6 +525,24 @@ type RegenerateKeyParameters struct { KeyType *AccessKeyType } +// RegionSKUDetail - Details about the location requested and the available skus in the location +type RegionSKUDetail struct { + // Details about location and its capabilities + LocationInfo *LocationInfo + + // Resource type which has the SKU, such as Microsoft.Cache/redisEnterprise + ResourceType *string + + // Details about available skus + SKUDetails *SKUDetail +} + +// RegionSKUDetails - List of details about all the available SKUs +type RegionSKUDetails struct { + // List of Sku Detail + Value []*RegionSKUDetail +} + // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -558,6 +551,9 @@ type Resource struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -572,6 +568,33 @@ type SKU struct { Capacity *int32 } +// SKUDetail - Information about Sku +type SKUDetail struct { + // The type of RedisEnterprise cluster to deploy. Possible values: (EnterpriseE10, EnterpriseFlashF300 etc.) + Name *SKUName +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { @@ -587,6 +610,18 @@ type TrackedResource struct { // READ-ONLY; The name of the resource Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/models_serde.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/models_serde.go index 690b1570e63d..0aaab422d772 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/models_serde.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/models_serde.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise @@ -47,14 +46,78 @@ func (a *AccessKeys) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Capability. +func (c Capability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Capability. +func (c *Capability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityParameters. +func (c CheckNameAvailabilityParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityParameters. +func (c *CheckNameAvailabilityParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Cluster. func (c Cluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) + populate(objectMap, "identity", c.Identity) populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "sku", c.SKU) + populate(objectMap, "systemData", c.SystemData) populate(objectMap, "tags", c.Tags) populate(objectMap, "type", c.Type) populate(objectMap, "zones", c.Zones) @@ -73,6 +136,9 @@ func (c *Cluster) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &c.Location) delete(rawMsg, key) @@ -85,6 +151,9 @@ func (c *Cluster) UnmarshalJSON(data []byte) error { case "sku": err = unpopulate(val, "SKU", &c.SKU) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &c.Tags) delete(rawMsg, key) @@ -136,6 +205,7 @@ func (c *ClusterList) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ClusterProperties. func (c ClusterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "encryption", c.Encryption) populate(objectMap, "hostName", c.HostName) populate(objectMap, "minimumTlsVersion", c.MinimumTLSVersion) populate(objectMap, "privateEndpointConnections", c.PrivateEndpointConnections) @@ -154,6 +224,9 @@ func (c *ClusterProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "encryption": + err = unpopulate(val, "Encryption", &c.Encryption) + delete(rawMsg, key) case "hostName": err = unpopulate(val, "HostName", &c.HostName) delete(rawMsg, key) @@ -180,9 +253,99 @@ func (c *ClusterProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ClusterPropertiesEncryption. +func (c ClusterPropertiesEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customerManagedKeyEncryption", c.CustomerManagedKeyEncryption) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPropertiesEncryption. +func (c *ClusterPropertiesEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerManagedKeyEncryption": + err = unpopulate(val, "CustomerManagedKeyEncryption", &c.CustomerManagedKeyEncryption) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPropertiesEncryptionCustomerManagedKeyEncryption. +func (c ClusterPropertiesEncryptionCustomerManagedKeyEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "keyEncryptionKeyIdentity", c.KeyEncryptionKeyIdentity) + populate(objectMap, "keyEncryptionKeyUrl", c.KeyEncryptionKeyURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPropertiesEncryptionCustomerManagedKeyEncryption. +func (c *ClusterPropertiesEncryptionCustomerManagedKeyEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "keyEncryptionKeyIdentity": + err = unpopulate(val, "KeyEncryptionKeyIdentity", &c.KeyEncryptionKeyIdentity) + delete(rawMsg, key) + case "keyEncryptionKeyUrl": + err = unpopulate(val, "KeyEncryptionKeyURL", &c.KeyEncryptionKeyURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity. +func (c ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identityType", c.IdentityType) + populate(objectMap, "userAssignedIdentityResourceId", c.UserAssignedIdentityResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity. +func (c *ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identityType": + err = unpopulate(val, "IdentityType", &c.IdentityType) + delete(rawMsg, key) + case "userAssignedIdentityResourceId": + err = unpopulate(val, "UserAssignedIdentityResourceID", &c.UserAssignedIdentityResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ClusterUpdate. func (c ClusterUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", c.Identity) populate(objectMap, "properties", c.Properties) populate(objectMap, "sku", c.SKU) populate(objectMap, "tags", c.Tags) @@ -198,6 +361,9 @@ func (c *ClusterUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &c.Identity) + delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &c.Properties) delete(rawMsg, key) @@ -221,6 +387,7 @@ func (d Database) MarshalJSON() ([]byte, error) { populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -243,6 +410,9 @@ func (d *Database) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -530,6 +700,33 @@ func (e *ExportClusterParameters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FlushParameters. +func (f FlushParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "ids", f.IDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FlushParameters. +func (f *FlushParameters) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ids": + err = unpopulate(val, "IDs", &f.IDs) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ForceUnlinkParameters. func (f ForceUnlinkParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -615,6 +812,76 @@ func (l *LinkedDatabase) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LocationInfo. +func (l LocationInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capabilities", l.Capabilities) + populate(objectMap, "location", l.Location) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationInfo. +func (l *LocationInfo) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capabilities": + err = unpopulate(val, "Capabilities", &l.Capabilities) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Module. func (m Module) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -882,6 +1149,7 @@ func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -904,6 +1172,9 @@ func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -983,6 +1254,7 @@ func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1005,6 +1277,9 @@ func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -1118,6 +1393,7 @@ func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -1137,6 +1413,9 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -1175,11 +1454,74 @@ func (r *RegenerateKeyParameters) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type RegionSKUDetail. +func (r RegionSKUDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "locationInfo", r.LocationInfo) + populate(objectMap, "resourceType", r.ResourceType) + populate(objectMap, "skuDetails", r.SKUDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionSKUDetail. +func (r *RegionSKUDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "locationInfo": + err = unpopulate(val, "LocationInfo", &r.LocationInfo) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &r.ResourceType) + delete(rawMsg, key) + case "skuDetails": + err = unpopulate(val, "SKUDetails", &r.SKUDetails) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegionSKUDetails. +func (r RegionSKUDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegionSKUDetails. +func (r *RegionSKUDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Resource. func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -1199,6 +1541,9 @@ func (r *Resource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -1241,12 +1586,87 @@ func (s *SKU) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SKUDetail. +func (s SKUDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKUDetail. +func (s *SKUDetail) 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 "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -1270,6 +1690,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) @@ -1284,6 +1707,37 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client.go index 38510a8bf962..4dc12dc5d73a 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations of the Microsoft.Cache provider. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client_example_test.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client_example_test.go deleted file mode 100644 index d0b2b7385cfa..000000000000 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client_example_test.go +++ /dev/null @@ -1,64 +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 armredisenterprise_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/OperationsList.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 := armredisenterprise.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.OperationListResult = armredisenterprise.OperationListResult{ - // Value: []*armredisenterprise.Operation{ - // { - // Name: to.Ptr("Microsoft.Cache/redisEnterprise/read"), - // Display: &armredisenterprise.OperationDisplay{ - // Description: to.Ptr("View the Redis Enterprise cache's settings and configuration in the management portal"), - // Operation: to.Ptr("Manage Redis Enterprise cache (read)"), - // Provider: to.Ptr("Microsoft Cache"), - // Resource: to.Ptr("Redis Enterprise cache"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Cache/redisEnterprise/write"), - // Display: &armredisenterprise.OperationDisplay{ - // Description: to.Ptr("Modify the Redis Enterprise cache's settings and configuration in the management portal"), - // Operation: to.Ptr("Manage Redis Enterprise cache (write)"), - // Provider: to.Ptr("Microsoft Cache"), - // Resource: to.Ptr("Redis Enterprise cache"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client.go index e8c2bc793c2a..02efa8285ce5 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise @@ -47,23 +46,26 @@ func NewOperationsStatusClient(subscriptionID string, credential azcore.TokenCre // Get - Gets the status of operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 -// - location - The region the operation is in. -// - operationID - The operation's unique identifier. +// Generated from API version 2023-10-01-preview +// - location - The name of Azure region. +// - operationID - The ID of an ongoing async operation. // - options - OperationsStatusClientGetOptions contains the optional parameters for the OperationsStatusClient.Get method. func (client *OperationsStatusClient) Get(ctx context.Context, location string, operationID string, options *OperationsStatusClientGetOptions) (OperationsStatusClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { return OperationsStatusClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return OperationsStatusClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsStatusClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationsStatusClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -86,7 +88,7 @@ func (client *OperationsStatusClient) getCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client_example_test.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client_example_test.go deleted file mode 100644 index 617baa9432a4..000000000000 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armredisenterprise_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/OperationsStatusGet.json -func ExampleOperationsStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsStatusClient().Get(ctx, "West US", "testoperationid", 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.OperationStatus = armredisenterprise.OperationStatus{ - // Name: to.Ptr("testoperationid"), - // EndTime: to.Ptr("2017-01-01T16:13:13.933Z"), - // ID: to.Ptr("/subscriptions/subid/providers/Microsoft.Cache/locations/westus/operationsStatus/testoperationid"), - // StartTime: to.Ptr("2017-01-01T13:13:13.933Z"), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/options.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/options.go new file mode 100644 index 000000000000..f0067c61d4f0 --- /dev/null +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/options.go @@ -0,0 +1,157 @@ +//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 armredisenterprise + +// ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method. +type ClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginDeleteOptions contains the optional parameters for the Client.BeginDelete method. +type ClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientBeginUpdateOptions contains the optional parameters for the Client.BeginUpdate method. +type ClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ClientCheckNameAvailabilityOptions contains the optional parameters for the Client.CheckNameAvailability method. +type ClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + +// ClientGetOptions contains the optional parameters for the Client.Get method. +type ClientGetOptions struct { + // placeholder for future optional parameters +} + +// ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager method. +type ClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ClientListOptions contains the optional parameters for the Client.NewListPager method. +type ClientListOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientBeginCreateOptions contains the optional parameters for the DatabasesClient.BeginCreate method. +type DatabasesClientBeginCreateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginDeleteOptions contains the optional parameters for the DatabasesClient.BeginDelete method. +type DatabasesClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginExportOptions contains the optional parameters for the DatabasesClient.BeginExport method. +type DatabasesClientBeginExportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginFlushOptions contains the optional parameters for the DatabasesClient.BeginFlush method. +type DatabasesClientBeginFlushOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginForceUnlinkOptions contains the optional parameters for the DatabasesClient.BeginForceUnlink method. +type DatabasesClientBeginForceUnlinkOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginImportOptions contains the optional parameters for the DatabasesClient.BeginImport method. +type DatabasesClientBeginImportOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginRegenerateKeyOptions contains the optional parameters for the DatabasesClient.BeginRegenerateKey method. +type DatabasesClientBeginRegenerateKeyOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientBeginUpdateOptions contains the optional parameters for the DatabasesClient.BeginUpdate method. +type DatabasesClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// DatabasesClientGetOptions contains the optional parameters for the DatabasesClient.Get method. +type DatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientListByClusterOptions contains the optional parameters for the DatabasesClient.NewListByClusterPager method. +type DatabasesClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// DatabasesClientListKeysOptions contains the optional parameters for the DatabasesClient.ListKeys method. +type DatabasesClientListKeysOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsStatusClientGetOptions contains the optional parameters for the OperationsStatusClient.Get method. +type OperationsStatusClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginPutOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginPut +// method. +type PrivateEndpointConnectionsClientBeginPutOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListByClusterOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByClusterPager +// method. +type PrivateLinkResourcesClientListByClusterOptions struct { + // placeholder for future optional parameters +} + +// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +type SKUsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client.go index 88033edffa3c..d70308d8b27e 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise @@ -44,32 +43,53 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor return client, nil } -// Delete - Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. +// BeginDelete - Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource -// - options - PrivateEndpointConnectionsClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Delete +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. -func (client *PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (PrivateEndpointConnectionsClientDeleteResponse, error) { +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-10-01-preview +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) if err != nil { - return PrivateEndpointConnectionsClientDeleteResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return PrivateEndpointConnectionsClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return PrivateEndpointConnectionsClientDeleteResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return PrivateEndpointConnectionsClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -92,7 +112,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -101,25 +121,28 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. // Get - Gets the specified private endpoint connection associated with the RedisEnterprise cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource // - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PrivateEndpointConnectionsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -146,7 +169,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -163,7 +186,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListPager - Lists all the private endpoint connections associated with the RedisEnterprise cluster. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager @@ -210,7 +233,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +251,7 @@ func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Re // BeginPut - Updates the state of the specified private endpoint connection associated with the RedisEnterprise cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource @@ -241,7 +264,8 @@ func (client *PrivateEndpointConnectionsClient) BeginPut(ctx context.Context, re if err != nil { return nil, err } - return runtime.NewPoller[PrivateEndpointConnectionsClientPutResponse](resp, client.internal.Pipeline(), nil) + poller, err := runtime.NewPoller[PrivateEndpointConnectionsClientPutResponse](resp, client.internal.Pipeline(), nil) + return poller, err } else { return runtime.NewPollerFromResumeToken[PrivateEndpointConnectionsClientPutResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -250,20 +274,22 @@ func (client *PrivateEndpointConnectionsClient) BeginPut(ctx context.Context, re // Put - Updates the state of the specified private endpoint connection associated with the RedisEnterprise cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview func (client *PrivateEndpointConnectionsClient) put(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginPutOptions) (*http.Response, error) { + var err error req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, properties, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // putCreateRequest creates the Put request. @@ -290,8 +316,11 @@ func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil } diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client_example_test.go deleted file mode 100644 index c44f3e86a59b..000000000000 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,160 +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 armredisenterprise_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/redisenterprise/armredisenterprise" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseListPrivateEndpointConnections.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 := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("rg1", "cache1", 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.PrivateEndpointConnectionListResult = armredisenterprise.PrivateEndpointConnectionListResult{ - // Value: []*armredisenterprise.PrivateEndpointConnection{ - // { - // Name: to.Ptr("pectest01"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/privateEndpointConnections/pectest01"), - // Properties: &armredisenterprise.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armredisenterprise.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armredisenterprise.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armredisenterprise.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armredisenterprise.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("pectest01"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/privateEndpointConnections/pectest01"), - // Properties: &armredisenterprise.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armredisenterprise.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armredisenterprise.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armredisenterprise.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armredisenterprise.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseGetPrivateEndpointConnection.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 := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "rg1", "cache1", "pectest01", 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 = armredisenterprise.PrivateEndpointConnection{ - // Name: to.Ptr("pectest01"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/privateEndpointConnections/pectest01"), - // Properties: &armredisenterprise.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armredisenterprise.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/privateEndpoints/petest01"), - // }, - // PrivateLinkServiceConnectionState: &armredisenterprise.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-Approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armredisenterprise.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armredisenterprise.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterprisePutPrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_BeginPut() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginPut(ctx, "rg1", "cache1", "pectest01", armredisenterprise.PrivateEndpointConnection{ - Properties: &armredisenterprise.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armredisenterprise.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Auto-Approved"), - Status: to.Ptr(armredisenterprise.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, 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/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseDeletePrivateEndpointConnection.json -func ExamplePrivateEndpointConnectionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewPrivateEndpointConnectionsClient().Delete(ctx, "rg1", "cache1", "pectest01", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client.go index 00c38849bb60..7bbfcae6ce82 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client.go @@ -3,9 +3,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise @@ -46,7 +45,7 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke // NewListByClusterPager - Gets the private link resources that need to be created for a RedisEnterprise cluster. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - clusterName - The name of the RedisEnterprise cluster. // - options - PrivateLinkResourcesClientListByClusterOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListByClusterPager @@ -93,7 +92,7 @@ func (client *PrivateLinkResourcesClient) listByClusterCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-01-01") + reqQP.Set("api-version", "2023-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client_example_test.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client_example_test.go deleted file mode 100644 index 33445d0e7401..000000000000 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_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 armredisenterprise_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/armredisenterprise" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2022-01-01/examples/RedisEnterpriseListPrivateLinkResources.json -func ExamplePrivateLinkResourcesClient_NewListByClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armredisenterprise.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkResourcesClient().NewListByClusterPager("rg1", "cache1", 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.PrivateLinkResourceListResult = armredisenterprise.PrivateLinkResourceListResult{ - // Value: []*armredisenterprise.PrivateLinkResource{ - // { - // Name: to.Ptr("redisEnterpriseCache"), - // Type: to.Ptr("Microsoft.Cache/redisEnterprise/privateLinkResources"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/privateLinkResources/redisEnterpriseCache"), - // Properties: &armredisenterprise.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("redisEnterpriseCache"), - // RequiredMembers: []*string{ - // to.Ptr("redisEnterpriseCache")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.redisenterprise.cache.windows.net")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/response_types.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/response_types.go index 7bfdd1b1c05f..3379a4e03f03 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/response_types.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/response_types.go @@ -3,14 +3,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. package armredisenterprise +// ClientCheckNameAvailabilityResponse contains the response from method Client.CheckNameAvailability. +type ClientCheckNameAvailabilityResponse struct { + // placeholder for future response values +} + // ClientCreateResponse contains the response from method Client.BeginCreate. type ClientCreateResponse struct { + // Describes the RedisEnterprise cluster Cluster } @@ -21,26 +26,31 @@ type ClientDeleteResponse struct { // ClientGetResponse contains the response from method Client.Get. type ClientGetResponse struct { + // Describes the RedisEnterprise cluster Cluster } // ClientListByResourceGroupResponse contains the response from method Client.NewListByResourceGroupPager. type ClientListByResourceGroupResponse struct { + // The response of a list-all operation. ClusterList } // ClientListResponse contains the response from method Client.NewListPager. type ClientListResponse struct { + // The response of a list-all operation. ClusterList } // ClientUpdateResponse contains the response from method Client.BeginUpdate. type ClientUpdateResponse struct { + // Describes the RedisEnterprise cluster Cluster } // DatabasesClientCreateResponse contains the response from method DatabasesClient.BeginCreate. type DatabasesClientCreateResponse struct { + // Describes a database on the RedisEnterprise cluster Database } @@ -54,6 +64,11 @@ type DatabasesClientExportResponse struct { // placeholder for future response values } +// DatabasesClientFlushResponse contains the response from method DatabasesClient.BeginFlush. +type DatabasesClientFlushResponse struct { + // placeholder for future response values +} + // DatabasesClientForceUnlinkResponse contains the response from method DatabasesClient.BeginForceUnlink. type DatabasesClientForceUnlinkResponse struct { // placeholder for future response values @@ -61,6 +76,7 @@ type DatabasesClientForceUnlinkResponse struct { // DatabasesClientGetResponse contains the response from method DatabasesClient.Get. type DatabasesClientGetResponse struct { + // Describes a database on the RedisEnterprise cluster Database } @@ -71,55 +87,71 @@ type DatabasesClientImportResponse struct { // DatabasesClientListByClusterResponse contains the response from method DatabasesClient.NewListByClusterPager. type DatabasesClientListByClusterResponse struct { + // The response of a list-all operation. DatabaseList } // DatabasesClientListKeysResponse contains the response from method DatabasesClient.ListKeys. type DatabasesClientListKeysResponse struct { + // The secret access keys used for authenticating connections to redis AccessKeys } // DatabasesClientRegenerateKeyResponse contains the response from method DatabasesClient.BeginRegenerateKey. type DatabasesClientRegenerateKeyResponse struct { + // The secret access keys used for authenticating connections to redis AccessKeys } // DatabasesClientUpdateResponse contains the response from method DatabasesClient.BeginUpdate. type DatabasesClientUpdateResponse struct { + // Describes a database on the RedisEnterprise cluster Database } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // OperationsStatusClientGetResponse contains the response from method OperationsStatusClient.Get. type OperationsStatusClientGetResponse struct { + // The status of a long-running operation. OperationStatus } -// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.Delete. +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. type PrivateEndpointConnectionsClientDeleteResponse struct { // placeholder for future response values } // PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. type PrivateEndpointConnectionsClientGetResponse struct { + // The Private Endpoint Connection resource. PrivateEndpointConnection } // PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. type PrivateEndpointConnectionsClientListResponse struct { + // List of private endpoint connection associated with the specified storage account PrivateEndpointConnectionListResult } // PrivateEndpointConnectionsClientPutResponse contains the response from method PrivateEndpointConnectionsClient.BeginPut. type PrivateEndpointConnectionsClientPutResponse struct { + // The Private Endpoint Connection resource. PrivateEndpointConnection } // PrivateLinkResourcesClientListByClusterResponse contains the response from method PrivateLinkResourcesClient.NewListByClusterPager. type PrivateLinkResourcesClientListByClusterResponse struct { + // A list of private link resources PrivateLinkResourceListResult } + +// SKUsClientListResponse contains the response from method SKUsClient.NewListPager. +type SKUsClientListResponse struct { + // List of details about all the available SKUs + RegionSKUDetails +} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/skus_client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/skus_client.go new file mode 100644 index 000000000000..f829a6be2d79 --- /dev/null +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/skus_client.go @@ -0,0 +1,102 @@ +//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 armredisenterprise + +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" +) + +// SKUsClient contains the methods for the SKUs group. +// Don't use this type directly, use NewSKUsClient() instead. +type SKUsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSKUsClient creates a new instance of SKUsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SKUsClient, error) { + cl, err := arm.NewClient(moduleName+".SKUsClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SKUsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets information about skus in specified location for the given subscription id +// +// Generated from API version 2023-10-01-preview +// - location - The name of Azure region. +// - options - SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +func (client *SKUsClient) NewListPager(location string, options *SKUsClientListOptions) *runtime.Pager[SKUsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SKUsClientListResponse]{ + More: func(page SKUsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *SKUsClientListResponse) (SKUsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, location, options) + if err != nil { + return SKUsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SKUsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SKUsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *SKUsClient) listCreateRequest(ctx context.Context, location string, options *SKUsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/skus" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SKUsClient) listHandleResponse(resp *http.Response) (SKUsClientListResponse, error) { + result := SKUsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RegionSKUDetails); err != nil { + return SKUsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/time_rfc3339.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/time_rfc3339.go new file mode 100644 index 000000000000..3b48d405f0a7 --- /dev/null +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/time_rfc3339.go @@ -0,0 +1,86 @@ +//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 armredisenterprise + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// 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+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +}