diff --git a/sdk/redis/arm-rediscache/CHANGELOG.md b/sdk/redis/arm-rediscache/CHANGELOG.md index 61ba76da661e..360d6426d080 100644 --- a/sdk/redis/arm-rediscache/CHANGELOG.md +++ b/sdk/redis/arm-rediscache/CHANGELOG.md @@ -1,15 +1,61 @@ # Release History + +## 8.0.0 (2023-09-11) + +**Features** -## 7.2.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed + - Added operation group AccessPolicy + - Added operation group AccessPolicyAssignment + - Added operation Redis.beginFlushCache + - Added operation Redis.beginFlushCacheAndWait + - Added Interface AccessPolicyAssignmentCreateUpdateOptionalParams + - Added Interface AccessPolicyAssignmentDeleteHeaders + - Added Interface AccessPolicyAssignmentDeleteOptionalParams + - Added Interface AccessPolicyAssignmentGetOptionalParams + - Added Interface AccessPolicyAssignmentListNextOptionalParams + - Added Interface AccessPolicyAssignmentListOptionalParams + - Added Interface AccessPolicyCreateUpdateOptionalParams + - Added Interface AccessPolicyDeleteHeaders + - Added Interface AccessPolicyDeleteOptionalParams + - Added Interface AccessPolicyGetOptionalParams + - Added Interface AccessPolicyListNextOptionalParams + - Added Interface AccessPolicyListOptionalParams + - Added Interface LinkedServerDeleteHeaders + - Added Interface RedisCacheAccessPolicy + - Added Interface RedisCacheAccessPolicyAssignment + - Added Interface RedisCacheAccessPolicyAssignmentList + - Added Interface RedisCacheAccessPolicyList + - Added Interface RedisFlushCacheHeaders + - Added Interface RedisFlushCacheOptionalParams + - Added Type Alias AccessPolicyAssignmentCreateUpdateResponse + - Added Type Alias AccessPolicyAssignmentGetResponse + - Added Type Alias AccessPolicyAssignmentListNextResponse + - Added Type Alias AccessPolicyAssignmentListResponse + - Added Type Alias AccessPolicyAssignmentProvisioningState + - Added Type Alias AccessPolicyCreateUpdateResponse + - Added Type Alias AccessPolicyGetResponse + - Added Type Alias AccessPolicyListNextResponse + - Added Type Alias AccessPolicyListResponse + - Added Type Alias AccessPolicyProvisioningState + - Added Type Alias AccessPolicyType + - Added Type Alias RedisFlushCacheResponse + - Added Type Alias UpdateChannel + - Interface RedisCommonProperties has a new optional parameter updateChannel + - Interface RedisCommonPropertiesRedisConfiguration has a new optional parameter aadEnabled + - Interface RedisCreateParameters has a new optional parameter updateChannel + - Interface RedisResource has a new optional parameter updateChannel + - Interface RedisUpdateParameters has a new optional parameter updateChannel + - Added Enum KnownAccessPolicyAssignmentProvisioningState + - Added Enum KnownAccessPolicyProvisioningState + - Added Enum KnownAccessPolicyType + - Added Enum KnownUpdateChannel + - Enum KnownProvisioningState has a new value ConfiguringAAD -### Other Changes +**Breaking Changes** + - Type of parameter error of interface OperationStatusResult is changed from ErrorDetailAutoGenerated to ErrorDetail + + ## 7.2.0 (2023-06-02) **Features** diff --git a/sdk/redis/arm-rediscache/_meta.json b/sdk/redis/arm-rediscache/_meta.json index 76c040d3b3b9..0245fec61a78 100644 --- a/sdk/redis/arm-rediscache/_meta.json +++ b/sdk/redis/arm-rediscache/_meta.json @@ -1,8 +1,8 @@ { - "commit": "a7db288cbce8b520781be6b23444fc895c4d6c81", + "commit": "6ef4a4ab04df6cea16702dd935ac036509e6bd12", "readme": "specification/redis/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\redis\\resource-manager\\readme.md --use=@autorest/typescript@6.0.2 --generate-sample=true", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\redis\\resource-manager\\readme.md --use=@autorest/typescript@6.0.8 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", - "use": "@autorest/typescript@6.0.2" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.2", + "use": "@autorest/typescript@6.0.8" } \ No newline at end of file diff --git a/sdk/redis/arm-rediscache/assets.json b/sdk/redis/arm-rediscache/assets.json index 42ca7bf11968..a3d964bf9d7c 100644 --- a/sdk/redis/arm-rediscache/assets.json +++ b/sdk/redis/arm-rediscache/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "js", "TagPrefix": "js/redis/arm-rediscache", - "Tag": "js/redis/arm-rediscache_a1ff3b79f3" + "Tag": "js/redis/arm-rediscache_6c7a384c80" } diff --git a/sdk/redis/arm-rediscache/package.json b/sdk/redis/arm-rediscache/package.json index 7f1b70cbdd93..fa6aa5497553 100644 --- a/sdk/redis/arm-rediscache/package.json +++ b/sdk/redis/arm-rediscache/package.json @@ -3,17 +3,17 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for RedisManagementClient.", - "version": "7.2.1", + "version": "8.0.0", "engines": { "node": ">=14.0.0" }, "dependencies": { - "@azure/core-lro": "^2.5.3", + "@azure/core-lro": "^2.5.4", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.8.0", + "@azure/core-rest-pipeline": "^1.12.0", "tslib": "^2.2.0" }, "keywords": [ diff --git a/sdk/redis/arm-rediscache/review/arm-rediscache.api.md b/sdk/redis/arm-rediscache/review/arm-rediscache.api.md index ea3b263dd294..8af4300f842f 100644 --- a/sdk/redis/arm-rediscache/review/arm-rediscache.api.md +++ b/sdk/redis/arm-rediscache/review/arm-rediscache.api.md @@ -10,6 +10,119 @@ import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; import { SimplePollerLike } from '@azure/core-lro'; +// @public +export interface AccessPolicy { + beginCreateUpdate(resourceGroupName: string, cacheName: string, accessPolicyName: string, parameters: RedisCacheAccessPolicy, options?: AccessPolicyCreateUpdateOptionalParams): Promise, AccessPolicyCreateUpdateResponse>>; + beginCreateUpdateAndWait(resourceGroupName: string, cacheName: string, accessPolicyName: string, parameters: RedisCacheAccessPolicy, options?: AccessPolicyCreateUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, cacheName: string, accessPolicyName: string, options?: AccessPolicyDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, cacheName: string, accessPolicyName: string, options?: AccessPolicyDeleteOptionalParams): Promise; + get(resourceGroupName: string, cacheName: string, accessPolicyName: string, options?: AccessPolicyGetOptionalParams): Promise; + list(resourceGroupName: string, cacheName: string, options?: AccessPolicyListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface AccessPolicyAssignment { + beginCreateUpdate(resourceGroupName: string, cacheName: string, accessPolicyAssignmentName: string, parameters: RedisCacheAccessPolicyAssignment, options?: AccessPolicyAssignmentCreateUpdateOptionalParams): Promise, AccessPolicyAssignmentCreateUpdateResponse>>; + beginCreateUpdateAndWait(resourceGroupName: string, cacheName: string, accessPolicyAssignmentName: string, parameters: RedisCacheAccessPolicyAssignment, options?: AccessPolicyAssignmentCreateUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, cacheName: string, accessPolicyAssignmentName: string, options?: AccessPolicyAssignmentDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, cacheName: string, accessPolicyAssignmentName: string, options?: AccessPolicyAssignmentDeleteOptionalParams): Promise; + get(resourceGroupName: string, cacheName: string, accessPolicyAssignmentName: string, options?: AccessPolicyAssignmentGetOptionalParams): Promise; + list(resourceGroupName: string, cacheName: string, options?: AccessPolicyAssignmentListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface AccessPolicyAssignmentCreateUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type AccessPolicyAssignmentCreateUpdateResponse = RedisCacheAccessPolicyAssignment; + +// @public +export interface AccessPolicyAssignmentDeleteHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface AccessPolicyAssignmentDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface AccessPolicyAssignmentGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccessPolicyAssignmentGetResponse = RedisCacheAccessPolicyAssignment; + +// @public +export interface AccessPolicyAssignmentListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccessPolicyAssignmentListNextResponse = RedisCacheAccessPolicyAssignmentList; + +// @public +export interface AccessPolicyAssignmentListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccessPolicyAssignmentListResponse = RedisCacheAccessPolicyAssignmentList; + +// @public +export type AccessPolicyAssignmentProvisioningState = string; + +// @public +export interface AccessPolicyCreateUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type AccessPolicyCreateUpdateResponse = RedisCacheAccessPolicy; + +// @public +export interface AccessPolicyDeleteHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface AccessPolicyDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface AccessPolicyGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccessPolicyGetResponse = RedisCacheAccessPolicy; + +// @public +export interface AccessPolicyListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccessPolicyListNextResponse = RedisCacheAccessPolicyList; + +// @public +export interface AccessPolicyListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccessPolicyListResponse = RedisCacheAccessPolicyList; + +// @public +export type AccessPolicyProvisioningState = string; + +// @public +export type AccessPolicyType = string; + // @public export interface AsyncOperationStatus { get(location: string, operationId: string, options?: AsyncOperationStatusGetOptionalParams): Promise; @@ -49,15 +162,6 @@ export interface ErrorDetail { readonly target?: string; } -// @public -export interface ErrorDetailAutoGenerated { - readonly additionalInfo?: ErrorAdditionalInfo[]; - readonly code?: string; - readonly details?: ErrorDetailAutoGenerated[]; - readonly message?: string; - readonly target?: string; -} - // @public export interface ErrorResponse { error?: ErrorDetail; @@ -123,6 +227,32 @@ export interface ImportRDBParameters { storageSubscriptionId?: string; } +// @public +export enum KnownAccessPolicyAssignmentProvisioningState { + Canceled = "Canceled", + Deleted = "Deleted", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownAccessPolicyProvisioningState { + Canceled = "Canceled", + Deleted = "Deleted", + Deleting = "Deleting", + Failed = "Failed", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownAccessPolicyType { + BuiltIn = "BuiltIn", + Custom = "Custom" +} + // @public export enum KnownDefaultName { Default = "default" @@ -153,6 +283,7 @@ export enum KnownPrivateEndpointServiceConnectionStatus { // @public export enum KnownProvisioningState { + ConfiguringAAD = "ConfiguringAAD", Creating = "Creating", Deleting = "Deleting", Disabled = "Disabled", @@ -202,6 +333,12 @@ export enum KnownTlsVersion { One2 = "1.2" } +// @public +export enum KnownUpdateChannel { + Preview = "Preview", + Stable = "Stable" +} + // @public export interface LinkedServer { beginCreate(resourceGroupName: string, name: string, linkedServerName: string, parameters: RedisLinkedServerCreateParameters, options?: LinkedServerCreateOptionalParams): Promise, LinkedServerCreateResponse>>; @@ -221,6 +358,12 @@ export interface LinkedServerCreateOptionalParams extends coreClient.OperationOp // @public export type LinkedServerCreateResponse = RedisLinkedServerWithProperties; +// @public +export interface LinkedServerDeleteHeaders { + // (undocumented) + location?: string; +} + // @public export interface LinkedServerDeleteOptionalParams extends coreClient.OperationOptions { resumeFrom?: string; @@ -316,7 +459,7 @@ export interface OperationStatus extends OperationStatusResult { // @public export interface OperationStatusResult { endTime?: Date; - error?: ErrorDetailAutoGenerated; + error?: ErrorDetail; id?: string; name?: string; operations?: OperationStatusResult[]; @@ -476,6 +619,8 @@ export interface Redis { beginDeleteAndWait(resourceGroupName: string, name: string, options?: RedisDeleteOptionalParams): Promise; beginExportData(resourceGroupName: string, name: string, parameters: ExportRDBParameters, options?: RedisExportDataOptionalParams): Promise, void>>; beginExportDataAndWait(resourceGroupName: string, name: string, parameters: ExportRDBParameters, options?: RedisExportDataOptionalParams): Promise; + beginFlushCache(resourceGroupName: string, cacheName: string, options?: RedisFlushCacheOptionalParams): Promise, RedisFlushCacheResponse>>; + beginFlushCacheAndWait(resourceGroupName: string, cacheName: string, options?: RedisFlushCacheOptionalParams): Promise; beginImportData(resourceGroupName: string, name: string, parameters: ImportRDBParameters, options?: RedisImportDataOptionalParams): Promise, void>>; beginImportDataAndWait(resourceGroupName: string, name: string, parameters: ImportRDBParameters, options?: RedisImportDataOptionalParams): Promise; beginUpdate(resourceGroupName: string, name: string, parameters: RedisUpdateParameters, options?: RedisUpdateOptionalParams): Promise, RedisUpdateResponse>>; @@ -496,6 +641,33 @@ export interface RedisAccessKeys { readonly secondaryKey?: string; } +// @public +export interface RedisCacheAccessPolicy extends ProxyResource { + permissions?: string; + readonly provisioningState?: AccessPolicyProvisioningState; + readonly typePropertiesType?: AccessPolicyType; +} + +// @public +export interface RedisCacheAccessPolicyAssignment extends ProxyResource { + accessPolicyName?: string; + objectId?: string; + objectIdAlias?: string; + readonly provisioningState?: AccessPolicyAssignmentProvisioningState; +} + +// @public +export interface RedisCacheAccessPolicyAssignmentList { + readonly nextLink?: string; + value?: RedisCacheAccessPolicyAssignment[]; +} + +// @public +export interface RedisCacheAccessPolicyList { + readonly nextLink?: string; + value?: RedisCacheAccessPolicy[]; +} + // @public export interface RedisCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { } @@ -513,11 +685,13 @@ export interface RedisCommonProperties { tenantSettings?: { [propertyName: string]: string; }; + updateChannel?: UpdateChannel; } // @public export interface RedisCommonPropertiesRedisConfiguration { [property: string]: any; + aadEnabled?: string; aofBackupEnabled?: string; aofStorageConnectionString0?: string; aofStorageConnectionString1?: string; @@ -564,6 +738,7 @@ export interface RedisCreateParameters { tenantSettings?: { [propertyName: string]: string; }; + updateChannel?: UpdateChannel; zones?: string[]; } @@ -605,6 +780,21 @@ export interface RedisFirewallRuleListResult { value?: RedisFirewallRule[]; } +// @public +export interface RedisFlushCacheHeaders { + azureAsyncOperation?: string; + location?: string; +} + +// @public +export interface RedisFlushCacheOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type RedisFlushCacheResponse = RedisFlushCacheHeaders & OperationStatusResult; + // @public export type RedisForceRebootOperationResponse = RedisForceRebootResponse; @@ -748,6 +938,10 @@ export class RedisManagementClient extends coreClient.ServiceClient { $host: string; constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: RedisManagementClientOptionalParams); // (undocumented) + accessPolicy: AccessPolicy; + // (undocumented) + accessPolicyAssignment: AccessPolicyAssignment; + // (undocumented) apiVersion: string; // (undocumented) asyncOperationStatus: AsyncOperationStatus; @@ -844,6 +1038,7 @@ export interface RedisResource extends TrackedResource { tenantSettings?: { [propertyName: string]: string; }; + updateChannel?: UpdateChannel; zones?: string[]; } @@ -871,6 +1066,7 @@ export interface RedisUpdateParameters { tenantSettings?: { [propertyName: string]: string; }; + updateChannel?: UpdateChannel; } // @public @@ -922,6 +1118,9 @@ export interface TrackedResource extends Resource { }; } +// @public +export type UpdateChannel = string; + // @public export interface UpgradeNotification { readonly name?: string; diff --git a/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentCreateUpdateSample.ts b/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentCreateUpdateSample.ts new file mode 100644 index 000000000000..2aa884aa1371 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentCreateUpdateSample.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisCacheAccessPolicyAssignment, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Adds the access policy assignment to the specified users + * + * @summary Adds the access policy assignment to the specified users + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentCreateUpdate.json + */ +async function redisCacheAccessPolicyAssignmentCreateUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const parameters: RedisCacheAccessPolicyAssignment = { + accessPolicyName: "accessPolicy1", + objectId: "6497c918-11ad-41e7-1b0f-7c518a87d0b0", + objectIdAlias: "TestAADAppRedis" + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.beginCreateUpdateAndWait( + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentCreateUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentDeleteSample.ts b/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentDeleteSample.ts new file mode 100644 index 000000000000..56894112b57b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the access policy assignment from a redis cache + * + * @summary Deletes the access policy assignment from a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentDelete.json + */ +async function redisCacheAccessPolicyAssignmentDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.beginDeleteAndWait( + resourceGroupName, + cacheName, + accessPolicyAssignmentName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentGetSample.ts b/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentGetSample.ts new file mode 100644 index 000000000000..e663525b051b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentGetSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of assignments for an access policy of a redis cache + * + * @summary Gets the list of assignments for an access policy of a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json + */ +async function redisCacheAccessPolicyAssignmentGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.get( + resourceGroupName, + cacheName, + accessPolicyAssignmentName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentListSample.ts b/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentListSample.ts new file mode 100644 index 000000000000..40596c9d0b78 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/accessPolicyAssignmentListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of access policy assignments associated with this redis cache + * + * @summary Gets the list of access policy assignments associated with this redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentList.json + */ +async function redisCacheAccessPolicyAssignmentList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accessPolicyAssignment.list( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheAccessPolicyAssignmentList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/accessPolicyCreateUpdateSample.ts b/sdk/redis/arm-rediscache/samples-dev/accessPolicyCreateUpdateSample.ts new file mode 100644 index 000000000000..b8220fb1c506 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/accessPolicyCreateUpdateSample.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisCacheAccessPolicy, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Adds an access policy to the redis cache + * + * @summary Adds an access policy to the redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyCreateUpdate.json + */ +async function redisCacheAccessPolicyCreateUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const parameters: RedisCacheAccessPolicy = { permissions: "+get +hget" }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.beginCreateUpdateAndWait( + resourceGroupName, + cacheName, + accessPolicyName, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyCreateUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/accessPolicyDeleteSample.ts b/sdk/redis/arm-rediscache/samples-dev/accessPolicyDeleteSample.ts new file mode 100644 index 000000000000..6670a99d6034 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/accessPolicyDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the access policy from a redis cache + * + * @summary Deletes the access policy from a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyDelete.json + */ +async function redisCacheAccessPolicyDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.beginDeleteAndWait( + resourceGroupName, + cacheName, + accessPolicyName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/accessPolicyGetSample.ts b/sdk/redis/arm-rediscache/samples-dev/accessPolicyGetSample.ts new file mode 100644 index 000000000000..fea6cf1699f7 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/accessPolicyGetSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the detailed information about an access policy of a redis cache + * + * @summary Gets the detailed information about an access policy of a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json + */ +async function redisCacheAccessPolicyGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.get( + resourceGroupName, + cacheName, + accessPolicyName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/accessPolicyListSample.ts b/sdk/redis/arm-rediscache/samples-dev/accessPolicyListSample.ts new file mode 100644 index 000000000000..d9a9c75fc9ea --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/accessPolicyListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of access policies associated with this redis cache + * + * @summary Gets the list of access policies associated with this redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyList.json + */ +async function redisCacheAccessPolicyList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accessPolicy.list( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheAccessPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/asyncOperationStatusGetSample.ts b/sdk/redis/arm-rediscache/samples-dev/asyncOperationStatusGetSample.ts index 2220cf508e00..841cc1d03734 100644 --- a/sdk/redis/arm-rediscache/samples-dev/asyncOperationStatusGetSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/asyncOperationStatusGetSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to For checking the ongoing status of an operation * * @summary For checking the ongoing status of an operation - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheAsyncOperationStatus.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAsyncOperationStatus.json */ async function redisCacheAsyncOperationStatus() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/firewallRulesCreateOrUpdateSample.ts b/sdk/redis/arm-rediscache/samples-dev/firewallRulesCreateOrUpdateSample.ts index ba83ec8cef5f..4916cb01c60f 100644 --- a/sdk/redis/arm-rediscache/samples-dev/firewallRulesCreateOrUpdateSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/firewallRulesCreateOrUpdateSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Create or update a redis cache firewall rule * * @summary Create or update a redis cache firewall rule - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleCreate.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleCreate.json */ async function redisCacheFirewallRuleCreate() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/firewallRulesDeleteSample.ts b/sdk/redis/arm-rediscache/samples-dev/firewallRulesDeleteSample.ts index 03cf4a5985be..73f3bec5e66c 100644 --- a/sdk/redis/arm-rediscache/samples-dev/firewallRulesDeleteSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/firewallRulesDeleteSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Deletes a single firewall rule in a specified redis cache. * * @summary Deletes a single firewall rule in a specified redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleDelete.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleDelete.json */ async function redisCacheFirewallRuleDelete() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/firewallRulesGetSample.ts b/sdk/redis/arm-rediscache/samples-dev/firewallRulesGetSample.ts index caf16c173a03..a0faaccc074f 100644 --- a/sdk/redis/arm-rediscache/samples-dev/firewallRulesGetSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/firewallRulesGetSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets a single firewall rule in a specified redis cache. * * @summary Gets a single firewall rule in a specified redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleGet.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json */ async function redisCacheFirewallRuleGet() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/firewallRulesListSample.ts b/sdk/redis/arm-rediscache/samples-dev/firewallRulesListSample.ts index 1888acdda1c0..435d5a0c4425 100644 --- a/sdk/redis/arm-rediscache/samples-dev/firewallRulesListSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/firewallRulesListSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets all firewall rules in the specified redis cache. * * @summary Gets all firewall rules in the specified redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRulesList.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRulesList.json */ async function redisCacheFirewallRulesList() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/linkedServerCreateSample.ts b/sdk/redis/arm-rediscache/samples-dev/linkedServerCreateSample.ts index 94b7096c4087..824227f1d6a5 100644 --- a/sdk/redis/arm-rediscache/samples-dev/linkedServerCreateSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/linkedServerCreateSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Adds a linked server to the Redis cache (requires Premium SKU). * * @summary Adds a linked server to the Redis cache (requires Premium SKU). - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Create.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Create.json */ async function linkedServerCreate() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/linkedServerDeleteSample.ts b/sdk/redis/arm-rediscache/samples-dev/linkedServerDeleteSample.ts index af8ef58805ea..4e6dd2047ca3 100644 --- a/sdk/redis/arm-rediscache/samples-dev/linkedServerDeleteSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/linkedServerDeleteSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Deletes the linked server from a redis cache (requires Premium SKU). * * @summary Deletes the linked server from a redis cache (requires Premium SKU). - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Delete.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Delete.json */ async function linkedServerDelete() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/linkedServerGetSample.ts b/sdk/redis/arm-rediscache/samples-dev/linkedServerGetSample.ts index 3662f86b252c..0b24c5c2891a 100644 --- a/sdk/redis/arm-rediscache/samples-dev/linkedServerGetSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/linkedServerGetSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets the detailed information about a linked server of a redis cache (requires Premium SKU). * * @summary Gets the detailed information about a linked server of a redis cache (requires Premium SKU). - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Get.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json */ async function linkedServerGet() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/linkedServerListSample.ts b/sdk/redis/arm-rediscache/samples-dev/linkedServerListSample.ts index 12f9a5241b72..59bd7a605f74 100644 --- a/sdk/redis/arm-rediscache/samples-dev/linkedServerListSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/linkedServerListSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets the list of linked servers associated with this redis cache (requires Premium SKU). * * @summary Gets the list of linked servers associated with this redis cache (requires Premium SKU). - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_List.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_List.json */ async function linkedServerList() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/operationsListSample.ts b/sdk/redis/arm-rediscache/samples-dev/operationsListSample.ts index ca912db506c3..85013b62eae8 100644 --- a/sdk/redis/arm-rediscache/samples-dev/operationsListSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/operationsListSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Lists all of the available REST API operations of the Microsoft.Cache provider. * * @summary Lists all of the available REST API operations of the Microsoft.Cache provider. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheOperations.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheOperations.json */ async function redisCacheOperations() { const subscriptionId = diff --git a/sdk/redis/arm-rediscache/samples-dev/patchSchedulesCreateOrUpdateSample.ts b/sdk/redis/arm-rediscache/samples-dev/patchSchedulesCreateOrUpdateSample.ts index fa65002d1905..ce864cf7b462 100644 --- a/sdk/redis/arm-rediscache/samples-dev/patchSchedulesCreateOrUpdateSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/patchSchedulesCreateOrUpdateSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Create or replace the patching schedule for Redis cache. * * @summary Create or replace the patching schedule for Redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json */ async function redisCachePatchSchedulesCreateOrUpdate() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/patchSchedulesDeleteSample.ts b/sdk/redis/arm-rediscache/samples-dev/patchSchedulesDeleteSample.ts index b360543b1739..341731108c0d 100644 --- a/sdk/redis/arm-rediscache/samples-dev/patchSchedulesDeleteSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/patchSchedulesDeleteSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Deletes the patching schedule of a redis cache. * * @summary Deletes the patching schedule of a redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesDelete.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesDelete.json */ async function redisCachePatchSchedulesDelete() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/patchSchedulesGetSample.ts b/sdk/redis/arm-rediscache/samples-dev/patchSchedulesGetSample.ts index 386becbf0b88..50f64415751b 100644 --- a/sdk/redis/arm-rediscache/samples-dev/patchSchedulesGetSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/patchSchedulesGetSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets the patching schedule of a redis cache. * * @summary Gets the patching schedule of a redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesGet.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json */ async function redisCachePatchSchedulesGet() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/patchSchedulesListByRedisResourceSample.ts b/sdk/redis/arm-rediscache/samples-dev/patchSchedulesListByRedisResourceSample.ts index fc73a11732d4..8d032a085c8d 100644 --- a/sdk/redis/arm-rediscache/samples-dev/patchSchedulesListByRedisResourceSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/patchSchedulesListByRedisResourceSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets all patch schedules in the specified redis cache (there is only one). * * @summary Gets all patch schedules in the specified redis cache (there is only one). - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesList.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesList.json */ async function redisCachePatchSchedulesList() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsDeleteSample.ts b/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsDeleteSample.ts index fb82f2421bb2..d6d59ba78bd7 100644 --- a/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsDeleteSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsDeleteSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Deletes the specified private endpoint connection associated with the redis cache. * * @summary Deletes the specified private endpoint connection associated with the redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheDeletePrivateEndpointConnection.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDeletePrivateEndpointConnection.json */ async function redisCacheDeletePrivateEndpointConnection() { const subscriptionId = diff --git a/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsGetSample.ts b/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsGetSample.ts index 8d484ddb4615..70e944d144d1 100644 --- a/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsGetSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsGetSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets the specified private endpoint connection associated with the redis cache. * * @summary Gets the specified private endpoint connection associated with the redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGetPrivateEndpointConnection.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json */ async function redisCacheGetPrivateEndpointConnection() { const subscriptionId = diff --git a/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsListSample.ts b/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsListSample.ts index fdeef16ef602..80c9378a3e0e 100644 --- a/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsListSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsListSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to List all the private endpoint connections associated with the redis cache. * * @summary List all the private endpoint connections associated with the redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListPrivateEndpointConnections.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateEndpointConnections.json */ async function redisCacheListPrivateEndpointConnection() { const subscriptionId = diff --git a/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsPutSample.ts b/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsPutSample.ts index b7b0031b7473..5ae90cf3a6d8 100644 --- a/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsPutSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/privateEndpointConnectionsPutSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Update the state of specified private endpoint connection associated with the redis cache. * * @summary Update the state of specified private endpoint connection associated with the redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePutPrivateEndpointConnection.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePutPrivateEndpointConnection.json */ async function redisCachePutPrivateEndpointConnection() { const subscriptionId = diff --git a/sdk/redis/arm-rediscache/samples-dev/privateLinkResourcesListByRedisCacheSample.ts b/sdk/redis/arm-rediscache/samples-dev/privateLinkResourcesListByRedisCacheSample.ts index 039153168a92..ad47e3785d2b 100644 --- a/sdk/redis/arm-rediscache/samples-dev/privateLinkResourcesListByRedisCacheSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/privateLinkResourcesListByRedisCacheSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets the private link resources that need to be created for a redis cache. * * @summary Gets the private link resources that need to be created for a redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListPrivateLinkResources.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateLinkResources.json */ async function storageAccountListPrivateLinkResources() { const subscriptionId = diff --git a/sdk/redis/arm-rediscache/samples-dev/redisCheckNameAvailabilitySample.ts b/sdk/redis/arm-rediscache/samples-dev/redisCheckNameAvailabilitySample.ts index 7e9fa300f035..a86fbff84fea 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisCheckNameAvailabilitySample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisCheckNameAvailabilitySample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Checks that the redis cache name is valid and is not already in use. * * @summary Checks that the redis cache name is valid and is not already in use. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCheckNameAvailability.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCheckNameAvailability.json */ async function redisCacheCheckNameAvailability() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisCreateSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisCreateSample.ts index 025324762551..f8e85fb46d29 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisCreateSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisCreateSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreate.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreate.json */ async function redisCacheCreate() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; @@ -55,7 +55,7 @@ async function redisCacheCreate() { * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreateDefaultVersion.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateDefaultVersion.json */ async function redisCacheCreateDefaultVersion() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; @@ -88,7 +88,7 @@ async function redisCacheCreateDefaultVersion() { * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. * * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreateLatestVersion.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateLatestVersion.json */ async function redisCacheCreateLatestVersion() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisDeleteSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisDeleteSample.ts index 74a3a3bf24c0..a307c7fbbf5f 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisDeleteSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisDeleteSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Deletes a Redis cache. * * @summary Deletes a Redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheDelete.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDelete.json */ async function redisCacheDelete() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisExportDataSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisExportDataSample.ts index bacaf48082c6..4e72119975ec 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisExportDataSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisExportDataSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Export data from the redis cache to blobs in a container. * * @summary Export data from the redis cache to blobs in a container. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheExport.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheExport.json */ async function redisCacheExport() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisFlushCacheSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisFlushCacheSample.ts new file mode 100644 index 000000000000..451f7f458bba --- /dev/null +++ b/sdk/redis/arm-rediscache/samples-dev/redisFlushCacheSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes all of the keys in a cache. + * + * @summary Deletes all of the keys in a cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFlush.json + */ +async function redisCacheFlush() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || "subcription-id"; + const resourceGroupName = + process.env["REDIS_RESOURCE_GROUP"] || "resource-group-name"; + const cacheName = "cache-name"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginFlushCacheAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +async function main() { + redisCacheFlush(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples-dev/redisForceRebootSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisForceRebootSample.ts index 64e6cecf58d6..6e0988349438 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisForceRebootSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisForceRebootSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. * * @summary Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheForceReboot.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheForceReboot.json */ async function redisCacheForceReboot() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisGetSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisGetSample.ts index b2de1bb632b3..ebca43c2354f 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisGetSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisGetSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets a Redis cache (resource description). * * @summary Gets a Redis cache (resource description). - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGet.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json */ async function redisCacheGet() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisImportDataSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisImportDataSample.ts index a1f0da874d57..d8eb097b87b2 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisImportDataSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisImportDataSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Import data into Redis cache. * * @summary Import data into Redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheImport.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheImport.json */ async function redisCacheImport() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisListByResourceGroupSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisListByResourceGroupSample.ts index 7965dfb6caa7..3cd70415dd84 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisListByResourceGroupSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisListByResourceGroupSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Lists all Redis caches in a resource group. * * @summary Lists all Redis caches in a resource group. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListByResourceGroup.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListByResourceGroup.json */ async function redisCacheListByResourceGroup() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisListBySubscriptionSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisListBySubscriptionSample.ts index bc94deb61f47..c63ddf5689cb 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisListBySubscriptionSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisListBySubscriptionSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets all Redis caches in the specified subscription. * * @summary Gets all Redis caches in the specified subscription. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheList.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheList.json */ async function redisCacheList() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisListKeysSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisListKeysSample.ts index 70d6c906a923..fc26449af9d1 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisListKeysSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisListKeysSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. * * @summary Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListKeys.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListKeys.json */ async function redisCacheListKeys() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisListUpgradeNotificationsSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisListUpgradeNotificationsSample.ts index b541a2d0199b..dad85e489e89 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisListUpgradeNotificationsSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisListUpgradeNotificationsSample.ts @@ -18,7 +18,7 @@ dotenv.config(); * This sample demonstrates how to Gets any upgrade notifications for a Redis cache. * * @summary Gets any upgrade notifications for a Redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListUpgradeNotifications.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListUpgradeNotifications.json */ async function redisCacheListUpgradeNotifications() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisRegenerateKeySample.ts b/sdk/redis/arm-rediscache/samples-dev/redisRegenerateKeySample.ts index 40802b35758e..7d8f795953dc 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisRegenerateKeySample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisRegenerateKeySample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. * * @summary Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheRegenerateKey.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheRegenerateKey.json */ async function redisCacheRegenerateKey() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples-dev/redisUpdateSample.ts b/sdk/redis/arm-rediscache/samples-dev/redisUpdateSample.ts index 7fa161ac6bd3..0fb10345b240 100644 --- a/sdk/redis/arm-rediscache/samples-dev/redisUpdateSample.ts +++ b/sdk/redis/arm-rediscache/samples-dev/redisUpdateSample.ts @@ -21,7 +21,7 @@ dotenv.config(); * This sample demonstrates how to Update an existing Redis cache. * * @summary Update an existing Redis cache. - * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheUpdate.json + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheUpdate.json */ async function redisCacheUpdate() { const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/README.md b/sdk/redis/arm-rediscache/samples/v8/javascript/README.md new file mode 100644 index 000000000000..03fc31ad9c3b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/README.md @@ -0,0 +1,130 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [accessPolicyAssignmentCreateUpdateSample.js][accesspolicyassignmentcreateupdatesample] | Adds the access policy assignment to the specified users x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentCreateUpdate.json | +| [accessPolicyAssignmentDeleteSample.js][accesspolicyassignmentdeletesample] | Deletes the access policy assignment from a redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentDelete.json | +| [accessPolicyAssignmentGetSample.js][accesspolicyassignmentgetsample] | Gets the list of assignments for an access policy of a redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json | +| [accessPolicyAssignmentListSample.js][accesspolicyassignmentlistsample] | Gets the list of access policy assignments associated with this redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentList.json | +| [accessPolicyCreateUpdateSample.js][accesspolicycreateupdatesample] | Adds an access policy to the redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyCreateUpdate.json | +| [accessPolicyDeleteSample.js][accesspolicydeletesample] | Deletes the access policy from a redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyDelete.json | +| [accessPolicyGetSample.js][accesspolicygetsample] | Gets the detailed information about an access policy of a redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json | +| [accessPolicyListSample.js][accesspolicylistsample] | Gets the list of access policies associated with this redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyList.json | +| [asyncOperationStatusGetSample.js][asyncoperationstatusgetsample] | For checking the ongoing status of an operation x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAsyncOperationStatus.json | +| [firewallRulesCreateOrUpdateSample.js][firewallrulescreateorupdatesample] | Create or update a redis cache firewall rule x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleCreate.json | +| [firewallRulesDeleteSample.js][firewallrulesdeletesample] | Deletes a single firewall rule in a specified redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleDelete.json | +| [firewallRulesGetSample.js][firewallrulesgetsample] | Gets a single firewall rule in a specified redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json | +| [firewallRulesListSample.js][firewallruleslistsample] | Gets all firewall rules in the specified redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRulesList.json | +| [linkedServerCreateSample.js][linkedservercreatesample] | Adds a linked server to the Redis cache (requires Premium SKU). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Create.json | +| [linkedServerDeleteSample.js][linkedserverdeletesample] | Deletes the linked server from a redis cache (requires Premium SKU). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Delete.json | +| [linkedServerGetSample.js][linkedservergetsample] | Gets the detailed information about a linked server of a redis cache (requires Premium SKU). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json | +| [linkedServerListSample.js][linkedserverlistsample] | Gets the list of linked servers associated with this redis cache (requires Premium SKU). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_List.json | +| [operationsListSample.js][operationslistsample] | Lists all of the available REST API operations of the Microsoft.Cache provider. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheOperations.json | +| [patchSchedulesCreateOrUpdateSample.js][patchschedulescreateorupdatesample] | Create or replace the patching schedule for Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json | +| [patchSchedulesDeleteSample.js][patchschedulesdeletesample] | Deletes the patching schedule of a redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesDelete.json | +| [patchSchedulesGetSample.js][patchschedulesgetsample] | Gets the patching schedule of a redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json | +| [patchSchedulesListByRedisResourceSample.js][patchscheduleslistbyredisresourcesample] | Gets all patch schedules in the specified redis cache (there is only one). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesList.json | +| [privateEndpointConnectionsDeleteSample.js][privateendpointconnectionsdeletesample] | Deletes the specified private endpoint connection associated with the redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDeletePrivateEndpointConnection.json | +| [privateEndpointConnectionsGetSample.js][privateendpointconnectionsgetsample] | Gets the specified private endpoint connection associated with the redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json | +| [privateEndpointConnectionsListSample.js][privateendpointconnectionslistsample] | List all the private endpoint connections associated with the redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateEndpointConnections.json | +| [privateEndpointConnectionsPutSample.js][privateendpointconnectionsputsample] | Update the state of specified private endpoint connection associated with the redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePutPrivateEndpointConnection.json | +| [privateLinkResourcesListByRedisCacheSample.js][privatelinkresourceslistbyrediscachesample] | Gets the private link resources that need to be created for a redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateLinkResources.json | +| [redisCheckNameAvailabilitySample.js][redischecknameavailabilitysample] | Checks that the redis cache name is valid and is not already in use. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCheckNameAvailability.json | +| [redisCreateSample.js][rediscreatesample] | Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreate.json | +| [redisDeleteSample.js][redisdeletesample] | Deletes a Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDelete.json | +| [redisExportDataSample.js][redisexportdatasample] | Export data from the redis cache to blobs in a container. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheExport.json | +| [redisFlushCacheSample.js][redisflushcachesample] | Deletes all of the keys in a cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFlush.json | +| [redisForceRebootSample.js][redisforcerebootsample] | Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheForceReboot.json | +| [redisGetSample.js][redisgetsample] | Gets a Redis cache (resource description). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json | +| [redisImportDataSample.js][redisimportdatasample] | Import data into Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheImport.json | +| [redisListByResourceGroupSample.js][redislistbyresourcegroupsample] | Lists all Redis caches in a resource group. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListByResourceGroup.json | +| [redisListBySubscriptionSample.js][redislistbysubscriptionsample] | Gets all Redis caches in the specified subscription. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheList.json | +| [redisListKeysSample.js][redislistkeyssample] | Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListKeys.json | +| [redisListUpgradeNotificationsSample.js][redislistupgradenotificationssample] | Gets any upgrade notifications for a Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListUpgradeNotifications.json | +| [redisRegenerateKeySample.js][redisregeneratekeysample] | Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheRegenerateKey.json | +| [redisUpdateSample.js][redisupdatesample] | Update an existing Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheUpdate.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node accessPolicyAssignmentCreateUpdateSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env REDIS_SUBSCRIPTION_ID="" REDIS_RESOURCE_GROUP="" node accessPolicyAssignmentCreateUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accesspolicyassignmentcreateupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentCreateUpdateSample.js +[accesspolicyassignmentdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentDeleteSample.js +[accesspolicyassignmentgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentGetSample.js +[accesspolicyassignmentlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentListSample.js +[accesspolicycreateupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyCreateUpdateSample.js +[accesspolicydeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyDeleteSample.js +[accesspolicygetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyGetSample.js +[accesspolicylistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyListSample.js +[asyncoperationstatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/asyncOperationStatusGetSample.js +[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesCreateOrUpdateSample.js +[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesDeleteSample.js +[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesGetSample.js +[firewallruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesListSample.js +[linkedservercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerCreateSample.js +[linkedserverdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerDeleteSample.js +[linkedservergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerGetSample.js +[linkedserverlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerListSample.js +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/operationsListSample.js +[patchschedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesCreateOrUpdateSample.js +[patchschedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesDeleteSample.js +[patchschedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesGetSample.js +[patchscheduleslistbyredisresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesListByRedisResourceSample.js +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsDeleteSample.js +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsGetSample.js +[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsListSample.js +[privateendpointconnectionsputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsPutSample.js +[privatelinkresourceslistbyrediscachesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/privateLinkResourcesListByRedisCacheSample.js +[redischecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisCheckNameAvailabilitySample.js +[rediscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisCreateSample.js +[redisdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisDeleteSample.js +[redisexportdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisExportDataSample.js +[redisflushcachesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisFlushCacheSample.js +[redisforcerebootsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisForceRebootSample.js +[redisgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisGetSample.js +[redisimportdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisImportDataSample.js +[redislistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisListByResourceGroupSample.js +[redislistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisListBySubscriptionSample.js +[redislistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisListKeysSample.js +[redislistupgradenotificationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisListUpgradeNotificationsSample.js +[redisregeneratekeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisRegenerateKeySample.js +[redisupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/javascript/redisUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-rediscache?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/redis/arm-rediscache/README.md diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentCreateUpdateSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentCreateUpdateSample.js new file mode 100644 index 000000000000..31255a77e04e --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentCreateUpdateSample.js @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Adds the access policy assignment to the specified users + * + * @summary Adds the access policy assignment to the specified users + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentCreateUpdate.json + */ +async function redisCacheAccessPolicyAssignmentCreateUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const parameters = { + accessPolicyName: "accessPolicy1", + objectId: "6497c918-11ad-41e7-1b0f-7c518a87d0b0", + objectIdAlias: "TestAADAppRedis", + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.beginCreateUpdateAndWait( + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentCreateUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentDeleteSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentDeleteSample.js new file mode 100644 index 000000000000..6cc8840c12e1 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentDeleteSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the access policy assignment from a redis cache + * + * @summary Deletes the access policy assignment from a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentDelete.json + */ +async function redisCacheAccessPolicyAssignmentDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.beginDeleteAndWait( + resourceGroupName, + cacheName, + accessPolicyAssignmentName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentGetSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentGetSample.js new file mode 100644 index 000000000000..28696bc0abb2 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentGetSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the list of assignments for an access policy of a redis cache + * + * @summary Gets the list of assignments for an access policy of a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json + */ +async function redisCacheAccessPolicyAssignmentGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.get( + resourceGroupName, + cacheName, + accessPolicyAssignmentName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentListSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentListSample.js new file mode 100644 index 000000000000..7642edcac91b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyAssignmentListSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the list of access policy assignments associated with this redis cache + * + * @summary Gets the list of access policy assignments associated with this redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentList.json + */ +async function redisCacheAccessPolicyAssignmentList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accessPolicyAssignment.list(resourceGroupName, cacheName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheAccessPolicyAssignmentList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyCreateUpdateSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyCreateUpdateSample.js new file mode 100644 index 000000000000..5c7939f718ef --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyCreateUpdateSample.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Adds an access policy to the redis cache + * + * @summary Adds an access policy to the redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyCreateUpdate.json + */ +async function redisCacheAccessPolicyCreateUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const parameters = { permissions: "+get +hget" }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.beginCreateUpdateAndWait( + resourceGroupName, + cacheName, + accessPolicyName, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyCreateUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyDeleteSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyDeleteSample.js new file mode 100644 index 000000000000..5b4e1a51b0e4 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyDeleteSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the access policy from a redis cache + * + * @summary Deletes the access policy from a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyDelete.json + */ +async function redisCacheAccessPolicyDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.beginDeleteAndWait( + resourceGroupName, + cacheName, + accessPolicyName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyGetSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyGetSample.js new file mode 100644 index 000000000000..d0202fcc5005 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyGetSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the detailed information about an access policy of a redis cache + * + * @summary Gets the detailed information about an access policy of a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json + */ +async function redisCacheAccessPolicyGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.get(resourceGroupName, cacheName, accessPolicyName); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyListSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyListSample.js new file mode 100644 index 000000000000..b0c728627c9a --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/accessPolicyListSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the list of access policies associated with this redis cache + * + * @summary Gets the list of access policies associated with this redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyList.json + */ +async function redisCacheAccessPolicyList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accessPolicy.list(resourceGroupName, cacheName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheAccessPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/asyncOperationStatusGetSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/asyncOperationStatusGetSample.js new file mode 100644 index 000000000000..230717d8e521 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/asyncOperationStatusGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to For checking the ongoing status of an operation + * + * @summary For checking the ongoing status of an operation + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAsyncOperationStatus.json + */ +async function redisCacheAsyncOperationStatus() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const location = "East US"; + const operationId = "c7ba2bf5-5939-4d79-b037-2964ccf097da"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.asyncOperationStatus.get(location, operationId); + console.log(result); +} + +async function main() { + redisCacheAsyncOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesCreateOrUpdateSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..0657cbda1897 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesCreateOrUpdateSample.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or update a redis cache firewall rule + * + * @summary Create or update a redis cache firewall rule + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleCreate.json + */ +async function redisCacheFirewallRuleCreate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const ruleName = "rule1"; + const parameters = { + endIP: "192.168.1.4", + startIP: "192.168.1.1", + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.firewallRules.createOrUpdate( + resourceGroupName, + cacheName, + ruleName, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheFirewallRuleCreate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesDeleteSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesDeleteSample.js new file mode 100644 index 000000000000..6b9b6ac870f2 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesDeleteSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a single firewall rule in a specified redis cache. + * + * @summary Deletes a single firewall rule in a specified redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleDelete.json + */ +async function redisCacheFirewallRuleDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const ruleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.firewallRules.delete(resourceGroupName, cacheName, ruleName); + console.log(result); +} + +async function main() { + redisCacheFirewallRuleDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesGetSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesGetSample.js new file mode 100644 index 000000000000..0a16d7a43f92 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesGetSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a single firewall rule in a specified redis cache. + * + * @summary Gets a single firewall rule in a specified redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json + */ +async function redisCacheFirewallRuleGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const ruleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.firewallRules.get(resourceGroupName, cacheName, ruleName); + console.log(result); +} + +async function main() { + redisCacheFirewallRuleGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesListSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesListSample.js new file mode 100644 index 000000000000..ceda335d525e --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/firewallRulesListSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all firewall rules in the specified redis cache. + * + * @summary Gets all firewall rules in the specified redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRulesList.json + */ +async function redisCacheFirewallRulesList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.firewallRules.list(resourceGroupName, cacheName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheFirewallRulesList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerCreateSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerCreateSample.js new file mode 100644 index 000000000000..c56373eec35e --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerCreateSample.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Adds a linked server to the Redis cache (requires Premium SKU). + * + * @summary Adds a linked server to the Redis cache (requires Premium SKU). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Create.json + */ +async function linkedServerCreate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const linkedServerName = "cache2"; + const parameters = { + linkedRedisCacheId: + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache2", + linkedRedisCacheLocation: "West US", + serverRole: "Secondary", + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.linkedServer.beginCreateAndWait( + resourceGroupName, + name, + linkedServerName, + parameters + ); + console.log(result); +} + +async function main() { + linkedServerCreate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerDeleteSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerDeleteSample.js new file mode 100644 index 000000000000..da902be78ca1 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerDeleteSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the linked server from a redis cache (requires Premium SKU). + * + * @summary Deletes the linked server from a redis cache (requires Premium SKU). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Delete.json + */ +async function linkedServerDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const linkedServerName = "cache2"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.linkedServer.beginDeleteAndWait( + resourceGroupName, + name, + linkedServerName + ); + console.log(result); +} + +async function main() { + linkedServerDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerGetSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerGetSample.js new file mode 100644 index 000000000000..fca1bbeabb89 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerGetSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the detailed information about a linked server of a redis cache (requires Premium SKU). + * + * @summary Gets the detailed information about a linked server of a redis cache (requires Premium SKU). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json + */ +async function linkedServerGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const linkedServerName = "cache2"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.linkedServer.get(resourceGroupName, name, linkedServerName); + console.log(result); +} + +async function main() { + linkedServerGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerListSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerListSample.js new file mode 100644 index 000000000000..d4d4f63e2eab --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/linkedServerListSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the list of linked servers associated with this redis cache (requires Premium SKU). + * + * @summary Gets the list of linked servers associated with this redis cache (requires Premium SKU). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_List.json + */ +async function linkedServerList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.linkedServer.list(resourceGroupName, name)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + linkedServerList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/operationsListSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/operationsListSample.js new file mode 100644 index 000000000000..f88503dc7484 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/operationsListSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all of the available REST API operations of the Microsoft.Cache provider. + * + * @summary Lists all of the available REST API operations of the Microsoft.Cache provider. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheOperations.json + */ +async function redisCacheOperations() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheOperations(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/package.json b/sdk/redis/arm-rediscache/samples/v8/javascript/package.json new file mode 100644 index 000000000000..547a8cd9aeb4 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-rediscache-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/redis/arm-rediscache" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/redis/arm-rediscache", + "dependencies": { + "@azure/arm-rediscache": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesCreateOrUpdateSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesCreateOrUpdateSample.js new file mode 100644 index 000000000000..8ccc030110f6 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesCreateOrUpdateSample.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or replace the patching schedule for Redis cache. + * + * @summary Create or replace the patching schedule for Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json + */ +async function redisCachePatchSchedulesCreateOrUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const defaultParam = "default"; + const parameters = { + scheduleEntries: [ + { dayOfWeek: "Monday", maintenanceWindow: "PT5H", startHourUtc: 12 }, + { dayOfWeek: "Tuesday", startHourUtc: 12 }, + ], + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.patchSchedules.createOrUpdate( + resourceGroupName, + name, + defaultParam, + parameters + ); + console.log(result); +} + +async function main() { + redisCachePatchSchedulesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesDeleteSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesDeleteSample.js new file mode 100644 index 000000000000..136e11aa0e18 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesDeleteSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the patching schedule of a redis cache. + * + * @summary Deletes the patching schedule of a redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesDelete.json + */ +async function redisCachePatchSchedulesDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const defaultParam = "default"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.patchSchedules.delete(resourceGroupName, name, defaultParam); + console.log(result); +} + +async function main() { + redisCachePatchSchedulesDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesGetSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesGetSample.js new file mode 100644 index 000000000000..e88bc7085f28 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesGetSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the patching schedule of a redis cache. + * + * @summary Gets the patching schedule of a redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json + */ +async function redisCachePatchSchedulesGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const defaultParam = "default"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.patchSchedules.get(resourceGroupName, name, defaultParam); + console.log(result); +} + +async function main() { + redisCachePatchSchedulesGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesListByRedisResourceSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesListByRedisResourceSample.js new file mode 100644 index 000000000000..c6d3dfc9ae5c --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/patchSchedulesListByRedisResourceSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all patch schedules in the specified redis cache (there is only one). + * + * @summary Gets all patch schedules in the specified redis cache (there is only one). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesList.json + */ +async function redisCachePatchSchedulesList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.patchSchedules.listByRedisResource(resourceGroupName, cacheName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCachePatchSchedulesList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsDeleteSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsDeleteSample.js new file mode 100644 index 000000000000..9d6beb6e86f3 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsDeleteSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes the specified private endpoint connection associated with the redis cache. + * + * @summary Deletes the specified private endpoint connection associated with the redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDeletePrivateEndpointConnection.json + */ +async function redisCacheDeletePrivateEndpointConnection() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cachetest01"; + const privateEndpointConnectionName = "pectest01"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.delete( + resourceGroupName, + cacheName, + privateEndpointConnectionName + ); + console.log(result); +} + +async function main() { + redisCacheDeletePrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsGetSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsGetSample.js new file mode 100644 index 000000000000..175ab5bfa738 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsGetSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the specified private endpoint connection associated with the redis cache. + * + * @summary Gets the specified private endpoint connection associated with the redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json + */ +async function redisCacheGetPrivateEndpointConnection() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cachetest01"; + const privateEndpointConnectionName = "pectest01"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + cacheName, + privateEndpointConnectionName + ); + console.log(result); +} + +async function main() { + redisCacheGetPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsListSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsListSample.js new file mode 100644 index 000000000000..4884c0e246b9 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsListSample.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to List all the private endpoint connections associated with the redis cache. + * + * @summary List all the private endpoint connections associated with the redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateEndpointConnections.json + */ +async function redisCacheListPrivateEndpointConnection() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cachetest01"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.list(resourceGroupName, cacheName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheListPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsPutSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsPutSample.js new file mode 100644 index 000000000000..c3b1d61774a4 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/privateEndpointConnectionsPutSample.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Update the state of specified private endpoint connection associated with the redis cache. + * + * @summary Update the state of specified private endpoint connection associated with the redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePutPrivateEndpointConnection.json + */ +async function redisCachePutPrivateEndpointConnection() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cachetest01"; + const privateEndpointConnectionName = "pectest01"; + const properties = { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginPutAndWait( + resourceGroupName, + cacheName, + privateEndpointConnectionName, + properties + ); + console.log(result); +} + +async function main() { + redisCachePutPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/privateLinkResourcesListByRedisCacheSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/privateLinkResourcesListByRedisCacheSample.js new file mode 100644 index 000000000000..427f5a843e85 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/privateLinkResourcesListByRedisCacheSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets the private link resources that need to be created for a redis cache. + * + * @summary Gets the private link resources that need to be created for a redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateLinkResources.json + */ +async function storageAccountListPrivateLinkResources() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cacheTest01"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResources.listByRedisCache( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + storageAccountListPrivateLinkResources(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisCheckNameAvailabilitySample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisCheckNameAvailabilitySample.js new file mode 100644 index 000000000000..ff218fec6357 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisCheckNameAvailabilitySample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Checks that the redis cache name is valid and is not already in use. + * + * @summary Checks that the redis cache name is valid and is not already in use. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCheckNameAvailability.json + */ +async function redisCacheCheckNameAvailability() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const parameters = { + name: "cacheName", + type: "Microsoft.Cache/Redis", + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.checkNameAvailability(parameters); + console.log(result); +} + +async function main() { + redisCacheCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisCreateSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisCreateSample.js new file mode 100644 index 000000000000..5e8a4da57d2a --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisCreateSample.js @@ -0,0 +1,110 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * + * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreate.json + */ +async function redisCacheCreate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters = { + enableNonSslPort: true, + location: "West US", + minimumTlsVersion: "1.2", + redisConfiguration: { maxmemoryPolicy: "allkeys-lru" }, + redisVersion: "4", + replicasPerPrimary: 2, + shardCount: 2, + sku: { name: "Premium", capacity: 1, family: "P" }, + staticIP: "192.168.0.5", + subnetId: + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1", + zones: ["1"], + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters); + console.log(result); +} + +/** + * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * + * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateDefaultVersion.json + */ +async function redisCacheCreateDefaultVersion() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters = { + enableNonSslPort: true, + location: "West US", + minimumTlsVersion: "1.2", + redisConfiguration: { maxmemoryPolicy: "allkeys-lru" }, + replicasPerPrimary: 2, + shardCount: 2, + sku: { name: "Premium", capacity: 1, family: "P" }, + staticIP: "192.168.0.5", + subnetId: + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1", + zones: ["1"], + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters); + console.log(result); +} + +/** + * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * + * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateLatestVersion.json + */ +async function redisCacheCreateLatestVersion() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters = { + enableNonSslPort: true, + location: "West US", + minimumTlsVersion: "1.2", + redisConfiguration: { maxmemoryPolicy: "allkeys-lru" }, + redisVersion: "Latest", + replicasPerPrimary: 2, + shardCount: 2, + sku: { name: "Premium", capacity: 1, family: "P" }, + staticIP: "192.168.0.5", + subnetId: + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1", + zones: ["1"], + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginCreateAndWait(resourceGroupName, name, parameters); + console.log(result); +} + +async function main() { + redisCacheCreate(); + redisCacheCreateDefaultVersion(); + redisCacheCreateLatestVersion(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisDeleteSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisDeleteSample.js new file mode 100644 index 000000000000..025dc4a944e9 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisDeleteSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes a Redis cache. + * + * @summary Deletes a Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDelete.json + */ +async function redisCacheDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginDeleteAndWait(resourceGroupName, name); + console.log(result); +} + +async function main() { + redisCacheDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisExportDataSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisExportDataSample.js new file mode 100644 index 000000000000..8ba15a20a7de --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisExportDataSample.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Export data from the redis cache to blobs in a container. + * + * @summary Export data from the redis cache to blobs in a container. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheExport.json + */ +async function redisCacheExport() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters = { + format: "RDB", + container: "https://contosostorage.blob.core.window.net/urltoBlobContainer?sasKeyParameters", + prefix: "datadump1", + storageSubscriptionId: "storageSubId", + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginExportDataAndWait(resourceGroupName, name, parameters); + console.log(result); +} + +async function main() { + redisCacheExport(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisFlushCacheSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisFlushCacheSample.js new file mode 100644 index 000000000000..c50afdaa77d6 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisFlushCacheSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Deletes all of the keys in a cache. + * + * @summary Deletes all of the keys in a cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFlush.json + */ +async function redisCacheFlush() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subcription-id"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "resource-group-name"; + const cacheName = "cache-name"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginFlushCacheAndWait(resourceGroupName, cacheName); + console.log(result); +} + +async function main() { + redisCacheFlush(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisForceRebootSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisForceRebootSample.js new file mode 100644 index 000000000000..aee6a6a02ee4 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisForceRebootSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. + * + * @summary Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheForceReboot.json + */ +async function redisCacheForceReboot() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters = { + ports: [13000, 15001], + rebootType: "AllNodes", + shardId: 0, + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.forceReboot(resourceGroupName, name, parameters); + console.log(result); +} + +async function main() { + redisCacheForceReboot(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisGetSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisGetSample.js new file mode 100644 index 000000000000..d5acb3bb6a10 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets a Redis cache (resource description). + * + * @summary Gets a Redis cache (resource description). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json + */ +async function redisCacheGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.get(resourceGroupName, name); + console.log(result); +} + +async function main() { + redisCacheGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisImportDataSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisImportDataSample.js new file mode 100644 index 000000000000..ec2602e9215f --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisImportDataSample.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Import data into Redis cache. + * + * @summary Import data into Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheImport.json + */ +async function redisCacheImport() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters = { + format: "RDB", + files: ["http://fileuris.contoso.com/pathtofile1"], + storageSubscriptionId: "storageSubId", + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginImportDataAndWait(resourceGroupName, name, parameters); + console.log(result); +} + +async function main() { + redisCacheImport(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisListByResourceGroupSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisListByResourceGroupSample.js new file mode 100644 index 000000000000..f71cd8ea5954 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisListByResourceGroupSample.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Lists all Redis caches in a resource group. + * + * @summary Lists all Redis caches in a resource group. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListByResourceGroup.json + */ +async function redisCacheListByResourceGroup() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.redis.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheListByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisListBySubscriptionSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisListBySubscriptionSample.js new file mode 100644 index 000000000000..99076ec14f35 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisListBySubscriptionSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets all Redis caches in the specified subscription. + * + * @summary Gets all Redis caches in the specified subscription. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheList.json + */ +async function redisCacheList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.redis.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisListKeysSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisListKeysSample.js new file mode 100644 index 000000000000..62a8eb4df8e5 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisListKeysSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. + * + * @summary Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListKeys.json + */ +async function redisCacheListKeys() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.listKeys(resourceGroupName, name); + console.log(result); +} + +async function main() { + redisCacheListKeys(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisListUpgradeNotificationsSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisListUpgradeNotificationsSample.js new file mode 100644 index 000000000000..4aa013bcb51f --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisListUpgradeNotificationsSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Gets any upgrade notifications for a Redis cache. + * + * @summary Gets any upgrade notifications for a Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListUpgradeNotifications.json + */ +async function redisCacheListUpgradeNotifications() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const history = 5000; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.redis.listUpgradeNotifications(resourceGroupName, name, history)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheListUpgradeNotifications(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisRegenerateKeySample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisRegenerateKeySample.js new file mode 100644 index 000000000000..e207446113b9 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisRegenerateKeySample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. + * + * @summary Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheRegenerateKey.json + */ +async function redisCacheRegenerateKey() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters = { keyType: "Primary" }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.regenerateKey(resourceGroupName, name, parameters); + console.log(result); +} + +async function main() { + redisCacheRegenerateKey(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/redisUpdateSample.js b/sdk/redis/arm-rediscache/samples/v8/javascript/redisUpdateSample.js new file mode 100644 index 000000000000..7e9497e3d73b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/redisUpdateSample.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { RedisManagementClient } = require("@azure/arm-rediscache"); +const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); + +/** + * This sample demonstrates how to Update an existing Redis cache. + * + * @summary Update an existing Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheUpdate.json + */ +async function redisCacheUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters = { + enableNonSslPort: true, + replicasPerPrimary: 2, + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginUpdateAndWait(resourceGroupName, name, parameters); + console.log(result); +} + +async function main() { + redisCacheUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/javascript/sample.env b/sdk/redis/arm-rediscache/samples/v8/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/README.md b/sdk/redis/arm-rediscache/samples/v8/typescript/README.md new file mode 100644 index 000000000000..1462c7184de1 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/README.md @@ -0,0 +1,143 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [accessPolicyAssignmentCreateUpdateSample.ts][accesspolicyassignmentcreateupdatesample] | Adds the access policy assignment to the specified users x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentCreateUpdate.json | +| [accessPolicyAssignmentDeleteSample.ts][accesspolicyassignmentdeletesample] | Deletes the access policy assignment from a redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentDelete.json | +| [accessPolicyAssignmentGetSample.ts][accesspolicyassignmentgetsample] | Gets the list of assignments for an access policy of a redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json | +| [accessPolicyAssignmentListSample.ts][accesspolicyassignmentlistsample] | Gets the list of access policy assignments associated with this redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentList.json | +| [accessPolicyCreateUpdateSample.ts][accesspolicycreateupdatesample] | Adds an access policy to the redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyCreateUpdate.json | +| [accessPolicyDeleteSample.ts][accesspolicydeletesample] | Deletes the access policy from a redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyDelete.json | +| [accessPolicyGetSample.ts][accesspolicygetsample] | Gets the detailed information about an access policy of a redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json | +| [accessPolicyListSample.ts][accesspolicylistsample] | Gets the list of access policies associated with this redis cache x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyList.json | +| [asyncOperationStatusGetSample.ts][asyncoperationstatusgetsample] | For checking the ongoing status of an operation x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAsyncOperationStatus.json | +| [firewallRulesCreateOrUpdateSample.ts][firewallrulescreateorupdatesample] | Create or update a redis cache firewall rule x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleCreate.json | +| [firewallRulesDeleteSample.ts][firewallrulesdeletesample] | Deletes a single firewall rule in a specified redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleDelete.json | +| [firewallRulesGetSample.ts][firewallrulesgetsample] | Gets a single firewall rule in a specified redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json | +| [firewallRulesListSample.ts][firewallruleslistsample] | Gets all firewall rules in the specified redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRulesList.json | +| [linkedServerCreateSample.ts][linkedservercreatesample] | Adds a linked server to the Redis cache (requires Premium SKU). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Create.json | +| [linkedServerDeleteSample.ts][linkedserverdeletesample] | Deletes the linked server from a redis cache (requires Premium SKU). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Delete.json | +| [linkedServerGetSample.ts][linkedservergetsample] | Gets the detailed information about a linked server of a redis cache (requires Premium SKU). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json | +| [linkedServerListSample.ts][linkedserverlistsample] | Gets the list of linked servers associated with this redis cache (requires Premium SKU). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_List.json | +| [operationsListSample.ts][operationslistsample] | Lists all of the available REST API operations of the Microsoft.Cache provider. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheOperations.json | +| [patchSchedulesCreateOrUpdateSample.ts][patchschedulescreateorupdatesample] | Create or replace the patching schedule for Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json | +| [patchSchedulesDeleteSample.ts][patchschedulesdeletesample] | Deletes the patching schedule of a redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesDelete.json | +| [patchSchedulesGetSample.ts][patchschedulesgetsample] | Gets the patching schedule of a redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json | +| [patchSchedulesListByRedisResourceSample.ts][patchscheduleslistbyredisresourcesample] | Gets all patch schedules in the specified redis cache (there is only one). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesList.json | +| [privateEndpointConnectionsDeleteSample.ts][privateendpointconnectionsdeletesample] | Deletes the specified private endpoint connection associated with the redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDeletePrivateEndpointConnection.json | +| [privateEndpointConnectionsGetSample.ts][privateendpointconnectionsgetsample] | Gets the specified private endpoint connection associated with the redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json | +| [privateEndpointConnectionsListSample.ts][privateendpointconnectionslistsample] | List all the private endpoint connections associated with the redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateEndpointConnections.json | +| [privateEndpointConnectionsPutSample.ts][privateendpointconnectionsputsample] | Update the state of specified private endpoint connection associated with the redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePutPrivateEndpointConnection.json | +| [privateLinkResourcesListByRedisCacheSample.ts][privatelinkresourceslistbyrediscachesample] | Gets the private link resources that need to be created for a redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateLinkResources.json | +| [redisCheckNameAvailabilitySample.ts][redischecknameavailabilitysample] | Checks that the redis cache name is valid and is not already in use. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCheckNameAvailability.json | +| [redisCreateSample.ts][rediscreatesample] | Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreate.json | +| [redisDeleteSample.ts][redisdeletesample] | Deletes a Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDelete.json | +| [redisExportDataSample.ts][redisexportdatasample] | Export data from the redis cache to blobs in a container. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheExport.json | +| [redisFlushCacheSample.ts][redisflushcachesample] | Deletes all of the keys in a cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFlush.json | +| [redisForceRebootSample.ts][redisforcerebootsample] | Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheForceReboot.json | +| [redisGetSample.ts][redisgetsample] | Gets a Redis cache (resource description). x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json | +| [redisImportDataSample.ts][redisimportdatasample] | Import data into Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheImport.json | +| [redisListByResourceGroupSample.ts][redislistbyresourcegroupsample] | Lists all Redis caches in a resource group. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListByResourceGroup.json | +| [redisListBySubscriptionSample.ts][redislistbysubscriptionsample] | Gets all Redis caches in the specified subscription. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheList.json | +| [redisListKeysSample.ts][redislistkeyssample] | Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListKeys.json | +| [redisListUpgradeNotificationsSample.ts][redislistupgradenotificationssample] | Gets any upgrade notifications for a Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListUpgradeNotifications.json | +| [redisRegenerateKeySample.ts][redisregeneratekeysample] | Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheRegenerateKey.json | +| [redisUpdateSample.ts][redisupdatesample] | Update an existing Redis cache. x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheUpdate.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/accessPolicyAssignmentCreateUpdateSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env REDIS_SUBSCRIPTION_ID="" REDIS_RESOURCE_GROUP="" node dist/accessPolicyAssignmentCreateUpdateSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accesspolicyassignmentcreateupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentCreateUpdateSample.ts +[accesspolicyassignmentdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentDeleteSample.ts +[accesspolicyassignmentgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentGetSample.ts +[accesspolicyassignmentlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentListSample.ts +[accesspolicycreateupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyCreateUpdateSample.ts +[accesspolicydeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyDeleteSample.ts +[accesspolicygetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyGetSample.ts +[accesspolicylistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyListSample.ts +[asyncoperationstatusgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/asyncOperationStatusGetSample.ts +[firewallrulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesCreateOrUpdateSample.ts +[firewallrulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesDeleteSample.ts +[firewallrulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesGetSample.ts +[firewallruleslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesListSample.ts +[linkedservercreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerCreateSample.ts +[linkedserverdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerDeleteSample.ts +[linkedservergetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerGetSample.ts +[linkedserverlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerListSample.ts +[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/operationsListSample.ts +[patchschedulescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesCreateOrUpdateSample.ts +[patchschedulesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesDeleteSample.ts +[patchschedulesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesGetSample.ts +[patchscheduleslistbyredisresourcesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesListByRedisResourceSample.ts +[privateendpointconnectionsdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsDeleteSample.ts +[privateendpointconnectionsgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsGetSample.ts +[privateendpointconnectionslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsListSample.ts +[privateendpointconnectionsputsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsPutSample.ts +[privatelinkresourceslistbyrediscachesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateLinkResourcesListByRedisCacheSample.ts +[redischecknameavailabilitysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisCheckNameAvailabilitySample.ts +[rediscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisCreateSample.ts +[redisdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisDeleteSample.ts +[redisexportdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisExportDataSample.ts +[redisflushcachesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisFlushCacheSample.ts +[redisforcerebootsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisForceRebootSample.ts +[redisgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisGetSample.ts +[redisimportdatasample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisImportDataSample.ts +[redislistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListByResourceGroupSample.ts +[redislistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListBySubscriptionSample.ts +[redislistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListKeysSample.ts +[redislistupgradenotificationssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListUpgradeNotificationsSample.ts +[redisregeneratekeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisRegenerateKeySample.ts +[redisupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-rediscache?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/redis/arm-rediscache/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/package.json b/sdk/redis/arm-rediscache/samples/v8/typescript/package.json new file mode 100644 index 000000000000..3b83caa21cb9 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-rediscache-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/redis/arm-rediscache" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/redis/arm-rediscache", + "dependencies": { + "@azure/arm-rediscache": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~5.0.0", + "rimraf": "latest" + } +} diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/sample.env b/sdk/redis/arm-rediscache/samples/v8/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentCreateUpdateSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentCreateUpdateSample.ts new file mode 100644 index 000000000000..2aa884aa1371 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentCreateUpdateSample.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisCacheAccessPolicyAssignment, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Adds the access policy assignment to the specified users + * + * @summary Adds the access policy assignment to the specified users + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentCreateUpdate.json + */ +async function redisCacheAccessPolicyAssignmentCreateUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const parameters: RedisCacheAccessPolicyAssignment = { + accessPolicyName: "accessPolicy1", + objectId: "6497c918-11ad-41e7-1b0f-7c518a87d0b0", + objectIdAlias: "TestAADAppRedis" + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.beginCreateUpdateAndWait( + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentCreateUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentDeleteSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentDeleteSample.ts new file mode 100644 index 000000000000..56894112b57b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the access policy assignment from a redis cache + * + * @summary Deletes the access policy assignment from a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentDelete.json + */ +async function redisCacheAccessPolicyAssignmentDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.beginDeleteAndWait( + resourceGroupName, + cacheName, + accessPolicyAssignmentName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentGetSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentGetSample.ts new file mode 100644 index 000000000000..e663525b051b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentGetSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of assignments for an access policy of a redis cache + * + * @summary Gets the list of assignments for an access policy of a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json + */ +async function redisCacheAccessPolicyAssignmentGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicyAssignment.get( + resourceGroupName, + cacheName, + accessPolicyAssignmentName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyAssignmentGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentListSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentListSample.ts new file mode 100644 index 000000000000..40596c9d0b78 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyAssignmentListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of access policy assignments associated with this redis cache + * + * @summary Gets the list of access policy assignments associated with this redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentList.json + */ +async function redisCacheAccessPolicyAssignmentList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accessPolicyAssignment.list( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheAccessPolicyAssignmentList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyCreateUpdateSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyCreateUpdateSample.ts new file mode 100644 index 000000000000..b8220fb1c506 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyCreateUpdateSample.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisCacheAccessPolicy, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Adds an access policy to the redis cache + * + * @summary Adds an access policy to the redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyCreateUpdate.json + */ +async function redisCacheAccessPolicyCreateUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const parameters: RedisCacheAccessPolicy = { permissions: "+get +hget" }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.beginCreateUpdateAndWait( + resourceGroupName, + cacheName, + accessPolicyName, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyCreateUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyDeleteSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyDeleteSample.ts new file mode 100644 index 000000000000..6670a99d6034 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the access policy from a redis cache + * + * @summary Deletes the access policy from a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyDelete.json + */ +async function redisCacheAccessPolicyDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.beginDeleteAndWait( + resourceGroupName, + cacheName, + accessPolicyName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyGetSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyGetSample.ts new file mode 100644 index 000000000000..fea6cf1699f7 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyGetSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the detailed information about an access policy of a redis cache + * + * @summary Gets the detailed information about an access policy of a redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json + */ +async function redisCacheAccessPolicyGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const accessPolicyName = "accessPolicy1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.accessPolicy.get( + resourceGroupName, + cacheName, + accessPolicyName + ); + console.log(result); +} + +async function main() { + redisCacheAccessPolicyGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyListSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyListSample.ts new file mode 100644 index 000000000000..d9a9c75fc9ea --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/accessPolicyListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of access policies associated with this redis cache + * + * @summary Gets the list of access policies associated with this redis cache + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyList.json + */ +async function redisCacheAccessPolicyList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.accessPolicy.list( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheAccessPolicyList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/asyncOperationStatusGetSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/asyncOperationStatusGetSample.ts new file mode 100644 index 000000000000..841cc1d03734 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/asyncOperationStatusGetSample.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to For checking the ongoing status of an operation + * + * @summary For checking the ongoing status of an operation + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAsyncOperationStatus.json + */ +async function redisCacheAsyncOperationStatus() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const location = "East US"; + const operationId = "c7ba2bf5-5939-4d79-b037-2964ccf097da"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.asyncOperationStatus.get(location, operationId); + console.log(result); +} + +async function main() { + redisCacheAsyncOperationStatus(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesCreateOrUpdateSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..4916cb01c60f --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesCreateOrUpdateSample.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisFirewallRule, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or update a redis cache firewall rule + * + * @summary Create or update a redis cache firewall rule + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleCreate.json + */ +async function redisCacheFirewallRuleCreate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const ruleName = "rule1"; + const parameters: RedisFirewallRule = { + endIP: "192.168.1.4", + startIP: "192.168.1.1" + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.firewallRules.createOrUpdate( + resourceGroupName, + cacheName, + ruleName, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheFirewallRuleCreate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesDeleteSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesDeleteSample.ts new file mode 100644 index 000000000000..73f3bec5e66c --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a single firewall rule in a specified redis cache. + * + * @summary Deletes a single firewall rule in a specified redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleDelete.json + */ +async function redisCacheFirewallRuleDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const ruleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.firewallRules.delete( + resourceGroupName, + cacheName, + ruleName + ); + console.log(result); +} + +async function main() { + redisCacheFirewallRuleDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesGetSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesGetSample.ts new file mode 100644 index 000000000000..a0faaccc074f --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesGetSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a single firewall rule in a specified redis cache. + * + * @summary Gets a single firewall rule in a specified redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json + */ +async function redisCacheFirewallRuleGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const ruleName = "rule1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.firewallRules.get( + resourceGroupName, + cacheName, + ruleName + ); + console.log(result); +} + +async function main() { + redisCacheFirewallRuleGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesListSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesListSample.ts new file mode 100644 index 000000000000..435d5a0c4425 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/firewallRulesListSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all firewall rules in the specified redis cache. + * + * @summary Gets all firewall rules in the specified redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRulesList.json + */ +async function redisCacheFirewallRulesList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.firewallRules.list( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheFirewallRulesList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerCreateSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerCreateSample.ts new file mode 100644 index 000000000000..824227f1d6a5 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerCreateSample.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisLinkedServerCreateParameters, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Adds a linked server to the Redis cache (requires Premium SKU). + * + * @summary Adds a linked server to the Redis cache (requires Premium SKU). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Create.json + */ +async function linkedServerCreate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const linkedServerName = "cache2"; + const parameters: RedisLinkedServerCreateParameters = { + linkedRedisCacheId: + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache2", + linkedRedisCacheLocation: "West US", + serverRole: "Secondary" + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.linkedServer.beginCreateAndWait( + resourceGroupName, + name, + linkedServerName, + parameters + ); + console.log(result); +} + +async function main() { + linkedServerCreate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerDeleteSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerDeleteSample.ts new file mode 100644 index 000000000000..4e6dd2047ca3 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the linked server from a redis cache (requires Premium SKU). + * + * @summary Deletes the linked server from a redis cache (requires Premium SKU). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Delete.json + */ +async function linkedServerDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const linkedServerName = "cache2"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.linkedServer.beginDeleteAndWait( + resourceGroupName, + name, + linkedServerName + ); + console.log(result); +} + +async function main() { + linkedServerDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerGetSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerGetSample.ts new file mode 100644 index 000000000000..0b24c5c2891a --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerGetSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the detailed information about a linked server of a redis cache (requires Premium SKU). + * + * @summary Gets the detailed information about a linked server of a redis cache (requires Premium SKU). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json + */ +async function linkedServerGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const linkedServerName = "cache2"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.linkedServer.get( + resourceGroupName, + name, + linkedServerName + ); + console.log(result); +} + +async function main() { + linkedServerGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerListSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerListSample.ts new file mode 100644 index 000000000000..59bd7a605f74 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/linkedServerListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the list of linked servers associated with this redis cache (requires Premium SKU). + * + * @summary Gets the list of linked servers associated with this redis cache (requires Premium SKU). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_List.json + */ +async function linkedServerList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.linkedServer.list(resourceGroupName, name)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + linkedServerList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/operationsListSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/operationsListSample.ts new file mode 100644 index 000000000000..85013b62eae8 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/operationsListSample.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all of the available REST API operations of the Microsoft.Cache provider. + * + * @summary Lists all of the available REST API operations of the Microsoft.Cache provider. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheOperations.json + */ +async function redisCacheOperations() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || + "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheOperations(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesCreateOrUpdateSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesCreateOrUpdateSample.ts new file mode 100644 index 000000000000..ce864cf7b462 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesCreateOrUpdateSample.ts @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisPatchSchedule, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or replace the patching schedule for Redis cache. + * + * @summary Create or replace the patching schedule for Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json + */ +async function redisCachePatchSchedulesCreateOrUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const defaultParam = "default"; + const parameters: RedisPatchSchedule = { + scheduleEntries: [ + { dayOfWeek: "Monday", maintenanceWindow: "PT5H", startHourUtc: 12 }, + { dayOfWeek: "Tuesday", startHourUtc: 12 } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.patchSchedules.createOrUpdate( + resourceGroupName, + name, + defaultParam, + parameters + ); + console.log(result); +} + +async function main() { + redisCachePatchSchedulesCreateOrUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesDeleteSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesDeleteSample.ts new file mode 100644 index 000000000000..341731108c0d --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesDeleteSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the patching schedule of a redis cache. + * + * @summary Deletes the patching schedule of a redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesDelete.json + */ +async function redisCachePatchSchedulesDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const defaultParam = "default"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.patchSchedules.delete( + resourceGroupName, + name, + defaultParam + ); + console.log(result); +} + +async function main() { + redisCachePatchSchedulesDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesGetSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesGetSample.ts new file mode 100644 index 000000000000..50f64415751b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesGetSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the patching schedule of a redis cache. + * + * @summary Gets the patching schedule of a redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json + */ +async function redisCachePatchSchedulesGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const defaultParam = "default"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.patchSchedules.get( + resourceGroupName, + name, + defaultParam + ); + console.log(result); +} + +async function main() { + redisCachePatchSchedulesGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesListByRedisResourceSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesListByRedisResourceSample.ts new file mode 100644 index 000000000000..8d032a085c8d --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/patchSchedulesListByRedisResourceSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all patch schedules in the specified redis cache (there is only one). + * + * @summary Gets all patch schedules in the specified redis cache (there is only one). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesList.json + */ +async function redisCachePatchSchedulesList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const cacheName = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.patchSchedules.listByRedisResource( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCachePatchSchedulesList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsDeleteSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsDeleteSample.ts new file mode 100644 index 000000000000..d6d59ba78bd7 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsDeleteSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes the specified private endpoint connection associated with the redis cache. + * + * @summary Deletes the specified private endpoint connection associated with the redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDeletePrivateEndpointConnection.json + */ +async function redisCacheDeletePrivateEndpointConnection() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cachetest01"; + const privateEndpointConnectionName = "pectest01"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.delete( + resourceGroupName, + cacheName, + privateEndpointConnectionName + ); + console.log(result); +} + +async function main() { + redisCacheDeletePrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsGetSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsGetSample.ts new file mode 100644 index 000000000000..70e944d144d1 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsGetSample.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the specified private endpoint connection associated with the redis cache. + * + * @summary Gets the specified private endpoint connection associated with the redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json + */ +async function redisCacheGetPrivateEndpointConnection() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cachetest01"; + const privateEndpointConnectionName = "pectest01"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + cacheName, + privateEndpointConnectionName + ); + console.log(result); +} + +async function main() { + redisCacheGetPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsListSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsListSample.ts new file mode 100644 index 000000000000..80c9378a3e0e --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsListSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to List all the private endpoint connections associated with the redis cache. + * + * @summary List all the private endpoint connections associated with the redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateEndpointConnections.json + */ +async function redisCacheListPrivateEndpointConnection() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cachetest01"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.list( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheListPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsPutSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsPutSample.ts new file mode 100644 index 000000000000..5ae90cf3a6d8 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateEndpointConnectionsPutSample.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + PrivateEndpointConnection, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update the state of specified private endpoint connection associated with the redis cache. + * + * @summary Update the state of specified private endpoint connection associated with the redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePutPrivateEndpointConnection.json + */ +async function redisCachePutPrivateEndpointConnection() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || "{subscriptionId}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cachetest01"; + const privateEndpointConnectionName = "pectest01"; + const properties: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginPutAndWait( + resourceGroupName, + cacheName, + privateEndpointConnectionName, + properties + ); + console.log(result); +} + +async function main() { + redisCachePutPrivateEndpointConnection(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateLinkResourcesListByRedisCacheSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateLinkResourcesListByRedisCacheSample.ts new file mode 100644 index 000000000000..ad47e3785d2b --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/privateLinkResourcesListByRedisCacheSample.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets the private link resources that need to be created for a redis cache. + * + * @summary Gets the private link resources that need to be created for a redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateLinkResources.json + */ +async function storageAccountListPrivateLinkResources() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || "{subscription-id}"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rgtest01"; + const cacheName = "cacheTest01"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateLinkResources.listByRedisCache( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + storageAccountListPrivateLinkResources(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisCheckNameAvailabilitySample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisCheckNameAvailabilitySample.ts new file mode 100644 index 000000000000..a86fbff84fea --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisCheckNameAvailabilitySample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + CheckNameAvailabilityParameters, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Checks that the redis cache name is valid and is not already in use. + * + * @summary Checks that the redis cache name is valid and is not already in use. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCheckNameAvailability.json + */ +async function redisCacheCheckNameAvailability() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const parameters: CheckNameAvailabilityParameters = { + name: "cacheName", + type: "Microsoft.Cache/Redis" + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.checkNameAvailability(parameters); + console.log(result); +} + +async function main() { + redisCacheCheckNameAvailability(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisCreateSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisCreateSample.ts new file mode 100644 index 000000000000..f8e85fb46d29 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisCreateSample.ts @@ -0,0 +1,127 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisCreateParameters, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * + * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreate.json + */ +async function redisCacheCreate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters: RedisCreateParameters = { + enableNonSslPort: true, + location: "West US", + minimumTlsVersion: "1.2", + redisConfiguration: { maxmemoryPolicy: "allkeys-lru" }, + redisVersion: "4", + replicasPerPrimary: 2, + shardCount: 2, + sku: { name: "Premium", capacity: 1, family: "P" }, + staticIP: "192.168.0.5", + subnetId: + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1", + zones: ["1"] + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginCreateAndWait( + resourceGroupName, + name, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * + * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateDefaultVersion.json + */ +async function redisCacheCreateDefaultVersion() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters: RedisCreateParameters = { + enableNonSslPort: true, + location: "West US", + minimumTlsVersion: "1.2", + redisConfiguration: { maxmemoryPolicy: "allkeys-lru" }, + replicasPerPrimary: 2, + shardCount: 2, + sku: { name: "Premium", capacity: 1, family: "P" }, + staticIP: "192.168.0.5", + subnetId: + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1", + zones: ["1"] + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginCreateAndWait( + resourceGroupName, + name, + parameters + ); + console.log(result); +} + +/** + * This sample demonstrates how to Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * + * @summary Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateLatestVersion.json + */ +async function redisCacheCreateLatestVersion() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters: RedisCreateParameters = { + enableNonSslPort: true, + location: "West US", + minimumTlsVersion: "1.2", + redisConfiguration: { maxmemoryPolicy: "allkeys-lru" }, + redisVersion: "Latest", + replicasPerPrimary: 2, + shardCount: 2, + sku: { name: "Premium", capacity: 1, family: "P" }, + staticIP: "192.168.0.5", + subnetId: + "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1", + zones: ["1"] + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginCreateAndWait( + resourceGroupName, + name, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheCreate(); + redisCacheCreateDefaultVersion(); + redisCacheCreateLatestVersion(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisDeleteSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisDeleteSample.ts new file mode 100644 index 000000000000..a307c7fbbf5f --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisDeleteSample.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes a Redis cache. + * + * @summary Deletes a Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDelete.json + */ +async function redisCacheDelete() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginDeleteAndWait(resourceGroupName, name); + console.log(result); +} + +async function main() { + redisCacheDelete(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisExportDataSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisExportDataSample.ts new file mode 100644 index 000000000000..4e72119975ec --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisExportDataSample.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ExportRDBParameters, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Export data from the redis cache to blobs in a container. + * + * @summary Export data from the redis cache to blobs in a container. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheExport.json + */ +async function redisCacheExport() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters: ExportRDBParameters = { + format: "RDB", + container: + "https://contosostorage.blob.core.window.net/urltoBlobContainer?sasKeyParameters", + prefix: "datadump1", + storageSubscriptionId: "storageSubId" + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginExportDataAndWait( + resourceGroupName, + name, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheExport(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisFlushCacheSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisFlushCacheSample.ts new file mode 100644 index 000000000000..451f7f458bba --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisFlushCacheSample.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Deletes all of the keys in a cache. + * + * @summary Deletes all of the keys in a cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFlush.json + */ +async function redisCacheFlush() { + const subscriptionId = + process.env["REDIS_SUBSCRIPTION_ID"] || "subcription-id"; + const resourceGroupName = + process.env["REDIS_RESOURCE_GROUP"] || "resource-group-name"; + const cacheName = "cache-name"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginFlushCacheAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +async function main() { + redisCacheFlush(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisForceRebootSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisForceRebootSample.ts new file mode 100644 index 000000000000..6e0988349438 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisForceRebootSample.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisRebootParameters, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. + * + * @summary Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheForceReboot.json + */ +async function redisCacheForceReboot() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters: RedisRebootParameters = { + ports: [13000, 15001], + rebootType: "AllNodes", + shardId: 0 + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.forceReboot( + resourceGroupName, + name, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheForceReboot(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisGetSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisGetSample.ts new file mode 100644 index 000000000000..ebca43c2354f --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisGetSample.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets a Redis cache (resource description). + * + * @summary Gets a Redis cache (resource description). + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json + */ +async function redisCacheGet() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.get(resourceGroupName, name); + console.log(result); +} + +async function main() { + redisCacheGet(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisImportDataSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisImportDataSample.ts new file mode 100644 index 000000000000..d8eb097b87b2 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisImportDataSample.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + ImportRDBParameters, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Import data into Redis cache. + * + * @summary Import data into Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheImport.json + */ +async function redisCacheImport() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters: ImportRDBParameters = { + format: "RDB", + files: ["http://fileuris.contoso.com/pathtofile1"], + storageSubscriptionId: "storageSubId" + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginImportDataAndWait( + resourceGroupName, + name, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheImport(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListByResourceGroupSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListByResourceGroupSample.ts new file mode 100644 index 000000000000..3cd70415dd84 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListByResourceGroupSample.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Lists all Redis caches in a resource group. + * + * @summary Lists all Redis caches in a resource group. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListByResourceGroup.json + */ +async function redisCacheListByResourceGroup() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.redis.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheListByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListBySubscriptionSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListBySubscriptionSample.ts new file mode 100644 index 000000000000..c63ddf5689cb --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListBySubscriptionSample.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets all Redis caches in the specified subscription. + * + * @summary Gets all Redis caches in the specified subscription. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheList.json + */ +async function redisCacheList() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.redis.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheList(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListKeysSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListKeysSample.ts new file mode 100644 index 000000000000..fc26449af9d1 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListKeysSample.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. + * + * @summary Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListKeys.json + */ +async function redisCacheListKeys() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.listKeys(resourceGroupName, name); + console.log(result); +} + +async function main() { + redisCacheListKeys(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListUpgradeNotificationsSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListUpgradeNotificationsSample.ts new file mode 100644 index 000000000000..dad85e489e89 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisListUpgradeNotificationsSample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { RedisManagementClient } from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Gets any upgrade notifications for a Redis cache. + * + * @summary Gets any upgrade notifications for a Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListUpgradeNotifications.json + */ +async function redisCacheListUpgradeNotifications() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const history = 5000; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.redis.listUpgradeNotifications( + resourceGroupName, + name, + history + )) { + resArray.push(item); + } + console.log(resArray); +} + +async function main() { + redisCacheListUpgradeNotifications(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisRegenerateKeySample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisRegenerateKeySample.ts new file mode 100644 index 000000000000..7d8f795953dc --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisRegenerateKeySample.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisRegenerateKeyParameters, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. + * + * @summary Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheRegenerateKey.json + */ +async function redisCacheRegenerateKey() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters: RedisRegenerateKeyParameters = { keyType: "Primary" }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.regenerateKey( + resourceGroupName, + name, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheRegenerateKey(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisUpdateSample.ts b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisUpdateSample.ts new file mode 100644 index 000000000000..0fb10345b240 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/src/redisUpdateSample.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RedisUpdateParameters, + RedisManagementClient +} from "@azure/arm-rediscache"; +import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); + +/** + * This sample demonstrates how to Update an existing Redis cache. + * + * @summary Update an existing Redis cache. + * x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheUpdate.json + */ +async function redisCacheUpdate() { + const subscriptionId = process.env["REDIS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["REDIS_RESOURCE_GROUP"] || "rg1"; + const name = "cache1"; + const parameters: RedisUpdateParameters = { + enableNonSslPort: true, + replicasPerPrimary: 2 + }; + const credential = new DefaultAzureCredential(); + const client = new RedisManagementClient(credential, subscriptionId); + const result = await client.redis.beginUpdateAndWait( + resourceGroupName, + name, + parameters + ); + console.log(result); +} + +async function main() { + redisCacheUpdate(); +} + +main().catch(console.error); diff --git a/sdk/redis/arm-rediscache/samples/v8/typescript/tsconfig.json b/sdk/redis/arm-rediscache/samples/v8/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/redis/arm-rediscache/samples/v8/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/redis/arm-rediscache/src/models/index.ts b/sdk/redis/arm-rediscache/src/models/index.ts index c8846c831e74..091f8b0bf768 100644 --- a/sdk/redis/arm-rediscache/src/models/index.ts +++ b/sdk/redis/arm-rediscache/src/models/index.ts @@ -154,6 +154,8 @@ export interface RedisCreateParameters { minimumTlsVersion?: TlsVersion; /** Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled' */ publicNetworkAccess?: PublicNetworkAccess; + /** Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. */ + updateChannel?: UpdateChannel; /** The SKU of the Redis cache to deploy. */ sku: Sku; /** The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 */ @@ -192,6 +194,8 @@ export interface RedisCommonProperties { minimumTlsVersion?: TlsVersion; /** Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled' */ publicNetworkAccess?: PublicNetworkAccess; + /** Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. */ + updateChannel?: UpdateChannel; } /** All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. */ @@ -241,6 +245,8 @@ export interface RedisCommonPropertiesRedisConfiguration { authnotrequired?: string; /** SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity. */ storageSubscriptionId?: string; + /** Specifies whether AAD based authentication has been enabled or disabled for the cache */ + aadEnabled?: string; } /** Managed service identity (system assigned and/or user assigned identities) */ @@ -394,6 +400,8 @@ export interface RedisUpdateParameters { minimumTlsVersion?: TlsVersion; /** Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled' */ publicNetworkAccess?: PublicNetworkAccess; + /** Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. */ + updateChannel?: UpdateChannel; /** The SKU of the Redis cache to deploy. */ sku?: Sku; } @@ -460,6 +468,26 @@ export interface ExportRDBParameters { storageSubscriptionId?: string; } +/** The current status of an async operation. */ +export interface OperationStatusResult { + /** Fully qualified ID for the async operation. */ + id?: string; + /** Name of the async operation. */ + name?: string; + /** Operation status. */ + status: string; + /** Percent of the operation that is complete. */ + percentComplete?: number; + /** The start time of the operation. */ + startTime?: Date; + /** The end time of the operation. */ + endTime?: Date; + /** The operations list. */ + operations?: OperationStatusResult[]; + /** If present, details of the operation error. */ + error?: ErrorDetail; +} + /** The response of list firewall rules Redis operation. */ export interface RedisFirewallRuleListResult { /** Results of the list firewall rules operation. */ @@ -555,53 +583,26 @@ export interface PrivateLinkResourceListResult { value?: PrivateLinkResource[]; } -/** The current status of an async operation. */ -export interface OperationStatusResult { - /** Fully qualified ID for the async operation. */ - id?: string; - /** Name of the async operation. */ - name?: string; - /** Operation status. */ - status: string; - /** Percent of the operation that is complete. */ - percentComplete?: number; - /** The start time of the operation. */ - startTime?: Date; - /** The end time of the operation. */ - endTime?: Date; - /** The operations list. */ - operations?: OperationStatusResult[]; - /** If present, details of the operation error. */ - error?: ErrorDetailAutoGenerated; -} - -/** The error detail. */ -export interface ErrorDetailAutoGenerated { - /** - * The error code. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly code?: string; - /** - * The error message. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly message?: string; - /** - * The error target. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly target?: string; +/** List of access policies (with properties) of a Redis cache. */ +export interface RedisCacheAccessPolicyList { + /** List of access policies (with properties) of a Redis cache. */ + value?: RedisCacheAccessPolicy[]; /** - * The error details. + * Link for next set. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly details?: ErrorDetailAutoGenerated[]; + readonly nextLink?: string; +} + +/** List of access policies assignments (with properties) of a Redis cache. */ +export interface RedisCacheAccessPolicyAssignmentList { + /** List of access policies assignments (with properties) of a Redis cache. */ + value?: RedisCacheAccessPolicyAssignment[]; /** - * The error additional info. + * Link for next set. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly nextLink?: string; } /** Properties supplied to Create Redis operation. */ @@ -660,6 +661,12 @@ export interface PrivateLinkResource extends Resource { requiredZoneNames?: string[]; } +/** Asynchronous operation status */ +export interface OperationStatus extends OperationStatusResult { + /** Additional properties from RP, only when operation is successful */ + properties?: { [propertyName: string]: any }; +} + /** Properties of a linked server to be returned in get/put response */ export interface RedisLinkedServerProperties extends RedisLinkedServerCreateProperties { @@ -670,12 +677,6 @@ export interface RedisLinkedServerProperties readonly provisioningState?: string; } -/** Asynchronous operation status */ -export interface OperationStatus extends OperationStatusResult { - /** Additional properties from RP, only when operation is successful */ - properties?: { [propertyName: string]: any }; -} - /** Properties of the redis cache. */ export interface RedisProperties extends RedisCreateProperties { /** @@ -744,6 +745,8 @@ export interface RedisResource extends TrackedResource { minimumTlsVersion?: TlsVersion; /** Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled' */ publicNetworkAccess?: PublicNetworkAccess; + /** Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. */ + updateChannel?: UpdateChannel; /** The SKU of the Redis cache to deploy. */ sku: Sku; /** The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 */ @@ -836,9 +839,63 @@ export interface RedisLinkedServerWithProperties extends ProxyResource { readonly provisioningState?: string; } +/** Response to get/put access policy. */ +export interface RedisCacheAccessPolicy extends ProxyResource { + /** + * Provisioning state of access policy + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: AccessPolicyProvisioningState; + /** + * Built-In or Custom access policy + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly typePropertiesType?: AccessPolicyType; + /** Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites */ + permissions?: string; +} + +/** Response to an operation on access policy assignment */ +export interface RedisCacheAccessPolicyAssignment extends ProxyResource { + /** + * Provisioning state of an access policy assignment set + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: AccessPolicyAssignmentProvisioningState; + /** Object Id to assign access policy to */ + objectId?: string; + /** User friendly name for object id. Also represents username for token based authentication */ + objectIdAlias?: string; + /** The name of the access policy that is being assigned */ + accessPolicyName?: string; +} + /** Parameters required for creating a firewall rule on redis cache. (Note, you can just use the FirewallRule type instead now.) */ export interface RedisFirewallRuleCreateParameters extends RedisFirewallRule {} +/** Defines headers for Redis_flushCache operation. */ +export interface RedisFlushCacheHeaders { + /** URL to query for the status of the operation. */ + location?: string; + /** URL to query for the status of the operation. */ + azureAsyncOperation?: string; +} + +/** Defines headers for LinkedServer_delete operation. */ +export interface LinkedServerDeleteHeaders { + location?: string; +} + +/** Defines headers for AccessPolicy_delete operation. */ +export interface AccessPolicyDeleteHeaders { + location?: string; +} + +/** Defines headers for AccessPolicyAssignment_delete operation. */ +export interface AccessPolicyAssignmentDeleteHeaders { + location?: string; +} + /** Known values of {@link SkuName} that the service accepts. */ export enum KnownSkuName { /** Basic */ @@ -917,6 +974,24 @@ export enum KnownPublicNetworkAccess { */ export type PublicNetworkAccess = string; +/** Known values of {@link UpdateChannel} that the service accepts. */ +export enum KnownUpdateChannel { + /** Stable */ + Stable = "Stable", + /** Preview */ + Preview = "Preview" +} + +/** + * Defines values for UpdateChannel. \ + * {@link KnownUpdateChannel} can be used interchangeably with UpdateChannel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Stable** \ + * **Preview** + */ +export type UpdateChannel = string; + /** Known values of {@link ManagedServiceIdentityType} that the service accepts. */ export enum KnownManagedServiceIdentityType { /** None */ @@ -966,7 +1041,9 @@ export enum KnownProvisioningState { /** Unprovisioning */ Unprovisioning = "Unprovisioning", /** Updating */ - Updating = "Updating" + Updating = "Updating", + /** ConfiguringAAD */ + ConfiguringAAD = "ConfiguringAAD" } /** @@ -985,7 +1062,8 @@ export enum KnownProvisioningState { * **Succeeded** \ * **Unlinking** \ * **Unprovisioning** \ - * **Updating** + * **Updating** \ + * **ConfiguringAAD** */ export type ProvisioningState = string; @@ -1069,6 +1147,84 @@ export enum KnownDefaultName { * **default** */ export type DefaultName = string; + +/** Known values of {@link AccessPolicyProvisioningState} that the service accepts. */ +export enum KnownAccessPolicyProvisioningState { + /** Updating */ + Updating = "Updating", + /** Succeeded */ + Succeeded = "Succeeded", + /** Deleting */ + Deleting = "Deleting", + /** Deleted */ + Deleted = "Deleted", + /** Canceled */ + Canceled = "Canceled", + /** Failed */ + Failed = "Failed" +} + +/** + * Defines values for AccessPolicyProvisioningState. \ + * {@link KnownAccessPolicyProvisioningState} can be used interchangeably with AccessPolicyProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Updating** \ + * **Succeeded** \ + * **Deleting** \ + * **Deleted** \ + * **Canceled** \ + * **Failed** + */ +export type AccessPolicyProvisioningState = string; + +/** Known values of {@link AccessPolicyType} that the service accepts. */ +export enum KnownAccessPolicyType { + /** Custom */ + Custom = "Custom", + /** BuiltIn */ + BuiltIn = "BuiltIn" +} + +/** + * Defines values for AccessPolicyType. \ + * {@link KnownAccessPolicyType} can be used interchangeably with AccessPolicyType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Custom** \ + * **BuiltIn** + */ +export type AccessPolicyType = string; + +/** Known values of {@link AccessPolicyAssignmentProvisioningState} that the service accepts. */ +export enum KnownAccessPolicyAssignmentProvisioningState { + /** Updating */ + Updating = "Updating", + /** Succeeded */ + Succeeded = "Succeeded", + /** Deleting */ + Deleting = "Deleting", + /** Deleted */ + Deleted = "Deleted", + /** Canceled */ + Canceled = "Canceled", + /** Failed */ + Failed = "Failed" +} + +/** + * Defines values for AccessPolicyAssignmentProvisioningState. \ + * {@link KnownAccessPolicyAssignmentProvisioningState} can be used interchangeably with AccessPolicyAssignmentProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Updating** \ + * **Succeeded** \ + * **Deleting** \ + * **Deleted** \ + * **Canceled** \ + * **Failed** + */ +export type AccessPolicyAssignmentProvisioningState = string; /** Defines values for RedisKeyType. */ export type RedisKeyType = "Primary" | "Secondary"; /** Defines values for DayOfWeek. */ @@ -1199,6 +1355,19 @@ export interface RedisExportDataOptionalParams resumeFrom?: string; } +/** Optional parameters. */ +export interface RedisFlushCacheOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the flushCache operation. */ +export type RedisFlushCacheResponse = RedisFlushCacheHeaders & + OperationStatusResult; + /** Optional parameters. */ export interface RedisListUpgradeNotificationsNextOptionalParams extends coreClient.OperationOptions {} @@ -1370,6 +1539,90 @@ export interface AsyncOperationStatusGetOptionalParams /** Contains response data for the get operation. */ export type AsyncOperationStatusGetResponse = OperationStatus; +/** Optional parameters. */ +export interface AccessPolicyCreateUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createUpdate operation. */ +export type AccessPolicyCreateUpdateResponse = RedisCacheAccessPolicy; + +/** Optional parameters. */ +export interface AccessPolicyDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface AccessPolicyGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AccessPolicyGetResponse = RedisCacheAccessPolicy; + +/** Optional parameters. */ +export interface AccessPolicyListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AccessPolicyListResponse = RedisCacheAccessPolicyList; + +/** Optional parameters. */ +export interface AccessPolicyListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AccessPolicyListNextResponse = RedisCacheAccessPolicyList; + +/** Optional parameters. */ +export interface AccessPolicyAssignmentCreateUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createUpdate operation. */ +export type AccessPolicyAssignmentCreateUpdateResponse = RedisCacheAccessPolicyAssignment; + +/** Optional parameters. */ +export interface AccessPolicyAssignmentDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface AccessPolicyAssignmentGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AccessPolicyAssignmentGetResponse = RedisCacheAccessPolicyAssignment; + +/** Optional parameters. */ +export interface AccessPolicyAssignmentListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AccessPolicyAssignmentListResponse = RedisCacheAccessPolicyAssignmentList; + +/** Optional parameters. */ +export interface AccessPolicyAssignmentListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AccessPolicyAssignmentListNextResponse = RedisCacheAccessPolicyAssignmentList; + /** Optional parameters. */ export interface RedisManagementClientOptionalParams extends coreClient.ServiceClientOptions { diff --git a/sdk/redis/arm-rediscache/src/models/mappers.ts b/sdk/redis/arm-rediscache/src/models/mappers.ts index c37ce4bb0459..a4b6e4484d53 100644 --- a/sdk/redis/arm-rediscache/src/models/mappers.ts +++ b/sdk/redis/arm-rediscache/src/models/mappers.ts @@ -364,6 +364,12 @@ export const RedisCreateParameters: coreClient.CompositeMapper = { name: "String" } }, + updateChannel: { + serializedName: "properties.updateChannel", + type: { + name: "String" + } + }, sku: { serializedName: "properties.sku", type: { @@ -487,6 +493,12 @@ export const RedisCommonProperties: coreClient.CompositeMapper = { type: { name: "String" } + }, + updateChannel: { + serializedName: "updateChannel", + type: { + name: "String" + } } } } @@ -602,6 +614,12 @@ export const RedisCommonPropertiesRedisConfiguration: coreClient.CompositeMapper type: { name: "String" } + }, + aadEnabled: { + serializedName: "aad-enabled", + type: { + name: "String" + } } } } @@ -909,6 +927,12 @@ export const RedisUpdateParameters: coreClient.CompositeMapper = { name: "String" } }, + updateChannel: { + serializedName: "properties.updateChannel", + type: { + name: "String" + } + }, sku: { serializedName: "properties.sku", type: { @@ -1093,6 +1117,75 @@ export const ExportRDBParameters: coreClient.CompositeMapper = { } }; +export const OperationStatusResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationStatusResult", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + required: true, + type: { + name: "String" + } + }, + percentComplete: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "percentComplete", + type: { + name: "Number" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + type: { + name: "DateTime" + } + }, + operations: { + serializedName: "operations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationStatusResult" + } + } + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + export const RedisFirewallRuleListResult: coreClient.CompositeMapper = { type: { name: "Composite", @@ -1349,125 +1442,56 @@ export const PrivateLinkResourceListResult: coreClient.CompositeMapper = { } }; -export const OperationStatusResult: coreClient.CompositeMapper = { +export const RedisCacheAccessPolicyList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationStatusResult", + className: "RedisCacheAccessPolicyList", modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - required: true, - type: { - name: "String" - } - }, - percentComplete: { - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 0 - }, - serializedName: "percentComplete", - type: { - name: "Number" - } - }, - startTime: { - serializedName: "startTime", - type: { - name: "DateTime" - } - }, - endTime: { - serializedName: "endTime", - type: { - name: "DateTime" - } - }, - operations: { - serializedName: "operations", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "OperationStatusResult" + className: "RedisCacheAccessPolicy" } } } }, - error: { - serializedName: "error", + nextLink: { + serializedName: "nextLink", + readOnly: true, type: { - name: "Composite", - className: "ErrorDetailAutoGenerated" + name: "String" } } } } }; -export const ErrorDetailAutoGenerated: coreClient.CompositeMapper = { +export const RedisCacheAccessPolicyAssignmentList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ErrorDetailAutoGenerated", + className: "RedisCacheAccessPolicyAssignmentList", modelProperties: { - code: { - serializedName: "code", - readOnly: true, - type: { - name: "String" - } - }, - message: { - serializedName: "message", - readOnly: true, - type: { - name: "String" - } - }, - target: { - serializedName: "target", - readOnly: true, - type: { - name: "String" - } - }, - details: { - serializedName: "details", - readOnly: true, + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ErrorDetailAutoGenerated" + className: "RedisCacheAccessPolicyAssignment" } } } }, - additionalInfo: { - serializedName: "additionalInfo", + nextLink: { + serializedName: "nextLink", readOnly: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo" - } - } + name: "String" } } } @@ -1633,34 +1657,34 @@ export const PrivateLinkResource: coreClient.CompositeMapper = { } }; -export const RedisLinkedServerProperties: coreClient.CompositeMapper = { +export const OperationStatus: coreClient.CompositeMapper = { type: { name: "Composite", - className: "RedisLinkedServerProperties", + className: "OperationStatus", modelProperties: { - ...RedisLinkedServerCreateProperties.type.modelProperties, - provisioningState: { - serializedName: "provisioningState", - readOnly: true, + ...OperationStatusResult.type.modelProperties, + properties: { + serializedName: "properties", type: { - name: "String" + name: "Dictionary", + value: { type: { name: "any" } } } } } } }; -export const OperationStatus: coreClient.CompositeMapper = { +export const RedisLinkedServerProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationStatus", + className: "RedisLinkedServerProperties", modelProperties: { - ...OperationStatusResult.type.modelProperties, - properties: { - serializedName: "properties", + ...RedisLinkedServerCreateProperties.type.modelProperties, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, type: { - name: "Dictionary", - value: { type: { name: "any" } } + name: "String" } } } @@ -1833,6 +1857,12 @@ export const RedisResource: coreClient.CompositeMapper = { name: "String" } }, + updateChannel: { + serializedName: "properties.updateChannel", + type: { + name: "String" + } + }, sku: { serializedName: "properties.sku", type: { @@ -2042,6 +2072,76 @@ export const RedisLinkedServerWithProperties: coreClient.CompositeMapper = { } }; +export const RedisCacheAccessPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RedisCacheAccessPolicy", + modelProperties: { + ...ProxyResource.type.modelProperties, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + typePropertiesType: { + serializedName: "properties.type", + readOnly: true, + type: { + name: "String" + } + }, + permissions: { + serializedName: "properties.permissions", + type: { + name: "String" + } + } + } + } +}; + +export const RedisCacheAccessPolicyAssignment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RedisCacheAccessPolicyAssignment", + modelProperties: { + ...ProxyResource.type.modelProperties, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + objectId: { + serializedName: "properties.objectId", + type: { + name: "String" + } + }, + objectIdAlias: { + serializedName: "properties.objectIdAlias", + type: { + name: "String" + } + }, + accessPolicyName: { + constraints: { + Pattern: new RegExp( + "^([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]|[a-zA-Z0-9])$" + ) + }, + serializedName: "properties.accessPolicyName", + type: { + name: "String" + } + } + } + } +}; + export const RedisFirewallRuleCreateParameters: coreClient.CompositeMapper = { type: { name: "Composite", @@ -2051,3 +2151,69 @@ export const RedisFirewallRuleCreateParameters: coreClient.CompositeMapper = { } } }; + +export const RedisFlushCacheHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RedisFlushCacheHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + } + } + } +}; + +export const LinkedServerDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LinkedServerDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const AccessPolicyDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccessPolicyDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const AccessPolicyAssignmentDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccessPolicyAssignmentDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/redis/arm-rediscache/src/models/parameters.ts b/sdk/redis/arm-rediscache/src/models/parameters.ts index 5d100ca1cff9..e3da293bd723 100644 --- a/sdk/redis/arm-rediscache/src/models/parameters.ts +++ b/sdk/redis/arm-rediscache/src/models/parameters.ts @@ -22,7 +22,9 @@ import { RedisFirewallRule as RedisFirewallRuleMapper, RedisPatchSchedule as RedisPatchScheduleMapper, RedisLinkedServerCreateParameters as RedisLinkedServerCreateParametersMapper, - PrivateEndpointConnection as PrivateEndpointConnectionMapper + PrivateEndpointConnection as PrivateEndpointConnectionMapper, + RedisCacheAccessPolicy as RedisCacheAccessPolicyMapper, + RedisCacheAccessPolicyAssignment as RedisCacheAccessPolicyAssignmentMapper } from "../models/mappers"; export const accept: OperationParameter = { @@ -52,7 +54,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2023-04-01", + defaultValue: "2023-08-01", isConstant: true, serializedName: "api-version", type: { @@ -93,6 +95,9 @@ export const parameters: OperationParameter = { export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { + constraints: { + MinLength: 1 + }, serializedName: "subscriptionId", required: true, type: { @@ -104,6 +109,10 @@ export const subscriptionId: OperationURLParameter = { export const resourceGroupName: OperationURLParameter = { parameterPath: "resourceGroupName", mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, serializedName: "resourceGroupName", required: true, type: { @@ -167,6 +176,9 @@ export const parameters6: OperationParameter = { export const cacheName: OperationURLParameter = { parameterPath: "cacheName", mapper: { + constraints: { + Pattern: new RegExp("^([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]|[a-zA-Z0-9])$") + }, serializedName: "cacheName", required: true, type: { @@ -260,3 +272,49 @@ export const operationId: OperationURLParameter = { } } }; + +export const parameters10: OperationParameter = { + parameterPath: "parameters", + mapper: RedisCacheAccessPolicyMapper +}; + +export const accessPolicyName: OperationURLParameter = { + parameterPath: "accessPolicyName", + mapper: { + constraints: { + Pattern: new RegExp( + "^([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]|[a-zA-Z0-9])$" + ), + MaxLength: 63, + MinLength: 3 + }, + serializedName: "accessPolicyName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters11: OperationParameter = { + parameterPath: "parameters", + mapper: RedisCacheAccessPolicyAssignmentMapper +}; + +export const accessPolicyAssignmentName: OperationURLParameter = { + parameterPath: "accessPolicyAssignmentName", + mapper: { + constraints: { + Pattern: new RegExp( + "^([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]|[a-zA-Z0-9])$" + ), + MaxLength: 63, + MinLength: 3 + }, + serializedName: "accessPolicyAssignmentName", + required: true, + type: { + name: "String" + } + } +}; diff --git a/sdk/redis/arm-rediscache/src/operations/accessPolicy.ts b/sdk/redis/arm-rediscache/src/operations/accessPolicy.ts new file mode 100644 index 000000000000..b911d7fbbd6e --- /dev/null +++ b/sdk/redis/arm-rediscache/src/operations/accessPolicy.ts @@ -0,0 +1,499 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { AccessPolicy } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { RedisManagementClient } from "../redisManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + RedisCacheAccessPolicy, + AccessPolicyListNextOptionalParams, + AccessPolicyListOptionalParams, + AccessPolicyListResponse, + AccessPolicyCreateUpdateOptionalParams, + AccessPolicyCreateUpdateResponse, + AccessPolicyDeleteOptionalParams, + AccessPolicyGetOptionalParams, + AccessPolicyGetResponse, + AccessPolicyListNextResponse +} from "../models"; + +/// +/** Class containing AccessPolicy operations. */ +export class AccessPolicyImpl implements AccessPolicy { + private readonly client: RedisManagementClient; + + /** + * Initialize a new instance of the class AccessPolicy class. + * @param client Reference to the service client + */ + constructor(client: RedisManagementClient) { + this.client = client; + } + + /** + * Gets the list of access policies associated with this redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, cacheName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + cacheName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: AccessPolicyListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, cacheName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + cacheName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + cacheName, + options + )) { + yield* page; + } + } + + /** + * Adds an access policy to the redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param options The options parameters. + */ + async beginCreateUpdate( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + parameters: RedisCacheAccessPolicy, + options?: AccessPolicyCreateUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + AccessPolicyCreateUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + cacheName, + accessPolicyName, + parameters, + options + }, + spec: createUpdateOperationSpec + }); + const poller = await createHttpPoller< + AccessPolicyCreateUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Adds an access policy to the redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param options The options parameters. + */ + async beginCreateUpdateAndWait( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + parameters: RedisCacheAccessPolicy, + options?: AccessPolicyCreateUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateUpdate( + resourceGroupName, + cacheName, + accessPolicyName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Deletes the access policy from a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + options?: AccessPolicyDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, cacheName, accessPolicyName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes the access policy from a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + options?: AccessPolicyDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + cacheName, + accessPolicyName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets the detailed information about an access policy of a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + options?: AccessPolicyGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, accessPolicyName, options }, + getOperationSpec + ); + } + + /** + * Gets the list of access policies associated with this redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + cacheName: string, + nextLink: string, + options?: AccessPolicyListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.RedisCacheAccessPolicy + }, + 201: { + bodyMapper: Mappers.RedisCacheAccessPolicy + }, + 202: { + bodyMapper: Mappers.RedisCacheAccessPolicy + }, + 204: { + bodyMapper: Mappers.RedisCacheAccessPolicy + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters10, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.accessPolicyName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.accessPolicyName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.RedisCacheAccessPolicy + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.accessPolicyName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.RedisCacheAccessPolicyList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.RedisCacheAccessPolicyList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/redis/arm-rediscache/src/operations/accessPolicyAssignment.ts b/sdk/redis/arm-rediscache/src/operations/accessPolicyAssignment.ts new file mode 100644 index 000000000000..050f1a1fd5ac --- /dev/null +++ b/sdk/redis/arm-rediscache/src/operations/accessPolicyAssignment.ts @@ -0,0 +1,504 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { AccessPolicyAssignment } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { RedisManagementClient } from "../redisManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + RedisCacheAccessPolicyAssignment, + AccessPolicyAssignmentListNextOptionalParams, + AccessPolicyAssignmentListOptionalParams, + AccessPolicyAssignmentListResponse, + AccessPolicyAssignmentCreateUpdateOptionalParams, + AccessPolicyAssignmentCreateUpdateResponse, + AccessPolicyAssignmentDeleteOptionalParams, + AccessPolicyAssignmentGetOptionalParams, + AccessPolicyAssignmentGetResponse, + AccessPolicyAssignmentListNextResponse +} from "../models"; + +/// +/** Class containing AccessPolicyAssignment operations. */ +export class AccessPolicyAssignmentImpl implements AccessPolicyAssignment { + private readonly client: RedisManagementClient; + + /** + * Initialize a new instance of the class AccessPolicyAssignment class. + * @param client Reference to the service client + */ + constructor(client: RedisManagementClient) { + this.client = client; + } + + /** + * Gets the list of access policy assignments associated with this redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyAssignmentListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, cacheName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + cacheName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyAssignmentListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: AccessPolicyAssignmentListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, cacheName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + cacheName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyAssignmentListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + cacheName, + options + )) { + yield* page; + } + } + + /** + * Adds the access policy assignment to the specified users + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param options The options parameters. + */ + async beginCreateUpdate( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + parameters: RedisCacheAccessPolicyAssignment, + options?: AccessPolicyAssignmentCreateUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + AccessPolicyAssignmentCreateUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + parameters, + options + }, + spec: createUpdateOperationSpec + }); + const poller = await createHttpPoller< + AccessPolicyAssignmentCreateUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Adds the access policy assignment to the specified users + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param options The options parameters. + */ + async beginCreateUpdateAndWait( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + parameters: RedisCacheAccessPolicyAssignment, + options?: AccessPolicyAssignmentCreateUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateUpdate( + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Deletes the access policy assignment from a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + options?: AccessPolicyAssignmentDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + options + }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes the access policy assignment from a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + options?: AccessPolicyAssignmentDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + cacheName, + accessPolicyAssignmentName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets the list of assignments for an access policy of a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + options?: AccessPolicyAssignmentGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, accessPolicyAssignmentName, options }, + getOperationSpec + ); + } + + /** + * Gets the list of access policy assignments associated with this redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyAssignmentListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + cacheName: string, + nextLink: string, + options?: AccessPolicyAssignmentListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.RedisCacheAccessPolicyAssignment + }, + 201: { + bodyMapper: Mappers.RedisCacheAccessPolicyAssignment + }, + 202: { + bodyMapper: Mappers.RedisCacheAccessPolicyAssignment + }, + 204: { + bodyMapper: Mappers.RedisCacheAccessPolicyAssignment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters11, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.accessPolicyAssignmentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.accessPolicyAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.RedisCacheAccessPolicyAssignment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.accessPolicyAssignmentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.RedisCacheAccessPolicyAssignmentList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.RedisCacheAccessPolicyAssignmentList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/redis/arm-rediscache/src/operations/firewallRules.ts b/sdk/redis/arm-rediscache/src/operations/firewallRules.ts index 819027dcde20..ae0184d04e31 100644 --- a/sdk/redis/arm-rediscache/src/operations/firewallRules.ts +++ b/sdk/redis/arm-rediscache/src/operations/firewallRules.ts @@ -41,7 +41,7 @@ export class FirewallRulesImpl implements FirewallRules { /** * Gets all firewall rules in the specified redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -117,7 +117,7 @@ export class FirewallRulesImpl implements FirewallRules { /** * Gets all firewall rules in the specified redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -134,7 +134,7 @@ export class FirewallRulesImpl implements FirewallRules { /** * Create or update a redis cache firewall rule - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -155,7 +155,7 @@ export class FirewallRulesImpl implements FirewallRules { /** * Gets a single firewall rule in a specified redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param options The options parameters. @@ -174,7 +174,7 @@ export class FirewallRulesImpl implements FirewallRules { /** * Deletes a single firewall rule in a specified redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param options The options parameters. @@ -193,7 +193,7 @@ export class FirewallRulesImpl implements FirewallRules { /** * ListNext - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. diff --git a/sdk/redis/arm-rediscache/src/operations/index.ts b/sdk/redis/arm-rediscache/src/operations/index.ts index e161472f0263..346927fc01e5 100644 --- a/sdk/redis/arm-rediscache/src/operations/index.ts +++ b/sdk/redis/arm-rediscache/src/operations/index.ts @@ -14,3 +14,5 @@ export * from "./linkedServer"; export * from "./privateEndpointConnections"; export * from "./privateLinkResources"; export * from "./asyncOperationStatus"; +export * from "./accessPolicy"; +export * from "./accessPolicyAssignment"; diff --git a/sdk/redis/arm-rediscache/src/operations/linkedServer.ts b/sdk/redis/arm-rediscache/src/operations/linkedServer.ts index 22c5af58ef1a..4485caecca85 100644 --- a/sdk/redis/arm-rediscache/src/operations/linkedServer.ts +++ b/sdk/redis/arm-rediscache/src/operations/linkedServer.ts @@ -48,7 +48,7 @@ export class LinkedServerImpl implements LinkedServer { /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param options The options parameters. */ @@ -119,7 +119,7 @@ export class LinkedServerImpl implements LinkedServer { /** * Adds a linked server to the Redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -194,7 +194,7 @@ export class LinkedServerImpl implements LinkedServer { /** * Adds a linked server to the Redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -219,7 +219,7 @@ export class LinkedServerImpl implements LinkedServer { /** * Deletes the linked server from a redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param options The options parameters. @@ -284,7 +284,7 @@ export class LinkedServerImpl implements LinkedServer { /** * Deletes the linked server from a redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param options The options parameters. @@ -306,7 +306,7 @@ export class LinkedServerImpl implements LinkedServer { /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @param options The options parameters. @@ -325,7 +325,7 @@ export class LinkedServerImpl implements LinkedServer { /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param options The options parameters. */ @@ -342,7 +342,7 @@ export class LinkedServerImpl implements LinkedServer { /** * ListNext - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param nextLink The nextLink from the previous successful call to the List method. * @param options The options parameters. diff --git a/sdk/redis/arm-rediscache/src/operations/patchSchedules.ts b/sdk/redis/arm-rediscache/src/operations/patchSchedules.ts index 4a369c080581..8d1aab89c2a9 100644 --- a/sdk/redis/arm-rediscache/src/operations/patchSchedules.ts +++ b/sdk/redis/arm-rediscache/src/operations/patchSchedules.ts @@ -42,7 +42,7 @@ export class PatchSchedulesImpl implements PatchSchedules { /** * Gets all patch schedules in the specified redis cache (there is only one). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -126,7 +126,7 @@ export class PatchSchedulesImpl implements PatchSchedules { /** * Gets all patch schedules in the specified redis cache (there is only one). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -143,7 +143,7 @@ export class PatchSchedulesImpl implements PatchSchedules { /** * Create or replace the patching schedule for Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParam Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -164,7 +164,7 @@ export class PatchSchedulesImpl implements PatchSchedules { /** * Deletes the patching schedule of a redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParam Default string modeled as parameter for auto generation to work correctly. * @param options The options parameters. @@ -183,7 +183,7 @@ export class PatchSchedulesImpl implements PatchSchedules { /** * Gets the patching schedule of a redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParam Default string modeled as parameter for auto generation to work correctly. * @param options The options parameters. @@ -202,7 +202,7 @@ export class PatchSchedulesImpl implements PatchSchedules { /** * ListByRedisResourceNext - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param nextLink The nextLink from the previous successful call to the ListByRedisResource method. * @param options The options parameters. diff --git a/sdk/redis/arm-rediscache/src/operations/privateEndpointConnections.ts b/sdk/redis/arm-rediscache/src/operations/privateEndpointConnections.ts index 86099481f434..9c1aea2c9620 100644 --- a/sdk/redis/arm-rediscache/src/operations/privateEndpointConnections.ts +++ b/sdk/redis/arm-rediscache/src/operations/privateEndpointConnections.ts @@ -45,7 +45,7 @@ export class PrivateEndpointConnectionsImpl /** * List all the private endpoint connections associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -103,7 +103,7 @@ export class PrivateEndpointConnectionsImpl /** * List all the private endpoint connections associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -120,7 +120,7 @@ export class PrivateEndpointConnectionsImpl /** * Gets the specified private endpoint connection associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource @@ -140,7 +140,7 @@ export class PrivateEndpointConnectionsImpl /** * Update the state of specified private endpoint connection associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource @@ -222,7 +222,7 @@ export class PrivateEndpointConnectionsImpl /** * Update the state of specified private endpoint connection associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource @@ -248,7 +248,7 @@ export class PrivateEndpointConnectionsImpl /** * Deletes the specified private endpoint connection associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource diff --git a/sdk/redis/arm-rediscache/src/operations/privateLinkResources.ts b/sdk/redis/arm-rediscache/src/operations/privateLinkResources.ts index 05f33567a2a4..f484cac73f7d 100644 --- a/sdk/redis/arm-rediscache/src/operations/privateLinkResources.ts +++ b/sdk/redis/arm-rediscache/src/operations/privateLinkResources.ts @@ -33,7 +33,7 @@ export class PrivateLinkResourcesImpl implements PrivateLinkResources { /** * Gets the private link resources that need to be created for a redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -99,7 +99,7 @@ export class PrivateLinkResourcesImpl implements PrivateLinkResources { /** * Gets the private link resources that need to be created for a redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ diff --git a/sdk/redis/arm-rediscache/src/operations/redis.ts b/sdk/redis/arm-rediscache/src/operations/redis.ts index 5b0005eac5d9..5d46f39ed1c4 100644 --- a/sdk/redis/arm-rediscache/src/operations/redis.ts +++ b/sdk/redis/arm-rediscache/src/operations/redis.ts @@ -54,6 +54,8 @@ import { RedisImportDataOptionalParams, ExportRDBParameters, RedisExportDataOptionalParams, + RedisFlushCacheOptionalParams, + RedisFlushCacheResponse, RedisListUpgradeNotificationsNextResponse, RedisListByResourceGroupNextResponse, RedisListBySubscriptionNextResponse @@ -74,7 +76,7 @@ export class RedisImpl implements Redis { /** * Gets any upgrade notifications for a Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications * @param options The options parameters. @@ -166,7 +168,7 @@ export class RedisImpl implements Redis { /** * Lists all Redis caches in a resource group. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ public listByResourceGroup( @@ -305,7 +307,7 @@ export class RedisImpl implements Redis { /** * Gets any upgrade notifications for a Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications * @param options The options parameters. @@ -324,7 +326,7 @@ export class RedisImpl implements Redis { /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param options The options parameters. @@ -394,7 +396,7 @@ export class RedisImpl implements Redis { /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param options The options parameters. @@ -416,7 +418,7 @@ export class RedisImpl implements Redis { /** * Update an existing Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param options The options parameters. @@ -486,7 +488,7 @@ export class RedisImpl implements Redis { /** * Update an existing Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param options The options parameters. @@ -508,7 +510,7 @@ export class RedisImpl implements Redis { /** * Deletes a Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param options The options parameters. */ @@ -571,7 +573,7 @@ export class RedisImpl implements Redis { /** * Deletes a Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param options The options parameters. */ @@ -586,7 +588,7 @@ export class RedisImpl implements Redis { /** * Gets a Redis cache (resource description). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param options The options parameters. */ @@ -603,7 +605,7 @@ export class RedisImpl implements Redis { /** * Lists all Redis caches in a resource group. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ private _listByResourceGroup( @@ -632,7 +634,7 @@ export class RedisImpl implements Redis { /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache * resource. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param options The options parameters. */ @@ -650,7 +652,7 @@ export class RedisImpl implements Redis { /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache * resource. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @param options The options parameters. @@ -670,7 +672,7 @@ export class RedisImpl implements Redis { /** * Reboot specified Redis node(s). This operation requires write permission to the cache resource. * There can be potential data loss. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @param options The options parameters. @@ -689,7 +691,7 @@ export class RedisImpl implements Redis { /** * Import data into Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param options The options parameters. @@ -754,7 +756,7 @@ export class RedisImpl implements Redis { /** * Import data into Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param options The options parameters. @@ -776,7 +778,7 @@ export class RedisImpl implements Redis { /** * Export data from the redis cache to blobs in a container. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param options The options parameters. @@ -841,7 +843,7 @@ export class RedisImpl implements Redis { /** * Export data from the redis cache to blobs in a container. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param options The options parameters. @@ -861,9 +863,100 @@ export class RedisImpl implements Redis { return poller.pollUntilDone(); } + /** + * Deletes all of the keys in a cache. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + async beginFlushCache( + resourceGroupName: string, + cacheName: string, + options?: RedisFlushCacheOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + RedisFlushCacheResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, cacheName, options }, + spec: flushCacheOperationSpec + }); + const poller = await createHttpPoller< + RedisFlushCacheResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes all of the keys in a cache. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + async beginFlushCacheAndWait( + resourceGroupName: string, + cacheName: string, + options?: RedisFlushCacheOptionalParams + ): Promise { + const poller = await this.beginFlushCache( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); + } + /** * ListUpgradeNotificationsNext - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param nextLink The nextLink from the previous successful call to the ListUpgradeNotifications * method. @@ -883,7 +976,7 @@ export class RedisImpl implements Redis { /** * ListByResourceGroupNext - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. * @param options The options parameters. */ @@ -1223,6 +1316,41 @@ const exportDataOperationSpec: coreClient.OperationSpec = { mediaType: "json", serializer }; +const flushCacheOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/flush", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationStatusResult, + headersMapper: Mappers.RedisFlushCacheHeaders + }, + 201: { + bodyMapper: Mappers.OperationStatusResult, + headersMapper: Mappers.RedisFlushCacheHeaders + }, + 202: { + bodyMapper: Mappers.OperationStatusResult, + headersMapper: Mappers.RedisFlushCacheHeaders + }, + 204: { + bodyMapper: Mappers.OperationStatusResult, + headersMapper: Mappers.RedisFlushCacheHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; const listUpgradeNotificationsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/accessPolicy.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/accessPolicy.ts new file mode 100644 index 000000000000..4fe07cd509ba --- /dev/null +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/accessPolicy.ts @@ -0,0 +1,109 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + RedisCacheAccessPolicy, + AccessPolicyListOptionalParams, + AccessPolicyCreateUpdateOptionalParams, + AccessPolicyCreateUpdateResponse, + AccessPolicyDeleteOptionalParams, + AccessPolicyGetOptionalParams, + AccessPolicyGetResponse +} from "../models"; + +/// +/** Interface representing a AccessPolicy. */ +export interface AccessPolicy { + /** + * Gets the list of access policies associated with this redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Adds an access policy to the redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param options The options parameters. + */ + beginCreateUpdate( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + parameters: RedisCacheAccessPolicy, + options?: AccessPolicyCreateUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + AccessPolicyCreateUpdateResponse + > + >; + /** + * Adds an access policy to the redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param parameters Parameters supplied to the Create Update Access Policy operation. + * @param options The options parameters. + */ + beginCreateUpdateAndWait( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + parameters: RedisCacheAccessPolicy, + options?: AccessPolicyCreateUpdateOptionalParams + ): Promise; + /** + * Deletes the access policy from a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + options?: AccessPolicyDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes the access policy from a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + options?: AccessPolicyDeleteOptionalParams + ): Promise; + /** + * Gets the detailed information about an access policy of a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyName The name of the access policy that is being added to the Redis cache. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + cacheName: string, + accessPolicyName: string, + options?: AccessPolicyGetOptionalParams + ): Promise; +} diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/accessPolicyAssignment.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/accessPolicyAssignment.ts new file mode 100644 index 000000000000..1ccaad248fa8 --- /dev/null +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/accessPolicyAssignment.ts @@ -0,0 +1,109 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + RedisCacheAccessPolicyAssignment, + AccessPolicyAssignmentListOptionalParams, + AccessPolicyAssignmentCreateUpdateOptionalParams, + AccessPolicyAssignmentCreateUpdateResponse, + AccessPolicyAssignmentDeleteOptionalParams, + AccessPolicyAssignmentGetOptionalParams, + AccessPolicyAssignmentGetResponse +} from "../models"; + +/// +/** Interface representing a AccessPolicyAssignment. */ +export interface AccessPolicyAssignment { + /** + * Gets the list of access policy assignments associated with this redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + cacheName: string, + options?: AccessPolicyAssignmentListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Adds the access policy assignment to the specified users + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param options The options parameters. + */ + beginCreateUpdate( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + parameters: RedisCacheAccessPolicyAssignment, + options?: AccessPolicyAssignmentCreateUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + AccessPolicyAssignmentCreateUpdateResponse + > + >; + /** + * Adds the access policy assignment to the specified users + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param parameters Parameters supplied to the Create Update Access Policy Assignment operation. + * @param options The options parameters. + */ + beginCreateUpdateAndWait( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + parameters: RedisCacheAccessPolicyAssignment, + options?: AccessPolicyAssignmentCreateUpdateOptionalParams + ): Promise; + /** + * Deletes the access policy assignment from a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + options?: AccessPolicyAssignmentDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes the access policy assignment from a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + options?: AccessPolicyAssignmentDeleteOptionalParams + ): Promise; + /** + * Gets the list of assignments for an access policy of a redis cache + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param accessPolicyAssignmentName The name of the access policy assignment. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + cacheName: string, + accessPolicyAssignmentName: string, + options?: AccessPolicyAssignmentGetOptionalParams + ): Promise; +} diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/firewallRules.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/firewallRules.ts index d6ced9f389a2..6929e35cc180 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/firewallRules.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/firewallRules.ts @@ -22,7 +22,7 @@ import { export interface FirewallRules { /** * Gets all firewall rules in the specified redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -33,7 +33,7 @@ export interface FirewallRules { ): PagedAsyncIterableIterator; /** * Create or update a redis cache firewall rule - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param parameters Parameters supplied to the create or update redis firewall rule operation. @@ -48,7 +48,7 @@ export interface FirewallRules { ): Promise; /** * Gets a single firewall rule in a specified redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param options The options parameters. @@ -61,7 +61,7 @@ export interface FirewallRules { ): Promise; /** * Deletes a single firewall rule in a specified redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param ruleName The name of the firewall rule. * @param options The options parameters. diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/index.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/index.ts index e161472f0263..346927fc01e5 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/index.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/index.ts @@ -14,3 +14,5 @@ export * from "./linkedServer"; export * from "./privateEndpointConnections"; export * from "./privateLinkResources"; export * from "./asyncOperationStatus"; +export * from "./accessPolicy"; +export * from "./accessPolicyAssignment"; diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/linkedServer.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/linkedServer.ts index 86667e5fcffe..b7f6bc5ac66d 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/linkedServer.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/linkedServer.ts @@ -24,7 +24,7 @@ import { export interface LinkedServer { /** * Gets the list of linked servers associated with this redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param options The options parameters. */ @@ -35,7 +35,7 @@ export interface LinkedServer { ): PagedAsyncIterableIterator; /** * Adds a linked server to the Redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -55,7 +55,7 @@ export interface LinkedServer { >; /** * Adds a linked server to the Redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param parameters Parameters supplied to the Create Linked server operation. @@ -70,7 +70,7 @@ export interface LinkedServer { ): Promise; /** * Deletes the linked server from a redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param options The options parameters. @@ -83,7 +83,7 @@ export interface LinkedServer { ): Promise, void>>; /** * Deletes the linked server from a redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server that is being added to the Redis cache. * @param options The options parameters. @@ -96,7 +96,7 @@ export interface LinkedServer { ): Promise; /** * Gets the detailed information about a linked server of a redis cache (requires Premium SKU). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param linkedServerName The name of the linked server. * @param options The options parameters. diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/patchSchedules.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/patchSchedules.ts index fa0cc7719bb1..2134820241ec 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/patchSchedules.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/patchSchedules.ts @@ -23,7 +23,7 @@ import { export interface PatchSchedules { /** * Gets all patch schedules in the specified redis cache (there is only one). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -34,7 +34,7 @@ export interface PatchSchedules { ): PagedAsyncIterableIterator; /** * Create or replace the patching schedule for Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param defaultParam Default string modeled as parameter for auto generation to work correctly. * @param parameters Parameters to set the patching schedule for Redis cache. @@ -49,7 +49,7 @@ export interface PatchSchedules { ): Promise; /** * Deletes the patching schedule of a redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParam Default string modeled as parameter for auto generation to work correctly. * @param options The options parameters. @@ -62,7 +62,7 @@ export interface PatchSchedules { ): Promise; /** * Gets the patching schedule of a redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the redis cache. * @param defaultParam Default string modeled as parameter for auto generation to work correctly. * @param options The options parameters. diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/privateEndpointConnections.ts index 0f505d8e0841..b06ec21e9d5b 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/privateEndpointConnections.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/privateEndpointConnections.ts @@ -23,7 +23,7 @@ import { export interface PrivateEndpointConnections { /** * List all the private endpoint connections associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ @@ -34,7 +34,7 @@ export interface PrivateEndpointConnections { ): PagedAsyncIterableIterator; /** * Gets the specified private endpoint connection associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource @@ -48,7 +48,7 @@ export interface PrivateEndpointConnections { ): Promise; /** * Update the state of specified private endpoint connection associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource @@ -69,7 +69,7 @@ export interface PrivateEndpointConnections { >; /** * Update the state of specified private endpoint connection associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource @@ -85,7 +85,7 @@ export interface PrivateEndpointConnections { ): Promise; /** * Deletes the specified private endpoint connection associated with the redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param privateEndpointConnectionName The name of the private endpoint connection associated with the * Azure resource diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/privateLinkResources.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/privateLinkResources.ts index b8740b709a79..ab3f7b346e08 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/privateLinkResources.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/privateLinkResources.ts @@ -17,7 +17,7 @@ import { export interface PrivateLinkResources { /** * Gets the private link resources that need to be created for a redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param cacheName The name of the Redis cache. * @param options The options parameters. */ diff --git a/sdk/redis/arm-rediscache/src/operationsInterfaces/redis.ts b/sdk/redis/arm-rediscache/src/operationsInterfaces/redis.ts index e8285132f509..314c013dedb4 100644 --- a/sdk/redis/arm-rediscache/src/operationsInterfaces/redis.ts +++ b/sdk/redis/arm-rediscache/src/operationsInterfaces/redis.ts @@ -36,7 +36,9 @@ import { ImportRDBParameters, RedisImportDataOptionalParams, ExportRDBParameters, - RedisExportDataOptionalParams + RedisExportDataOptionalParams, + RedisFlushCacheOptionalParams, + RedisFlushCacheResponse } from "../models"; /// @@ -44,7 +46,7 @@ import { export interface Redis { /** * Gets any upgrade notifications for a Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param history how many minutes in past to look for upgrade notifications * @param options The options parameters. @@ -57,7 +59,7 @@ export interface Redis { ): PagedAsyncIterableIterator; /** * Lists all Redis caches in a resource group. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ listByResourceGroup( @@ -83,7 +85,7 @@ export interface Redis { ): Promise; /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param options The options parameters. @@ -98,7 +100,7 @@ export interface Redis { >; /** * Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Create Redis operation. * @param options The options parameters. @@ -111,7 +113,7 @@ export interface Redis { ): Promise; /** * Update an existing Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param options The options parameters. @@ -126,7 +128,7 @@ export interface Redis { >; /** * Update an existing Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters supplied to the Update Redis operation. * @param options The options parameters. @@ -139,7 +141,7 @@ export interface Redis { ): Promise; /** * Deletes a Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param options The options parameters. */ @@ -150,7 +152,7 @@ export interface Redis { ): Promise, void>>; /** * Deletes a Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param options The options parameters. */ @@ -161,7 +163,7 @@ export interface Redis { ): Promise; /** * Gets a Redis cache (resource description). - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param options The options parameters. */ @@ -173,7 +175,7 @@ export interface Redis { /** * Retrieve a Redis cache's access keys. This operation requires write permission to the cache * resource. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param options The options parameters. */ @@ -185,7 +187,7 @@ export interface Redis { /** * Regenerate Redis cache's access keys. This operation requires write permission to the cache * resource. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which key to regenerate. * @param options The options parameters. @@ -199,7 +201,7 @@ export interface Redis { /** * Reboot specified Redis node(s). This operation requires write permission to the cache resource. * There can be potential data loss. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Specifies which Redis node(s) to reboot. * @param options The options parameters. @@ -212,7 +214,7 @@ export interface Redis { ): Promise; /** * Import data into Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param options The options parameters. @@ -225,7 +227,7 @@ export interface Redis { ): Promise, void>>; /** * Import data into Redis cache. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis import operation. * @param options The options parameters. @@ -238,7 +240,7 @@ export interface Redis { ): Promise; /** * Export data from the redis cache to blobs in a container. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param options The options parameters. @@ -251,7 +253,7 @@ export interface Redis { ): Promise, void>>; /** * Export data from the redis cache to blobs in a container. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param name The name of the Redis cache. * @param parameters Parameters for Redis export operation. * @param options The options parameters. @@ -262,4 +264,31 @@ export interface Redis { parameters: ExportRDBParameters, options?: RedisExportDataOptionalParams ): Promise; + /** + * Deletes all of the keys in a cache. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + beginFlushCache( + resourceGroupName: string, + cacheName: string, + options?: RedisFlushCacheOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + RedisFlushCacheResponse + > + >; + /** + * Deletes all of the keys in a cache. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param cacheName The name of the Redis cache. + * @param options The options parameters. + */ + beginFlushCacheAndWait( + resourceGroupName: string, + cacheName: string, + options?: RedisFlushCacheOptionalParams + ): Promise; } diff --git a/sdk/redis/arm-rediscache/src/redisManagementClient.ts b/sdk/redis/arm-rediscache/src/redisManagementClient.ts index 40473dcda399..b0043654a4a3 100644 --- a/sdk/redis/arm-rediscache/src/redisManagementClient.ts +++ b/sdk/redis/arm-rediscache/src/redisManagementClient.ts @@ -22,7 +22,9 @@ import { LinkedServerImpl, PrivateEndpointConnectionsImpl, PrivateLinkResourcesImpl, - AsyncOperationStatusImpl + AsyncOperationStatusImpl, + AccessPolicyImpl, + AccessPolicyAssignmentImpl } from "./operations"; import { Operations, @@ -32,7 +34,9 @@ import { LinkedServer, PrivateEndpointConnections, PrivateLinkResources, - AsyncOperationStatus + AsyncOperationStatus, + AccessPolicy, + AccessPolicyAssignment } from "./operationsInterfaces"; import { RedisManagementClientOptionalParams } from "./models"; @@ -44,8 +48,7 @@ export class RedisManagementClient extends coreClient.ServiceClient { /** * Initializes a new instance of the RedisManagementClient class. * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId Gets subscription credentials which uniquely identify the Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. + * @param subscriptionId The ID of the target subscription. * @param options The parameter options */ constructor( @@ -69,7 +72,7 @@ export class RedisManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-rediscache/7.2.1`; + const packageDetails = `azsdk-js-arm-rediscache/8.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -122,7 +125,7 @@ export class RedisManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2023-04-01"; + this.apiVersion = options.apiVersion || "2023-08-01"; this.operations = new OperationsImpl(this); this.redis = new RedisImpl(this); this.firewallRules = new FirewallRulesImpl(this); @@ -131,6 +134,8 @@ export class RedisManagementClient extends coreClient.ServiceClient { this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); this.privateLinkResources = new PrivateLinkResourcesImpl(this); this.asyncOperationStatus = new AsyncOperationStatusImpl(this); + this.accessPolicy = new AccessPolicyImpl(this); + this.accessPolicyAssignment = new AccessPolicyAssignmentImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); } @@ -170,4 +175,6 @@ export class RedisManagementClient extends coreClient.ServiceClient { privateEndpointConnections: PrivateEndpointConnections; privateLinkResources: PrivateLinkResources; asyncOperationStatus: AsyncOperationStatus; + accessPolicy: AccessPolicy; + accessPolicyAssignment: AccessPolicyAssignment; }