diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/CHANGELOG.md b/sdk/resourcemanager/redisenterprise/armredisenterprise/CHANGELOG.md index d42d38c35cd9..9457ad5b502a 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/CHANGELOG.md +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.1.0-beta.2 (2023-04-10) +### Other Changes + + ## 1.1.0 (2023-04-07) ### Features Added diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/autorest.md b/sdk/resourcemanager/redisenterprise/armredisenterprise/autorest.md index edad8317634a..a4abf045da08 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.0 +module-version: 1.1.0-beta.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/client.go index 85854c24fb20..2670ead50e57 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/client.go @@ -47,7 +47,7 @@ func NewClient(subscriptionID string, credential azcore.TokenCredential, options // 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-03-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. @@ -69,7 +69,7 @@ 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-03-01-preview func (client *Client) create(ctx context.Context, resourceGroupName string, clusterName string, parameters Cluster, options *ClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) if err != nil { @@ -105,7 +105,7 @@ 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -114,7 +114,7 @@ func (client *Client) createCreateRequest(ctx context.Context, resourceGroupName // 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-03-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. @@ -135,7 +135,7 @@ 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-03-01-preview func (client *Client) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *ClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { @@ -171,7 +171,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ 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-03-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. @@ -219,7 +219,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -236,7 +236,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-03-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 +278,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -295,7 +295,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-03-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ClientListByResourceGroupOptions contains the optional parameters for the Client.NewListByResourceGroupPager // method. @@ -343,7 +343,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -361,7 +361,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-03-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. @@ -383,7 +383,7 @@ 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-03-01-preview func (client *Client) update(ctx context.Context, resourceGroupName string, clusterName string, parameters ClusterUpdate, options *ClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, parameters, options) if err != nil { @@ -419,7 +419,7 @@ 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/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..a909de77c3b1 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/client_factory.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/client_factory.go @@ -67,3 +67,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 5fead4ff43b0..6328134b0cc5 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/constants.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/constants.go @@ -11,7 +11,7 @@ package armredisenterprise const ( moduleName = "armredisenterprise" - moduleVersion = "v1.1.0" + moduleVersion = "v1.1.0-beta.2" ) // AccessKeyType - Which access key to regenerate. @@ -76,6 +76,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 +162,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 @@ -277,7 +333,6 @@ func PossibleResourceStateValues() []ResourceState { } } -// SKUName - The type of RedisEnterprise cluster to deploy. Possible values: (EnterpriseE10, EnterpriseFlashF300 etc.) type SKUName string const ( diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client.go index 506266859c64..72be5ab64f6f 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/databases_client.go @@ -47,7 +47,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-03-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. @@ -70,7 +70,7 @@ 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-03-01-preview func (client *DatabasesClient) create(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters Database, options *DatabasesClientBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -110,7 +110,7 @@ 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -119,7 +119,7 @@ func (client *DatabasesClient) createCreateRequest(ctx context.Context, resource // 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-03-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. @@ -141,7 +141,7 @@ 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-03-01-preview func (client *DatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, options *DatabasesClientBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, databaseName, options) if err != nil { @@ -181,7 +181,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,7 +190,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-03-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. @@ -213,7 +213,7 @@ 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-03-01-preview func (client *DatabasesClient) export(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ExportClusterParameters, options *DatabasesClientBeginExportOptions) (*http.Response, error) { req, err := client.exportCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -253,7 +253,79 @@ 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-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, parameters) +} + +// 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-03-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 + } + return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientFlushResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + } 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-03-01-preview +func (client *DatabasesClient) flush(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters FlushParameters, options *DatabasesClientBeginFlushOptions) (*http.Response, error) { + req, err := client.flushCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) + if err != nil { + return nil, err + } + resp, 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) + } + return resp, 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -262,7 +334,7 @@ func (client *DatabasesClient) exportCreateRequest(ctx context.Context, resource // 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-03-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. @@ -286,7 +358,7 @@ 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-03-01-preview func (client *DatabasesClient) forceUnlink(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ForceUnlinkParameters, options *DatabasesClientBeginForceUnlinkOptions) (*http.Response, error) { req, err := client.forceUnlinkCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -326,7 +398,7 @@ 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -335,7 +407,7 @@ func (client *DatabasesClient) forceUnlinkCreateRequest(ctx context.Context, res // 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-03-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. @@ -379,7 +451,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -397,7 +469,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-03-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. @@ -420,7 +492,7 @@ 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-03-01-preview func (client *DatabasesClient) importOperation(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters ImportClusterParameters, options *DatabasesClientBeginImportOptions) (*http.Response, error) { req, err := client.importCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -460,7 +532,7 @@ 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -468,7 +540,7 @@ func (client *DatabasesClient) importCreateRequest(ctx context.Context, resource // NewListByClusterPager - Gets all databases in the specified RedisEnterprise cluster. // -// Generated from API version 2022-01-01 +// Generated from API version 2023-03-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 +593,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -539,7 +611,7 @@ 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-03-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. @@ -583,7 +655,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -601,7 +673,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-03-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. @@ -615,7 +687,7 @@ func (client *DatabasesClient) BeginRegenerateKey(ctx context.Context, resourceG return nil, err } return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DatabasesClientRegenerateKeyResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, }) } else { return runtime.NewPollerFromResumeToken[DatabasesClientRegenerateKeyResponse](options.ResumeToken, client.internal.Pipeline(), nil) @@ -625,7 +697,7 @@ 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-03-01-preview func (client *DatabasesClient) regenerateKey(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters RegenerateKeyParameters, options *DatabasesClientBeginRegenerateKeyOptions) (*http.Response, error) { req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -665,7 +737,7 @@ 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) @@ -674,7 +746,7 @@ func (client *DatabasesClient) regenerateKeyCreateRequest(ctx context.Context, r // 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-03-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. @@ -697,7 +769,7 @@ 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-03-01-preview func (client *DatabasesClient) update(ctx context.Context, resourceGroupName string, clusterName string, databaseName string, parameters DatabaseUpdate, options *DatabasesClientBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, clusterName, databaseName, parameters, options) if err != nil { @@ -737,7 +809,7 @@ 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/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..04ebf3b44f73 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/go.mod +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redisenterprise/arm 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.4.0 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 + github.com/davecgh/go-spew v1.1.1 // 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 + 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..b6bd7eaad1ba 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/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= +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 73fb6703e582..4f023280e261 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/models.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/models.go @@ -9,6 +9,8 @@ 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,6 +20,15 @@ type AccessKeys struct { SecondaryKey *string `json:"secondaryKey,omitempty" azure:"ro"` } +// Capability - Information about the features the location supports +type Capability struct { + // Feature name + Name *string `json:"name,omitempty"` + + // Indicates whether feature is supported or not + Value *bool `json:"value,omitempty"` +} + // ClientBeginCreateOptions contains the optional parameters for the Client.BeginCreate method. type ClientBeginCreateOptions struct { // Resumes the LRO from the provided token. @@ -59,6 +70,9 @@ type Cluster struct { // REQUIRED; The SKU to create, which affects price, performance, and features. SKU *SKU `json:"sku,omitempty"` + // The identity of the resource. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Other properties of the cluster. Properties *ClusterProperties `json:"properties,omitempty"` @@ -74,6 +88,9 @@ type Cluster struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -89,6 +106,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 `json:"encryption,omitempty"` + // The minimum TLS version for the cluster to support, e.g. '1.2' MinimumTLSVersion *TLSVersion `json:"minimumTlsVersion,omitempty"` @@ -108,8 +128,38 @@ type ClusterProperties struct { ResourceState *ResourceState `json:"resourceState,omitempty" azure:"ro"` } +// 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 `json:"customerManagedKeyEncryption,omitempty"` +} + +// 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 `json:"keyEncryptionKeyIdentity,omitempty"` + + // Key encryption key Url, versioned only. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 + KeyEncryptionKeyURL *string `json:"keyEncryptionKeyUrl,omitempty"` +} + +// 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 `json:"identityType,omitempty"` + + // User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions//resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. + UserAssignedIdentityResourceID *string `json:"userAssignedIdentityResourceId,omitempty"` +} + // ClusterUpdate - A partial update to the RedisEnterprise cluster type ClusterUpdate struct { + // The identity of the resource. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Other properties of the cluster. Properties *ClusterProperties `json:"properties,omitempty"` @@ -131,6 +181,9 @@ type Database struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -208,6 +261,12 @@ type DatabasesClientBeginExportOptions struct { 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. @@ -287,6 +346,12 @@ type ExportClusterParameters struct { SasURI *string `json:"sasUri,omitempty"` } +// FlushParameters - Parameters for a Redis Enterprise active geo-replication flush operation. +type FlushParameters struct { + // The resource identifiers of all the other database resources in the georeplication group to be flushed + IDs []*string `json:"ids,omitempty"` +} + // 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 +373,35 @@ type LinkedDatabase struct { State *LinkState `json:"state,omitempty" azure:"ro"` } +// LocationInfo - Information about location (for example: features that it supports) +type LocationInfo struct { + // List of capabilities + Capabilities []*Capability `json:"capabilities,omitempty"` + + // Location name + Location *string `json:"location,omitempty"` +} + +// 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 `json:"type,omitempty"` + + // 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 `json:"userAssignedIdentities,omitempty"` + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` +} + // Module - Specifies configuration of a redis module type Module struct { // REQUIRED; The name of the module, e.g. 'RedisBloom', 'RediSearch', 'RedisTimeSeries' @@ -432,6 +526,9 @@ type PrivateEndpointConnection struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -490,6 +587,9 @@ type PrivateLinkResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -540,6 +640,9 @@ type ProxyResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -550,6 +653,24 @@ type RegenerateKeyParameters struct { KeyType *AccessKeyType `json:"keyType,omitempty"` } +// RegionSKUDetail - Details about the location requested and the available skus in the location +type RegionSKUDetail struct { + // Details about location and its capabilities + LocationInfo *LocationInfo `json:"locationInfo,omitempty"` + + // Resource type which has the SKU, such as Microsoft.Cache/redisEnterprise + ResourceType *string `json:"resourceType,omitempty"` + + // Details about available skus + SKUDetails *SKUDetail `json:"skuDetails,omitempty"` +} + +// RegionSKUDetails - List of details about all the available SKUs +type RegionSKUDetails struct { + // List of Sku Detail + Value []*RegionSKUDetail `json:"value,omitempty"` +} + // 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 +679,9 @@ type Resource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -572,6 +696,38 @@ type SKU struct { Capacity *int32 `json:"capacity,omitempty"` } +// SKUDetail - Information about Sku +type SKUDetail struct { + // The type of RedisEnterprise cluster to deploy. Possible values: (EnterpriseE10, EnterpriseFlashF300 etc.) + Name *SKUName `json:"name,omitempty"` +} + +// SKUsClientListOptions contains the optional parameters for the SKUsClient.NewListPager method. +type SKUsClientListOptions struct { + // placeholder for future optional parameters +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + // 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 +743,18 @@ type TrackedResource struct { // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string `json:"clientId,omitempty" azure:"ro"` + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` +} diff --git a/sdk/resourcemanager/redisenterprise/armredisenterprise/models_serde.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/models_serde.go index ea31068b0495..0f659ab8f60f 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/models_serde.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/models_serde.go @@ -47,14 +47,47 @@ 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 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 +106,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 +121,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 +175,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 +194,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 +223,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 +331,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 +357,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 +380,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 +670,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 +782,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 +1119,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 +1142,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 +1224,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 +1247,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 +1363,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 +1383,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 +1424,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 +1511,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 +1556,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 +1660,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 +1677,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..6e1b92a84f98 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/operations_client.go @@ -40,7 +40,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-03-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -78,7 +78,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-03-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..b0d74cf547b6 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/operationsstatus_client.go @@ -47,9 +47,9 @@ 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-03-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) { req, err := client.getCreateRequest(ctx, location, operationID, options) @@ -86,7 +86,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-03-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/privateendpointconnections_client.go b/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client.go index 88033edffa3c..0c7eaa639b13 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/privateendpointconnections_client.go @@ -47,7 +47,7 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor // 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 2022-01-01 +// Generated from API version 2023-03-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 @@ -92,7 +92,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -101,7 +101,7 @@ 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-03-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 @@ -146,7 +146,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -163,7 +163,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-03-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 +210,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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -228,7 +228,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-03-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 @@ -250,7 +250,7 @@ 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-03-01-preview func (client *PrivateEndpointConnectionsClient) put(ctx context.Context, resourceGroupName string, clusterName string, privateEndpointConnectionName string, properties PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginPutOptions) (*http.Response, error) { req, err := client.putCreateRequest(ctx, resourceGroupName, clusterName, privateEndpointConnectionName, properties, options) if err != nil { @@ -290,7 +290,7 @@ 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-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, properties) 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..40d48819abdd 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/privatelinkresources_client.go @@ -46,7 +46,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-03-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 +93,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-03-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..c2053179efe7 100644 --- a/sdk/resourcemanager/redisenterprise/armredisenterprise/response_types.go +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/response_types.go @@ -54,6 +54,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 @@ -123,3 +128,8 @@ type PrivateEndpointConnectionsClientPutResponse struct { type PrivateLinkResourcesClientListByClusterResponse struct { PrivateLinkResourceListResult } + +// SKUsClientListResponse contains the response from method SKUsClient.NewListPager. +type SKUsClientListResponse struct { + 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..e4b71dcc6727 --- /dev/null +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/skus_client.go @@ -0,0 +1,103 @@ +//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 + +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-03-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-03-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *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..2f3d46d0573f --- /dev/null +++ b/sdk/resourcemanager/redisenterprise/armredisenterprise/time_rfc3339.go @@ -0,0 +1,87 @@ +//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 + +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 +}