diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 08d0bc72a353..e10d6fdf5599 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -609,8 +609,8 @@ packages: - supports-color dev: false - /@azure/arm-compute/17.1.0: - resolution: {integrity: sha512-zLc/bgbNAIZlSgePz9SmGkmqs3VU7U0hO6vQfau03Ni9aOYeoWRiStIv/xCxxvflnJFVcwj5fPm5AeyGjTTNow==} + /@azure/arm-storage/17.0.0: + resolution: {integrity: sha512-WS9eT3/vDQ7a1z/8K5BkPhoAi0ilo94yCSws4KyWq6UIA3RaXBDpYYAlN0TOxad9rPeOnWXWcB9gLw3DmjZ4wg==} engines: {node: '>=12.0.0'} dependencies: '@azure/abort-controller': 1.0.4 @@ -9291,6 +9291,7 @@ packages: version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 + '@azure/arm-storage': 17.0.0 '@microsoft/api-extractor': 7.19.4 '@rollup/plugin-commonjs': 21.0.1_rollup@2.67.1 '@rollup/plugin-json': 4.1.0_rollup@2.67.1 @@ -9511,7 +9512,7 @@ packages: dev: false file:projects/arm-compute.tgz: - resolution: {integrity: sha512-mblVe8cn6tBhnRxgFfkaueG3l8Ir9YhqNJC3pDAzvGELAtb9Awcnqta2Iu9nBtTln2oGqqlV1rWPhYnvkR0zww==, tarball: file:projects/arm-compute.tgz} + resolution: {integrity: sha512-gN6VdLPNFLxYG9Q/S//Ru95Im4dd2dhhBU9HrtSa3nLDVk0UPJKzE81RmUaTXyj2O5oZh524mAlC+lJWR2boTg==, tarball: file:projects/arm-compute.tgz} name: '@rush-temp/arm-compute' version: 0.0.0 dependencies: @@ -10141,6 +10142,7 @@ packages: version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 + '@azure/arm-storage': 17.0.0 '@microsoft/api-extractor': 7.19.4 '@rollup/plugin-commonjs': 21.0.1_rollup@2.67.1 '@rollup/plugin-json': 4.1.0_rollup@2.67.1 @@ -10385,12 +10387,11 @@ packages: dev: false file:projects/arm-imagebuilder.tgz: - resolution: {integrity: sha512-WQtkHWHZBlaxdgMhISbg8GroEYhf0Ul/uWayUMjkBLYBtMcIEUkJwj76ZbdZ/0U58z5Lsx5gr93VXXQcmLhqyA==, tarball: file:projects/arm-imagebuilder.tgz} + resolution: {integrity: sha512-/aJpNGWOV825XGXVuaOPrTSIOCo5u/7rL9DHpikVBKl1ELqMbqOmdTbF7hAwVc2IIIwv1/XUHYkXsohPu9I/dQ==, tarball: file:projects/arm-imagebuilder.tgz} name: '@rush-temp/arm-imagebuilder' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 - '@azure/arm-compute': 17.1.0 '@microsoft/api-extractor': 7.19.4 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -10967,6 +10968,7 @@ packages: version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 + '@azure/arm-storage': 17.0.0 '@microsoft/api-extractor': 7.19.4 '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 '@rollup/plugin-json': 4.1.0_rollup@1.32.1 @@ -12062,24 +12064,24 @@ packages: dev: false file:projects/arm-storage.tgz: - resolution: {integrity: sha512-Nx/m2MguiIwPOF+3c6onTQua7qql7fNqujx5TzVHGWc6YLo+n/4AbQuIHnlCYGnalPGuEYdMZ8neePX6fOnYVg==, tarball: file:projects/arm-storage.tgz} + resolution: {integrity: sha512-+8h93tQKgGcrkPBBmEhiaSyaGWRjCD8hsfP44fAZ4P7I5DjeRFDoQjYrmEcUlR3Lgvig1nxjHlL8a6hMDHf9aA==, tarball: file:projects/arm-storage.tgz} name: '@rush-temp/arm-storage' version: 0.0.0 dependencies: '@azure-tools/test-recorder': 1.0.2 '@microsoft/api-extractor': 7.19.4 - '@rollup/plugin-commonjs': 21.0.1_rollup@2.67.1 - '@rollup/plugin-json': 4.1.0_rollup@2.67.1 - '@rollup/plugin-multi-entry': 3.0.1_rollup@2.67.1 - '@rollup/plugin-node-resolve': 8.4.0_rollup@2.67.1 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 '@types/chai': 4.3.0 chai: 4.3.6 cross-env: 7.0.3 mkdirp: 1.0.4 mocha: 7.2.0 rimraf: 3.0.2 - rollup: 2.67.1 - rollup-plugin-sourcemaps: 0.4.2_rollup@2.67.1 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 tslib: 2.3.1 typescript: 4.2.4 uglify-js: 3.15.1 @@ -14705,7 +14707,7 @@ packages: dev: false file:projects/monitor-query.tgz: - resolution: {integrity: sha512-vooDpQ9bSQgJCKjMaW8rhrsZVAu5H8OfPagXSDRQB2hPz0fEL6rUgvHoajxoLHaJXqsXkRg2QdpLWP8ESJ00Iw==, tarball: file:projects/monitor-query.tgz} + resolution: {integrity: sha512-yFr89E5+B2YApiYUYVtA0quOfFKPKBfpxJPWiJq5betC6Zz/1lzKOCf7Kd1WCyqYriJ5AKAgoG+fkfFXo63xZA==, tarball: file:projects/monitor-query.tgz} name: '@rush-temp/monitor-query' version: 0.0.0 dependencies: @@ -15228,7 +15230,7 @@ packages: dev: false file:projects/purview-administration.tgz: - resolution: {integrity: sha512-Z16hjklcfBBkYbwEMmEEC4QtxSnbIFdVyiD1OFdjnPeFt+ZbHxhs4BOtkc6vCQEZb5vgPEqJ5PULYbtKpJHuWg==, tarball: file:projects/purview-administration.tgz} + resolution: {integrity: sha512-I/aBL09l+iLLQZa1vjIFArGmsfU5aWEy11NYlMMUReaIRPDpjkJ74DsmWvqUBj24HwciOYNzf+8dd2QdZ6mKAg==, tarball: file:projects/purview-administration.tgz} name: '@rush-temp/purview-administration' version: 0.0.0 dependencies: @@ -15268,13 +15270,12 @@ packages: transitivePeerDependencies: - bufferutil - debug - - encoding - supports-color - utf-8-validate dev: false file:projects/purview-catalog.tgz: - resolution: {integrity: sha512-cQaHJb4jVWl+mTuCSJZ1anD4t1eVre5FR//AEZeIdneTG2v+K/dBs5hNIa9IvHGoMl0yE0JNcb7cbMod+kAW3g==, tarball: file:projects/purview-catalog.tgz} + resolution: {integrity: sha512-5wMpq1xaYGMhJcpyFyHMrujIaEpRxmo/BL0EPtjM5uN7zAzoFLEAvYP2/hMq5giM99goN7LN6Ih20REBbLZ/mw==, tarball: file:projects/purview-catalog.tgz} name: '@rush-temp/purview-catalog' version: 0.0.0 dependencies: @@ -15314,7 +15315,6 @@ packages: transitivePeerDependencies: - bufferutil - debug - - encoding - supports-color - utf-8-validate dev: false diff --git a/sdk/storage/arm-storage/CHANGELOG.md b/sdk/storage/arm-storage/CHANGELOG.md index 4216b5756022..05ad4934bea4 100644 --- a/sdk/storage/arm-storage/CHANGELOG.md +++ b/sdk/storage/arm-storage/CHANGELOG.md @@ -1,15 +1,46 @@ # Release History - -## 17.0.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + +## 17.1.0 (2022-02-14) + +**Features** + + - Added operation group LocalUsersOperations + - Added Interface LocalUserKeys + - Added Interface LocalUserRegeneratePasswordResult + - Added Interface LocalUsers + - Added Interface LocalUsersCreateOrUpdateOptionalParams + - Added Interface LocalUsersDeleteOptionalParams + - Added Interface LocalUsersGetOptionalParams + - Added Interface LocalUsersListKeysOptionalParams + - Added Interface LocalUsersListOptionalParams + - Added Interface LocalUsersRegeneratePasswordOptionalParams + - Added Interface PermissionScope + - Added Interface SshPublicKey + - Added Type Alias ActiveDirectoryPropertiesAccountType + - Added Type Alias AllowedCopyScope + - Added Type Alias LocalUser + - Added Type Alias LocalUsersCreateOrUpdateResponse + - Added Type Alias LocalUsersGetResponse + - Added Type Alias LocalUsersListKeysResponse + - Added Type Alias LocalUsersListResponse + - Added Type Alias LocalUsersRegeneratePasswordResponse + - Interface ActiveDirectoryProperties has a new optional parameter accountType + - Interface ActiveDirectoryProperties has a new optional parameter samAccountName + - Interface EncryptionIdentity has a new optional parameter encryptionFederatedIdentityClientId + - Interface StorageAccountCreateParameters has a new optional parameter allowedCopyScope + - Interface StorageAccountCreateParameters has a new optional parameter isLocalUserEnabled + - Interface StorageAccountCreateParameters has a new optional parameter isSftpEnabled + - Interface StorageAccountUpdateParameters has a new optional parameter allowedCopyScope + - Interface StorageAccountUpdateParameters has a new optional parameter isLocalUserEnabled + - Interface StorageAccountUpdateParameters has a new optional parameter isSftpEnabled + - Class StorageManagementClient has a new parameter localUsersOperations + - Type Alias StorageAccount has a new parameter isSftpEnabled + - Type Alias StorageAccount has a new parameter isLocalUserEnabled + - Type Alias StorageAccount has a new parameter allowedCopyScope + - Added Enum KnownActiveDirectoryPropertiesAccountType + - Added Enum KnownAllowedCopyScope + + ## 17.0.0 (2021-12-06) The package of @azure/arm-storage is using our next generation design principles since version 17.0.0, which contains breaking changes. diff --git a/sdk/storage/arm-storage/LICENSE b/sdk/storage/arm-storage/LICENSE index ccb63b166732..5d1d36e0af80 100644 --- a/sdk/storage/arm-storage/LICENSE +++ b/sdk/storage/arm-storage/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2021 Microsoft +Copyright (c) 2022 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/storage/arm-storage/_meta.json b/sdk/storage/arm-storage/_meta.json index 038f1b6617d7..be7a77386989 100644 --- a/sdk/storage/arm-storage/_meta.json +++ b/sdk/storage/arm-storage/_meta.json @@ -1,7 +1,7 @@ { - "commit": "3b2f85d320fac5b282bc80240f9e5c2c57753bad", + "commit": "7c98de7664d4565c088350015ccd0cfc102eab49", "readme": "specification/storage/resource-manager/readme.md", - "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/storage/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/storage/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220128.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" + "use": "@autorest/typescript@6.0.0-alpha.16.20220128.1" } \ No newline at end of file diff --git a/sdk/storage/arm-storage/api-extractor.json b/sdk/storage/arm-storage/api-extractor.json index 682357c80942..1ef22e1176ee 100644 --- a/sdk/storage/arm-storage/api-extractor.json +++ b/sdk/storage/arm-storage/api-extractor.json @@ -1,18 +1,31 @@ { "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", - "docModel": { "enabled": true }, - "apiReport": { "enabled": true, "reportFolder": "./review" }, + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, "dtsRollup": { "enabled": true, "untrimmedFilePath": "", "publicTrimmedFilePath": "./types/arm-storage.d.ts" }, "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } } } -} +} \ No newline at end of file diff --git a/sdk/storage/arm-storage/package.json b/sdk/storage/arm-storage/package.json index 51888e380ac1..c7a94c3c8acc 100644 --- a/sdk/storage/arm-storage/package.json +++ b/sdk/storage/arm-storage/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for StorageManagementClient.", - "version": "17.0.1", + "version": "17.1.0", "engines": { "node": ">=12.0.0" }, @@ -29,12 +29,12 @@ "types": "./types/arm-storage.d.ts", "devDependencies": { "@microsoft/api-extractor": "^7.18.11", - "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-commonjs": "11.0.2", "@rollup/plugin-json": "^4.0.0", "@rollup/plugin-multi-entry": "^3.0.0", "@rollup/plugin-node-resolve": "^8.0.0", "mkdirp": "^1.0.4", - "rollup": "^2.0.0", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", "typescript": "~4.2.0", "uglify-js": "^3.4.9", @@ -42,9 +42,7 @@ "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^1.0.0", "mocha": "^7.1.1", - "cross-env": "^7.0.2", - "chai": "^4.2.0", - "@types/chai": "^4.1.6" + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/arm-storage", "repository": { @@ -100,5 +98,21 @@ "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true -} + "//metadata": { + "constantPaths": [ + { + "path": "src/storageManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-storage?view=azure-node-preview" + } +} \ No newline at end of file diff --git a/sdk/storage/arm-storage/review/arm-storage.api.md b/sdk/storage/arm-storage/review/arm-storage.api.md index eeef45ba4774..60b812986bfa 100644 --- a/sdk/storage/arm-storage/review/arm-storage.api.md +++ b/sdk/storage/arm-storage/review/arm-storage.api.md @@ -47,14 +47,22 @@ export type AccountStatus = "available" | "unavailable"; // @public export interface ActiveDirectoryProperties { + accountType?: ActiveDirectoryPropertiesAccountType; azureStorageSid: string; domainGuid: string; domainName: string; domainSid: string; forestName: string; netBiosDomainName: string; + samAccountName?: string; } +// @public +export type ActiveDirectoryPropertiesAccountType = string; + +// @public +export type AllowedCopyScope = string; + // @public export type AzureEntityResource = Resource & { readonly etag?: string; @@ -414,11 +422,6 @@ export interface CloudError { error?: CloudErrorBody; } -// @public -export interface CloudErrorAutoGenerated { - error?: CloudErrorBodyAutoGenerated; -} - // @public export interface CloudErrorBody { code?: string; @@ -427,14 +430,6 @@ export interface CloudErrorBody { target?: string; } -// @public -export interface CloudErrorBodyAutoGenerated { - code?: string; - details?: CloudErrorBodyAutoGenerated[]; - message?: string; - target?: string; -} - // @public export interface CorsRule { allowedHeaders: string[]; @@ -555,6 +550,7 @@ export interface Encryption { // @public export interface EncryptionIdentity { + encryptionFederatedIdentityClientId?: string; encryptionUserAssignedIdentity?: string; } @@ -974,6 +970,22 @@ export enum KnownAccountImmutabilityPolicyState { Unlocked = "Unlocked" } +// @public +export enum KnownActiveDirectoryPropertiesAccountType { + // (undocumented) + Computer = "Computer", + // (undocumented) + User = "User" +} + +// @public +export enum KnownAllowedCopyScope { + // (undocumented) + AAD = "AAD", + // (undocumented) + PrivateLink = "PrivateLink" +} + // @public export enum KnownBlobInventoryPolicyName { // (undocumented) @@ -1602,6 +1614,83 @@ export interface ListTableServices { readonly value?: TableServiceProperties[]; } +// @public +export type LocalUser = Resource & { + readonly systemData?: SystemData; + permissionScopes?: PermissionScope[]; + homeDirectory?: string; + sshAuthorizedKeys?: SshPublicKey[]; + readonly sid?: string; + hasSharedKey?: boolean; + hasSshKey?: boolean; + hasSshPassword?: boolean; +}; + +// @public +export interface LocalUserKeys { + readonly sharedKey?: string; + sshAuthorizedKeys?: SshPublicKey[]; +} + +// @public +export interface LocalUserRegeneratePasswordResult { + readonly sshPassword?: string; +} + +// @public +export interface LocalUsers { + value?: LocalUser[]; +} + +// @public +export interface LocalUsersCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LocalUsersCreateOrUpdateResponse = LocalUser; + +// @public +export interface LocalUsersDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface LocalUsersGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LocalUsersGetResponse = LocalUser; + +// @public +export interface LocalUsersListKeysOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LocalUsersListKeysResponse = LocalUserKeys; + +// @public +export interface LocalUsersListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LocalUsersListResponse = LocalUsers; + +// @public +export interface LocalUsersOperations { + createOrUpdate(resourceGroupName: string, accountName: string, username: string, properties: LocalUser, options?: LocalUsersCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, accountName: string, username: string, options?: LocalUsersDeleteOptionalParams): Promise; + get(resourceGroupName: string, accountName: string, username: string, options?: LocalUsersGetOptionalParams): Promise; + list(resourceGroupName: string, accountName: string, options?: LocalUsersListOptionalParams): PagedAsyncIterableIterator; + listKeys(resourceGroupName: string, accountName: string, username: string, options?: LocalUsersListKeysOptionalParams): Promise; + regeneratePassword(resourceGroupName: string, accountName: string, username: string, options?: LocalUsersRegeneratePasswordOptionalParams): Promise; +} + +// @public +export interface LocalUsersRegeneratePasswordOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LocalUsersRegeneratePasswordResponse = LocalUserRegeneratePasswordResult; + // @public export interface ManagementPolicies { createOrUpdate(resourceGroupName: string, accountName: string, managementPolicyName: ManagementPolicyName, properties: ManagementPolicy, options?: ManagementPoliciesCreateOrUpdateOptionalParams): Promise; @@ -1828,6 +1917,13 @@ export type OperationsListResponse = OperationListResult; type Permissions_2 = string; export { Permissions_2 as Permissions } +// @public (undocumented) +export interface PermissionScope { + permissions: string; + resourceName: string; + service: string; +} + // @public export interface PrivateEndpoint { readonly id?: string; @@ -2177,6 +2273,12 @@ export interface SmbSetting { versions?: string; } +// @public (undocumented) +export interface SshPublicKey { + description?: string; + key?: string; +} + // @public export type State = string; @@ -2204,6 +2306,8 @@ export type StorageAccount = TrackedResource & { azureFilesIdentityBasedAuthentication?: AzureFilesIdentityBasedAuthentication; enableHttpsTrafficOnly?: boolean; readonly networkRuleSet?: NetworkRuleSet; + isSftpEnabled?: boolean; + isLocalUserEnabled?: boolean; isHnsEnabled?: boolean; readonly geoReplicationStats?: GeoReplicationStats; readonly failoverInProgress?: boolean; @@ -2219,6 +2323,7 @@ export type StorageAccount = TrackedResource & { defaultToOAuthAuthentication?: boolean; publicNetworkAccess?: PublicNetworkAccess; immutableStorageWithVersioning?: ImmutableStorageAccount; + allowedCopyScope?: AllowedCopyScope; }; // @public @@ -2232,6 +2337,7 @@ export interface StorageAccountCreateParameters { accessTier?: AccessTier; allowBlobPublicAccess?: boolean; allowCrossTenantReplication?: boolean; + allowedCopyScope?: AllowedCopyScope; allowSharedKeyAccess?: boolean; azureFilesIdentityBasedAuthentication?: AzureFilesIdentityBasedAuthentication; customDomain?: CustomDomain; @@ -2243,6 +2349,8 @@ export interface StorageAccountCreateParameters { identity?: Identity; immutableStorageWithVersioning?: ImmutableStorageAccount; isHnsEnabled?: boolean; + isLocalUserEnabled?: boolean; + isSftpEnabled?: boolean; keyPolicy?: KeyPolicy; kind: Kind; largeFileSharesState?: LargeFileSharesState; @@ -2455,6 +2563,7 @@ export interface StorageAccountUpdateParameters { accessTier?: AccessTier; allowBlobPublicAccess?: boolean; allowCrossTenantReplication?: boolean; + allowedCopyScope?: AllowedCopyScope; allowSharedKeyAccess?: boolean; azureFilesIdentityBasedAuthentication?: AzureFilesIdentityBasedAuthentication; customDomain?: CustomDomain; @@ -2463,6 +2572,8 @@ export interface StorageAccountUpdateParameters { encryption?: Encryption; identity?: Identity; immutableStorageWithVersioning?: ImmutableStorageAccount; + isLocalUserEnabled?: boolean; + isSftpEnabled?: boolean; keyPolicy?: KeyPolicy; kind?: Kind; largeFileSharesState?: LargeFileSharesState; @@ -2499,6 +2610,8 @@ export class StorageManagementClient extends coreClient.ServiceClient { // (undocumented) fileShares: FileShares; // (undocumented) + localUsersOperations: LocalUsersOperations; + // (undocumented) managementPolicies: ManagementPolicies; // (undocumented) objectReplicationPoliciesOperations: ObjectReplicationPoliciesOperations; diff --git a/sdk/storage/arm-storage/sample.env b/sdk/storage/arm-storage/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/storage/arm-storage/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/storage/arm-storage/samples-dev/acquireALeaseOnAContainer.ts b/sdk/storage/arm-storage/samples-dev/acquireALeaseOnAContainer.ts new file mode 100644 index 000000000000..e235beb0774b --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/acquireALeaseOnAContainer.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. +/** + * This sample demonstrates how to The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Acquire.json + */ +import { + LeaseContainerRequest, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function acquireALeaseOnAContainer() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const parameters: LeaseContainerRequest = { + action: "Acquire", + breakPeriod: undefined, + leaseDuration: -1, + leaseId: undefined, + proposedLeaseId: undefined + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lease( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +acquireALeaseOnAContainer().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/acquireALeaseOnAShare.ts b/sdk/storage/arm-storage/samples-dev/acquireALeaseOnAShare.ts new file mode 100644 index 000000000000..2c741d44433c --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/acquireALeaseOnAShare.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. +/** + * This sample demonstrates how to The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Acquire.json + */ +import { LeaseShareRequest, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function acquireALeaseOnAShare() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share124"; + const parameters: LeaseShareRequest = { + action: "Acquire", + breakPeriod: undefined, + leaseDuration: -1, + leaseId: undefined, + proposedLeaseId: undefined + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.lease( + resourceGroupName, + accountName, + shareName, + options + ); + console.log(result); +} + +acquireALeaseOnAShare().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/blobRangesRestore.ts b/sdk/storage/arm-storage/samples-dev/blobRangesRestore.ts new file mode 100644 index 000000000000..afae81fe8b07 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/blobRangesRestore.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. +/** + * This sample demonstrates how to Restore blobs in the specified blob ranges + * + * @summary Restore blobs in the specified blob ranges + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobRangesRestore.json + */ +import { + BlobRestoreParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function blobRangesRestore() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: BlobRestoreParameters = { + blobRanges: [ + { endRange: "container/blobpath2", startRange: "container/blobpath1" }, + { endRange: "", startRange: "container2/blobpath3" } + ], + timeToRestore: new Date("2019-04-20T15:30:00.0000000Z") + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginRestoreBlobRangesAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +blobRangesRestore().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/blobServicesPutLastAccessTimeBasedTracking.ts b/sdk/storage/arm-storage/samples-dev/blobServicesPutLastAccessTimeBasedTracking.ts new file mode 100644 index 000000000000..88bb720e93c3 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/blobServicesPutLastAccessTimeBasedTracking.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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json + */ +import { + BlobServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function blobServicesPutLastAccessTimeBasedTracking() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: BlobServiceProperties = { + lastAccessTimeTrackingPolicy: { + name: "AccessTimeTracking", + blobType: ["blockBlob"], + enable: true, + trackingGranularityInDays: 1 + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +blobServicesPutLastAccessTimeBasedTracking().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/breakALeaseOnAContainer.ts b/sdk/storage/arm-storage/samples-dev/breakALeaseOnAContainer.ts new file mode 100644 index 000000000000..645ca85ec195 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/breakALeaseOnAContainer.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. +/** + * This sample demonstrates how to The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Break.json + */ +import { + LeaseContainerRequest, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function breakALeaseOnAContainer() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const parameters: LeaseContainerRequest = { + action: "Break", + breakPeriod: undefined, + leaseDuration: undefined, + leaseId: "8698f513-fa75-44a1-b8eb-30ba336af27d", + proposedLeaseId: undefined + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lease( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +breakALeaseOnAContainer().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/breakALeaseOnAShare.ts b/sdk/storage/arm-storage/samples-dev/breakALeaseOnAShare.ts new file mode 100644 index 000000000000..4bded8ea5f55 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/breakALeaseOnAShare.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. +/** + * This sample demonstrates how to The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Break.json + */ +import { LeaseShareRequest, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function breakALeaseOnAShare() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share12"; + const parameters: LeaseShareRequest = { + action: "Break", + breakPeriod: undefined, + leaseDuration: undefined, + leaseId: "8698f513-fa75-44a1-b8eb-30ba336af27d", + proposedLeaseId: undefined + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.lease( + resourceGroupName, + accountName, + shareName, + options + ); + console.log(result); +} + +breakALeaseOnAShare().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/clearLegalHoldContainers.ts b/sdk/storage/arm-storage/samples-dev/clearLegalHoldContainers.ts new file mode 100644 index 000000000000..cf27258db70c --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/clearLegalHoldContainers.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. +/** + * This sample demonstrates how to Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * + * @summary Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersClearLegalHold.json + */ +import { LegalHold, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function clearLegalHoldContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold: LegalHold = { tags: ["tag1", "tag2", "tag3"] }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.clearLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +clearLegalHoldContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/createLocalUser.ts b/sdk/storage/arm-storage/samples-dev/createLocalUser.ts new file mode 100644 index 000000000000..dd96b341fd3b --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/createLocalUser.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. +/** + * This sample demonstrates how to Create or update the properties of a local user associated with the storage account + * + * @summary Create or update the properties of a local user associated with the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserCreate.json + */ +import { LocalUser, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const properties: LocalUser = { + hasSshPassword: true, + homeDirectory: "homedirectory", + permissionScopes: [ + { permissions: "rwd", resourceName: "share1", service: "file" }, + { permissions: "rw", resourceName: "share2", service: "file" } + ], + sshAuthorizedKeys: [ + { description: "key name", key: "ssh-rsa keykeykeykeykey=" } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.createOrUpdate( + resourceGroupName, + accountName, + username, + properties + ); + console.log(result); +} + +createLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/createNfsShares.ts b/sdk/storage/arm-storage/samples-dev/createNfsShares.ts new file mode 100644 index 000000000000..e3b59eccb4c4 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/createNfsShares.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_NFS.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createNfsShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res346"; + const accountName = "sto666"; + const shareName = "share1235"; + const fileShare: FileShare = { enabledProtocols: "NFS" }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +createNfsShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/createOrUpdateImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples-dev/createOrUpdateImmutabilityPolicy.ts new file mode 100644 index 000000000000..501a3797926f --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/createOrUpdateImmutabilityPolicy.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. +/** + * This sample demonstrates how to Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @summary Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicy.json + */ +import { + ImmutabilityPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const parameters: ImmutabilityPolicy = { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 3 + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.createOrUpdateImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +createOrUpdateImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.ts b/sdk/storage/arm-storage/samples-dev/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.ts new file mode 100644 index 000000000000..8a39a272ef81 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.ts @@ -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. +/** + * This sample demonstrates how to Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @summary Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll.json + */ +import { + ImmutabilityPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const parameters: ImmutabilityPolicy = { + allowProtectedAppendWritesAll: true, + immutabilityPeriodSinceCreationInDays: 3 + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.createOrUpdateImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples-dev/deleteContainers.ts b/sdk/storage/arm-storage/samples-dev/deleteContainers.ts new file mode 100644 index 000000000000..88efa773ad9c --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/deleteContainers.ts @@ -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. +/** + * This sample demonstrates how to Deletes specified container under its account. + * + * @summary Deletes specified container under its account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4079"; + const accountName = "sto4506"; + const containerName = "container9689"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.delete( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +deleteContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/deleteImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples-dev/deleteImmutabilityPolicy.ts new file mode 100644 index 000000000000..32f20895886f --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/deleteImmutabilityPolicy.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. +/** + * This sample demonstrates how to Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. + * + * @summary Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDeleteImmutabilityPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1581"; + const accountName = "sto9621"; + const containerName = "container4910"; + const ifMatch = '"8d59f81a7fa7be0"'; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.deleteImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch + ); + console.log(result); +} + +deleteImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/deleteLocalUser.ts b/sdk/storage/arm-storage/samples-dev/deleteLocalUser.ts new file mode 100644 index 000000000000..56c806bd7e1a --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/deleteLocalUser.ts @@ -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. +/** + * This sample demonstrates how to Deletes the local user associated with the specified storage account. + * + * @summary Deletes the local user associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.delete( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +deleteLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/deleteShares.ts b/sdk/storage/arm-storage/samples-dev/deleteShares.ts new file mode 100644 index 000000000000..8ab118e288d1 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/deleteShares.ts @@ -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. +/** + * This sample demonstrates how to Deletes specified share under its account. + * + * @summary Deletes specified share under its account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4079"; + const accountName = "sto4506"; + const shareName = "share9689"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.delete( + resourceGroupName, + accountName, + shareName + ); + console.log(result); +} + +deleteShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/deletedAccountGet.ts b/sdk/storage/arm-storage/samples-dev/deletedAccountGet.ts new file mode 100644 index 000000000000..dc379a6a9644 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/deletedAccountGet.ts @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Get properties of specified deleted account resource. + * + * @summary Get properties of specified deleted account resource. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deletedAccountGet() { + const subscriptionId = "{subscription-id}"; + const deletedAccountName = "sto1125"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.deletedAccounts.get(deletedAccountName, location); + console.log(result); +} + +deletedAccountGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/deletedAccountList.ts b/sdk/storage/arm-storage/samples-dev/deletedAccountList.ts new file mode 100644 index 000000000000..da0bd9a3c423 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/deletedAccountList.ts @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists deleted accounts under the subscription. + * + * @summary Lists deleted accounts under the subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deletedAccountList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deletedAccounts.list()) { + resArray.push(item); + } + console.log(resArray); +} + +deletedAccountList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/extendImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples-dev/extendImmutabilityPolicy.ts new file mode 100644 index 000000000000..92ff81bb5112 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/extendImmutabilityPolicy.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. +/** + * This sample demonstrates how to Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * + * @summary Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersExtendImmutabilityPolicy.json + */ +import { + ImmutabilityPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function extendImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6238"; + const accountName = "sto232"; + const containerName = "container5023"; + const ifMatch = '"8d59f830d0c3bf9"'; + const parameters: ImmutabilityPolicy = { + immutabilityPeriodSinceCreationInDays: 100 + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.extendImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch, + options + ); + console.log(result); +} + +extendImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/getBlobContainersGetWithAllowProtectedAppendWritesAll.ts b/sdk/storage/arm-storage/samples-dev/getBlobContainersGetWithAllowProtectedAppendWritesAll.ts new file mode 100644 index 000000000000..c4c37bd8f994 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/getBlobContainersGetWithAllowProtectedAppendWritesAll.ts @@ -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. +/** + * This sample demonstrates how to Gets properties of a specified container. + * + * @summary Gets properties of a specified container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getBlobContainersGetWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const containerName = "container1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.get( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +getBlobContainersGetWithAllowProtectedAppendWritesAll().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/getBlobServices.ts b/sdk/storage/arm-storage/samples-dev/getBlobServices.ts new file mode 100644 index 000000000000..c30c57b41e50 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/getBlobServices.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.getServiceProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +getBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/getContainers.ts b/sdk/storage/arm-storage/samples-dev/getContainers.ts new file mode 100644 index 000000000000..8e12a39ded3e --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/getContainers.ts @@ -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. +/** + * This sample demonstrates how to Gets properties of a specified container. + * + * @summary Gets properties of a specified container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const containerName = "container1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.get( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +getContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/getFileServices.ts b/sdk/storage/arm-storage/samples-dev/getFileServices.ts new file mode 100644 index 000000000000..530e31c01ba4 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/getFileServices.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.getServiceProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +getFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/getImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples-dev/getImmutabilityPolicy.ts new file mode 100644 index 000000000000..8f0765be7701 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/getImmutabilityPolicy.ts @@ -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. +/** + * This sample demonstrates how to Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @summary Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetImmutabilityPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res5221"; + const accountName = "sto9177"; + const containerName = "container3489"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.getImmutabilityPolicy( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +getImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/getLocalUser.ts b/sdk/storage/arm-storage/samples-dev/getLocalUser.ts new file mode 100644 index 000000000000..107a555f0c91 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/getLocalUser.ts @@ -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. +/** + * This sample demonstrates how to Get the local user of the storage account by username. + * + * @summary Get the local user of the storage account by username. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.get( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +getLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/getShareStats.ts b/sdk/storage/arm-storage/samples-dev/getShareStats.ts new file mode 100644 index 000000000000..622ea88ebc9c --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/getShareStats.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. +/** + * This sample demonstrates how to Gets properties of a specified share. + * + * @summary Gets properties of a specified share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet_Stats.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getShareStats() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const shareName = "share1634"; + const expand = "stats"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.get( + resourceGroupName, + accountName, + shareName, + options + ); + console.log(result); +} + +getShareStats().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/getShares.ts b/sdk/storage/arm-storage/samples-dev/getShares.ts new file mode 100644 index 000000000000..e5e2cf7e3f29 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/getShares.ts @@ -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. +/** + * This sample demonstrates how to Gets properties of a specified share. + * + * @summary Gets properties of a specified share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const shareName = "share1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.get( + resourceGroupName, + accountName, + shareName + ); + console.log(result); +} + +getShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listBlobServices.ts b/sdk/storage/arm-storage/samples-dev/listBlobServices.ts new file mode 100644 index 000000000000..4e105de62233 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listBlobServices.ts @@ -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. +/** + * This sample demonstrates how to List blob services of storage account. It returns a collection of one object named default. + * + * @summary List blob services of storage account. It returns a collection of one object named default. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobServices.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listContainers.ts b/sdk/storage/arm-storage/samples-dev/listContainers.ts new file mode 100644 index 000000000000..bdfe0e2a2cb1 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listContainers.ts @@ -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. +/** + * This sample demonstrates how to Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @summary Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobContainers.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listDeletedContainers.ts b/sdk/storage/arm-storage/samples-dev/listDeletedContainers.ts new file mode 100644 index 000000000000..ecf31494b8c7 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listDeletedContainers.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. +/** + * This sample demonstrates how to Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @summary Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedBlobContainersList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listDeletedContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const include = "deleted"; + const options = { include: include }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobContainers.list( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDeletedContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listDeletedShares.ts b/sdk/storage/arm-storage/samples-dev/listDeletedShares.ts new file mode 100644 index 000000000000..ede8fa2a2929 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listDeletedShares.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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedFileSharesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listDeletedShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const expand = "deleted"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDeletedShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listFileServices.ts b/sdk/storage/arm-storage/samples-dev/listFileServices.ts new file mode 100644 index 000000000000..87199dc12a48 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listFileServices.ts @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to List all file services in storage accounts + * + * @summary List all file services in storage accounts + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.list(resourceGroupName, accountName); + console.log(result); +} + +listFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listLocalUserKeys.ts b/sdk/storage/arm-storage/samples-dev/listLocalUserKeys.ts new file mode 100644 index 000000000000..4849af2c2031 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listLocalUserKeys.ts @@ -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. +/** + * This sample demonstrates how to List SSH authorized keys and shared key of the local user. + * + * @summary List SSH authorized keys and shared key of the local user. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserListKeys.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listLocalUserKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.listKeys( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +listLocalUserKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listLocalUsers.ts b/sdk/storage/arm-storage/samples-dev/listLocalUsers.ts new file mode 100644 index 000000000000..bf1b70863ce7 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listLocalUsers.ts @@ -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. +/** + * This sample demonstrates how to List the local users associated with the storage account. + * + * @summary List the local users associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUsersList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listLocalUsers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.localUsersOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listLocalUsers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listShareSnapshots.ts b/sdk/storage/arm-storage/samples-dev/listShareSnapshots.ts new file mode 100644 index 000000000000..14878083abb2 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listShareSnapshots.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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareSnapshotsList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listShareSnapshots() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const expand = "snapshots"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listShareSnapshots().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/listShares.ts b/sdk/storage/arm-storage/samples-dev/listShares.ts new file mode 100644 index 000000000000..98419d90a8dc --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/listShares.ts @@ -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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/lockImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples-dev/lockImmutabilityPolicy.ts new file mode 100644 index 000000000000..cf121a98416c --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/lockImmutabilityPolicy.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. +/** + * This sample demonstrates how to Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * + * @summary Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLockImmutabilityPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function lockImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res2702"; + const accountName = "sto5009"; + const containerName = "container1631"; + const ifMatch = '"8d59f825b721dd3"'; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lockImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch + ); + console.log(result); +} + +lockImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/nfsV3AccountCreate.ts b/sdk/storage/arm-storage/samples-dev/nfsV3AccountCreate.ts new file mode 100644 index 000000000000..64b0abfcd07d --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/nfsV3AccountCreate.ts @@ -0,0 +1,56 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/NfsV3AccountCreate.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function nfsV3AccountCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + isHnsEnabled: true, + enableNfsV3: true, + kind: "BlockBlobStorage", + location: "eastus", + networkRuleSet: { + bypass: "AzureServices", + defaultAction: "Allow", + ipRules: [], + virtualNetworkRules: [ + { + virtualNetworkResourceId: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Network/virtualNetworks/net123/subnets/subnet12" + } + ] + }, + sku: { name: "Premium_LRS" }, + enableHttpsTrafficOnly: false + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +nfsV3AccountCreate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/operationsList.ts b/sdk/storage/arm-storage/samples-dev/operationsList.ts new file mode 100644 index 000000000000..d3ed92178652 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/operationsList.ts @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all of the available Storage Rest API operations. + * + * @summary Lists all of the available Storage Rest API operations. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/OperationsList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putBlobServices.ts b/sdk/storage/arm-storage/samples-dev/putBlobServices.ts new file mode 100644 index 000000000000..8783cd8d594a --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putBlobServices.ts @@ -0,0 +1,79 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPut.json + */ +import { + BlobServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: BlobServiceProperties = { + changeFeed: { enabled: true, retentionInDays: 7 }, + cors: { + corsRules: [ + { + allowedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100 + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2 + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: [ + "http://www.abc23.com", + "https://www.fabrikam.com/*" + ], + exposedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x -ms-meta-target*" + ], + maxAgeInSeconds: 2000 + } + ] + }, + defaultServiceVersion: "2017-07-29", + deleteRetentionPolicy: { days: 300, enabled: true }, + isVersioningEnabled: true + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putContainerWithDefaultEncryptionScope.ts b/sdk/storage/arm-storage/samples-dev/putContainerWithDefaultEncryptionScope.ts new file mode 100644 index 000000000000..787f9df56e66 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putContainerWithDefaultEncryptionScope.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutDefaultEncryptionScope.json + */ +import { BlobContainer, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putContainerWithDefaultEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer: BlobContainer = { + defaultEncryptionScope: "encryptionscope185", + denyEncryptionScopeOverride: true + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainerWithDefaultEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putContainerWithObjectLevelWorm.ts b/sdk/storage/arm-storage/samples-dev/putContainerWithObjectLevelWorm.ts new file mode 100644 index 000000000000..156b9db832ca --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putContainerWithObjectLevelWorm.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutObjectLevelWorm.json + */ +import { BlobContainer, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putContainerWithObjectLevelWorm() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer: BlobContainer = { + immutableStorageWithVersioning: { enabled: true } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainerWithObjectLevelWorm().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putContainers.ts b/sdk/storage/arm-storage/samples-dev/putContainers.ts new file mode 100644 index 000000000000..4810d3313275 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putContainers.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPut.json + */ +import { BlobContainer, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer: BlobContainer = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putFileServices.ts b/sdk/storage/arm-storage/samples-dev/putFileServices.ts new file mode 100644 index 000000000000..26d074d21b2a --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putFileServices.ts @@ -0,0 +1,75 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut.json + */ +import { + FileServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: FileServiceProperties = { + cors: { + corsRules: [ + { + allowedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100 + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2 + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: [ + "http://www.abc23.com", + "https://www.fabrikam.com/*" + ], + exposedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + maxAgeInSeconds: 2000 + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putFileServicesEnableSecureSmbFeatures.ts b/sdk/storage/arm-storage/samples-dev/putFileServicesEnableSecureSmbFeatures.ts new file mode 100644 index 000000000000..e02f71924425 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putFileServicesEnableSecureSmbFeatures.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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSecureSmbFeatures.json + */ +import { + FileServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putFileServicesEnableSecureSmbFeatures() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: FileServiceProperties = { + protocolSettings: { + smb: { + authenticationMethods: "NTLMv2;Kerberos", + channelEncryption: "AES-128-CCM;AES-128-GCM;AES-256-GCM", + kerberosTicketEncryption: "RC4-HMAC;AES-256", + versions: "SMB2.1;SMB3.0;SMB3.1.1" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServicesEnableSecureSmbFeatures().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putFileServicesEnableSmbMultichannel.ts b/sdk/storage/arm-storage/samples-dev/putFileServicesEnableSmbMultichannel.ts new file mode 100644 index 000000000000..cacb5f72f5a6 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putFileServicesEnableSmbMultichannel.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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSMBMultichannel.json + */ +import { + FileServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putFileServicesEnableSmbMultichannel() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: FileServiceProperties = { + protocolSettings: { smb: { multichannel: { enabled: true } } } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServicesEnableSmbMultichannel().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putShares.ts b/sdk/storage/arm-storage/samples-dev/putShares.ts new file mode 100644 index 000000000000..6dbdfb87aa2b --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putShares.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare: FileShare = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +putShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/putSharesWithAccessTier.ts b/sdk/storage/arm-storage/samples-dev/putSharesWithAccessTier.ts new file mode 100644 index 000000000000..05658d18810c --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/putSharesWithAccessTier.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_AccessTier.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putSharesWithAccessTier() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res346"; + const accountName = "sto666"; + const shareName = "share1235"; + const fileShare: FileShare = { accessTier: "Hot" }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +putSharesWithAccessTier().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueOperationDelete.ts b/sdk/storage/arm-storage/samples-dev/queueOperationDelete.ts new file mode 100644 index 000000000000..4819a66383c8 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueOperationDelete.ts @@ -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. +/** + * This sample demonstrates how to Deletes the queue with the specified queue name, under the specified account if it exists. + * + * @summary Deletes the queue with the specified queue name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.delete( + resourceGroupName, + accountName, + queueName + ); + console.log(result); +} + +queueOperationDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueOperationGet.ts b/sdk/storage/arm-storage/samples-dev/queueOperationGet.ts new file mode 100644 index 000000000000..0fdd38e2ff5e --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueOperationGet.ts @@ -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. +/** + * This sample demonstrates how to Gets the queue with the specified queue name, under the specified account if it exists. + * + * @summary Gets the queue with the specified queue name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.get( + resourceGroupName, + accountName, + queueName + ); + console.log(result); +} + +queueOperationGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueOperationList.ts b/sdk/storage/arm-storage/samples-dev/queueOperationList.ts new file mode 100644 index 000000000000..4ca31cb2ee93 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueOperationList.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets a list of all the queues under the specified storage account + * + * @summary Gets a list of all the queues under the specified storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto328"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.queue.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +queueOperationList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueOperationPatch.ts b/sdk/storage/arm-storage/samples-dev/queueOperationPatch.ts new file mode 100644 index 000000000000..e1b8fc33047a --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueOperationPatch.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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPatch.json + */ +import { StorageQueue, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationPatch() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue: StorageQueue = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.update( + resourceGroupName, + accountName, + queueName, + queue + ); + console.log(result); +} + +queueOperationPatch().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueOperationPut.ts b/sdk/storage/arm-storage/samples-dev/queueOperationPut.ts new file mode 100644 index 000000000000..ec99ab868cb9 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueOperationPut.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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPut.json + */ +import { StorageQueue, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue: StorageQueue = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.create( + resourceGroupName, + accountName, + queueName, + queue + ); + console.log(result); +} + +queueOperationPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueOperationPutWithMetadata.ts b/sdk/storage/arm-storage/samples-dev/queueOperationPutWithMetadata.ts new file mode 100644 index 000000000000..5ac95d69c401 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueOperationPutWithMetadata.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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPutWithMetadata.json + */ +import { StorageQueue, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationPutWithMetadata() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue: StorageQueue = { + metadata: { sample1: "meta1", sample2: "meta2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.create( + resourceGroupName, + accountName, + queueName, + queue + ); + console.log(result); +} + +queueOperationPutWithMetadata().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueServicesGet.ts b/sdk/storage/arm-storage/samples-dev/queueServicesGet.ts new file mode 100644 index 000000000000..d3c34c442aac --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueServicesGet.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueServicesGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.getServiceProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +queueServicesGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueServicesList.ts b/sdk/storage/arm-storage/samples-dev/queueServicesList.ts new file mode 100644 index 000000000000..c5199bbdef2d --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueServicesList.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to List all queue services for the storage account + * + * @summary List all queue services for the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueServicesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.list( + resourceGroupName, + accountName + ); + console.log(result); +} + +queueServicesList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/queueServicesPut.ts b/sdk/storage/arm-storage/samples-dev/queueServicesPut.ts new file mode 100644 index 000000000000..7014b257d808 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/queueServicesPut.ts @@ -0,0 +1,75 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesPut.json + */ +import { + QueueServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueServicesPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: QueueServiceProperties = { + cors: { + corsRules: [ + { + allowedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100 + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2 + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: [ + "http://www.abc23.com", + "https://www.fabrikam.com/*" + ], + exposedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + maxAgeInSeconds: 2000 + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +queueServicesPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/regenerateLocalUserPassword.ts b/sdk/storage/arm-storage/samples-dev/regenerateLocalUserPassword.ts new file mode 100644 index 000000000000..5c821ddc446b --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/regenerateLocalUserPassword.ts @@ -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. +/** + * This sample demonstrates how to Regenerate the local user SSH password. + * + * @summary Regenerate the local user SSH password. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserRegeneratePassword.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function regenerateLocalUserPassword() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.regeneratePassword( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +regenerateLocalUserPassword().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/restoreShares.ts b/sdk/storage/arm-storage/samples-dev/restoreShares.ts new file mode 100644 index 000000000000..ca60098fc6f7 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/restoreShares.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. +/** + * This sample demonstrates how to Restore a file share within a valid retention days if share soft delete is enabled + * + * @summary Restore a file share within a valid retention days if share soft delete is enabled + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesRestore.json + */ +import { DeletedShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function restoreShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share1249"; + const deletedShare: DeletedShare = { + deletedShareName: "share1249", + deletedShareVersion: "1234567890" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.restore( + resourceGroupName, + accountName, + shareName, + deletedShare + ); + console.log(result); +} + +restoreShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/setLegalHoldContainers.ts b/sdk/storage/arm-storage/samples-dev/setLegalHoldContainers.ts new file mode 100644 index 000000000000..0bfed01f2f8e --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/setLegalHoldContainers.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. +/** + * This sample demonstrates how to Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @summary Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHold.json + */ +import { LegalHold, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function setLegalHoldContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold: LegalHold = { tags: ["tag1", "tag2", "tag3"] }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.setLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +setLegalHoldContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/setLegalHoldContainersWithAllowProtectedAppendWritesAll.ts b/sdk/storage/arm-storage/samples-dev/setLegalHoldContainersWithAllowProtectedAppendWritesAll.ts new file mode 100644 index 000000000000..07ab05a71884 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/setLegalHoldContainersWithAllowProtectedAppendWritesAll.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. +/** + * This sample demonstrates how to Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @summary Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHoldAllowProtectedAppendWritesAll.json + */ +import { LegalHold, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function setLegalHoldContainersWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold: LegalHold = { + allowProtectedAppendWritesAll: true, + tags: ["tag1", "tag2", "tag3"] + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.setLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +setLegalHoldContainersWithAllowProtectedAppendWritesAll().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/skuList.ts b/sdk/storage/arm-storage/samples-dev/skuList.ts new file mode 100644 index 000000000000..a25eb2c8a420 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/skuList.ts @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists the available SKUs supported by Microsoft.Storage for given subscription. + * + * @summary Lists the available SKUs supported by Microsoft.Storage for given subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/SKUList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function skuList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.skus.list()) { + resArray.push(item); + } + console.log(resArray); +} + +skuList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountAbortHierarchicalNamespaceMigration.ts b/sdk/storage/arm-storage/samples-dev/storageAccountAbortHierarchicalNamespaceMigration.ts new file mode 100644 index 000000000000..8e310256f743 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountAbortHierarchicalNamespaceMigration.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Abort live Migration of storage account to enable Hns + * + * @summary Abort live Migration of storage account to enable Hns + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountAbortHierarchicalNamespaceMigration.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountAbortHierarchicalNamespaceMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginAbortHierarchicalNamespaceMigrationAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountAbortHierarchicalNamespaceMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCheckNameAvailability.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCheckNameAvailability.ts new file mode 100644 index 000000000000..9c65263ecfe0 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCheckNameAvailability.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. +/** + * This sample demonstrates how to Checks that the storage account name is valid and is not already in use. + * + * @summary Checks that the storage account name is valid and is not already in use. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCheckNameAvailability.json + */ +import { + StorageAccountCheckNameAvailabilityParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCheckNameAvailability() { + const subscriptionId = "{subscription-id}"; + const accountName: StorageAccountCheckNameAvailabilityParameters = { + name: "sto3363", + type: "Microsoft.Storage/storageAccounts" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.checkNameAvailability( + accountName + ); + console.log(result); +} + +storageAccountCheckNameAvailability().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreate.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreate.ts new file mode 100644 index 000000000000..1856d388e00f --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreate.ts @@ -0,0 +1,65 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreate.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + defaultToOAuthAuthentication: false, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + isSftpEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateAllowedCopyScopeToAad.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateAllowedCopyScopeToAad.ts new file mode 100644 index 000000000000..b7666ed96180 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateAllowedCopyScopeToAad.ts @@ -0,0 +1,63 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateAllowedCopyScopeToAad() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "AAD", + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateAllowedCopyScopeToAad().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateAllowedCopyScopeToPrivateLink.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateAllowedCopyScopeToPrivateLink.ts new file mode 100644 index 000000000000..860a153fc421 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateAllowedCopyScopeToPrivateLink.ts @@ -0,0 +1,63 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateAllowedCopyScopeToPrivateLink() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "PrivateLink", + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateAllowedCopyScopeToPrivateLink().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateDisallowPublicNetworkAccess.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateDisallowPublicNetworkAccess.ts new file mode 100644 index 000000000000..117fa428a1ec --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateDisallowPublicNetworkAccess.ts @@ -0,0 +1,64 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateDisallowPublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + publicNetworkAccess: "Disabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateDisallowPublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateEnablePublicNetworkAccess.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateEnablePublicNetworkAccess.ts new file mode 100644 index 000000000000..1734aab52ce7 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateEnablePublicNetworkAccess.ts @@ -0,0 +1,64 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateEnablePublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + publicNetworkAccess: "Enabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateEnablePublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateObjectReplicationPolicyOnDestination.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateObjectReplicationPolicyOnDestination.ts new file mode 100644 index 000000000000..280814ab518f --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateObjectReplicationPolicyOnDestination.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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json + */ +import { + ObjectReplicationPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateObjectReplicationPolicyOnDestination() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "dst112"; + const objectReplicationPolicyId = "default"; + const properties: ObjectReplicationPolicy = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + sourceContainer: "scont139" + } + ], + sourceAccount: "src1122" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountCreateObjectReplicationPolicyOnDestination().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateObjectReplicationPolicyOnSource.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateObjectReplicationPolicyOnSource.ts new file mode 100644 index 000000000000..99102ae86a0b --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateObjectReplicationPolicyOnSource.ts @@ -0,0 +1,54 @@ +/* + * 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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json + */ +import { + ObjectReplicationPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateObjectReplicationPolicyOnSource() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "src1122"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties: ObjectReplicationPolicy = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { + minCreationTime: "2020-02-19T16:05:00Z", + prefixMatch: ["blobA", "blobB"] + }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139" + } + ], + sourceAccount: "src1122" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountCreateObjectReplicationPolicyOnSource().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.ts new file mode 100644 index 000000000000..f04f2de0e9f5 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.ts @@ -0,0 +1,66 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateUserAssignedEncryptionIdentityWithCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + encryption: { + encryptionIdentity: { + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}" + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": {} + } + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_LRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateUserAssignedEncryptionIdentityWithCmk().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.ts new file mode 100644 index 000000000000..70aabbb6662d --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.ts @@ -0,0 +1,68 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res131918"; + const accountName = "sto131918"; + const parameters: StorageAccountCreateParameters = { + encryption: { + encryptionIdentity: { + encryptionFederatedIdentityClientId: + "f83c6b1b-4d34-47e4-bb34-9d83df58b540", + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}" + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": {} + } + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_LRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountCreateWithImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples-dev/storageAccountCreateWithImmutabilityPolicy.ts new file mode 100644 index 000000000000..80f0de1ba0b7 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountCreateWithImmutabilityPolicy.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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateWithImmutabilityPolicy.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateWithImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + immutableStorageWithVersioning: { + enabled: true, + immutabilityPolicy: { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 15, + state: "Unlocked" + } + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_GRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateWithImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountDelete.ts b/sdk/storage/arm-storage/samples-dev/storageAccountDelete.ts new file mode 100644 index 000000000000..d7620767a972 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountDelete.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Deletes a storage account in Microsoft Azure. + * + * @summary Deletes a storage account in Microsoft Azure. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.delete( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountDeleteBlobInventoryPolicy.ts b/sdk/storage/arm-storage/samples-dev/storageAccountDeleteBlobInventoryPolicy.ts new file mode 100644 index 000000000000..c78997073511 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountDeleteBlobInventoryPolicy.ts @@ -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. +/** + * This sample demonstrates how to Deletes the blob inventory policy associated with the specified storage account. + * + * @summary Deletes the blob inventory policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteBlobInventoryPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDeleteBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const blobInventoryPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobInventoryPolicies.delete( + resourceGroupName, + accountName, + blobInventoryPolicyName + ); + console.log(result); +} + +storageAccountDeleteBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountDeleteManagementPolicies.ts b/sdk/storage/arm-storage/samples-dev/storageAccountDeleteManagementPolicies.ts new file mode 100644 index 000000000000..f35ea945e75f --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountDeleteManagementPolicies.ts @@ -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. +/** + * This sample demonstrates how to Deletes the managementpolicy associated with the specified storage account. + * + * @summary Deletes the managementpolicy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteManagementPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDeleteManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const managementPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.delete( + resourceGroupName, + accountName, + managementPolicyName + ); + console.log(result); +} + +storageAccountDeleteManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountDeleteObjectReplicationPolicies.ts b/sdk/storage/arm-storage/samples-dev/storageAccountDeleteObjectReplicationPolicies.ts new file mode 100644 index 000000000000..9ba035f94547 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountDeleteObjectReplicationPolicies.ts @@ -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. +/** + * This sample demonstrates how to Deletes the object replication policy associated with the specified storage account. + * + * @summary Deletes the object replication policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteObjectReplicationPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDeleteObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const objectReplicationPolicyId = "{objectReplicationPolicy-Id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.delete( + resourceGroupName, + accountName, + objectReplicationPolicyId + ); + console.log(result); +} + +storageAccountDeleteObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountDeletePrivateEndpointConnection.ts b/sdk/storage/arm-storage/samples-dev/storageAccountDeletePrivateEndpointConnection.ts new file mode 100644 index 000000000000..6399b7192493 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountDeletePrivateEndpointConnection.ts @@ -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. +/** + * This sample demonstrates how to Deletes the specified private endpoint connection associated with the storage account. + * + * @summary Deletes the specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeletePrivateEndpointConnection.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDeletePrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.delete( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +storageAccountDeletePrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountEnableAd.ts b/sdk/storage/arm-storage/samples-dev/storageAccountEnableAd.ts new file mode 100644 index 000000000000..be44c2db1248 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountEnableAd.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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableAD.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountEnableAd() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + azureFilesIdentityBasedAuthentication: { + activeDirectoryProperties: { + accountType: "User", + azureStorageSid: "S-1-5-21-2400535526-2334094090-2402026252-0012", + domainGuid: "aebfc118-9fa9-4732-a21f-d98e41a77ae1", + domainName: "adtest.com", + domainSid: "S-1-5-21-2400535526-2334094090-2402026252", + forestName: "adtest.com", + netBiosDomainName: "adtest.com", + samAccountName: "sam12498" + }, + directoryServiceOptions: "AD" + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountEnableAd().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountEnableCmk.ts b/sdk/storage/arm-storage/samples-dev/storageAccountEnableCmk.ts new file mode 100644 index 000000000000..632e82be5bf0 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountEnableCmk.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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableCMK.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountEnableCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + encryption: { + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountEnableCmk().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountEncryptionScopeList.ts b/sdk/storage/arm-storage/samples-dev/storageAccountEncryptionScopeList.ts new file mode 100644 index 000000000000..2aac5f479a38 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountEncryptionScopeList.ts @@ -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. +/** + * This sample demonstrates how to Lists all the encryption scopes available under the specified storage account. + * + * @summary Lists all the encryption scopes available under the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEncryptionScopeList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountEncryptionScopeList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.encryptionScopes.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountEncryptionScopeList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountFailover.ts b/sdk/storage/arm-storage/samples-dev/storageAccountFailover.ts new file mode 100644 index 000000000000..6c34e5ad2786 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountFailover.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @summary Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountFailover.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountFailover() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginFailoverAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountFailover().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountGetBlobInventoryPolicy.ts b/sdk/storage/arm-storage/samples-dev/storageAccountGetBlobInventoryPolicy.ts new file mode 100644 index 000000000000..4f246ace3f36 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountGetBlobInventoryPolicy.ts @@ -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. +/** + * This sample demonstrates how to Gets the blob inventory policy associated with the specified storage account. + * + * @summary Gets the blob inventory policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListBlobInventoryPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobInventoryPolicies.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountGetBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountGetEncryptionScope.ts b/sdk/storage/arm-storage/samples-dev/storageAccountGetEncryptionScope.ts new file mode 100644 index 000000000000..5d2c1d9f31e8 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountGetEncryptionScope.ts @@ -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. +/** + * This sample demonstrates how to Returns the properties for the specified encryption scope. + * + * @summary Returns the properties for the specified encryption scope. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetEncryptionScope.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.get( + resourceGroupName, + accountName, + encryptionScopeName + ); + console.log(result); +} + +storageAccountGetEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountGetManagementPolicies.ts b/sdk/storage/arm-storage/samples-dev/storageAccountGetManagementPolicies.ts new file mode 100644 index 000000000000..9f8e9daaf025 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountGetManagementPolicies.ts @@ -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. +/** + * This sample demonstrates how to Gets the managementpolicy associated with the specified storage account. + * + * @summary Gets the managementpolicy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetManagementPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const managementPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.get( + resourceGroupName, + accountName, + managementPolicyName + ); + console.log(result); +} + +storageAccountGetManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountGetObjectReplicationPolicies.ts b/sdk/storage/arm-storage/samples-dev/storageAccountGetObjectReplicationPolicies.ts new file mode 100644 index 000000000000..68373eb072b2 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountGetObjectReplicationPolicies.ts @@ -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. +/** + * This sample demonstrates how to Get the object replication policy of the storage account by policy ID. + * + * @summary Get the object replication policy of the storage account by policy ID. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetObjectReplicationPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const objectReplicationPolicyId = "{objectReplicationPolicy-Id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.get( + resourceGroupName, + accountName, + objectReplicationPolicyId + ); + console.log(result); +} + +storageAccountGetObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountGetPrivateEndpointConnection.ts b/sdk/storage/arm-storage/samples-dev/storageAccountGetPrivateEndpointConnection.ts new file mode 100644 index 000000000000..68e50dba8b26 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountGetPrivateEndpointConnection.ts @@ -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. +/** + * This sample demonstrates how to Gets the specified private endpoint connection associated with the storage account. + * + * @summary Gets the specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPrivateEndpointConnection.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetPrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +storageAccountGetPrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountGetProperties.ts b/sdk/storage/arm-storage/samples-dev/storageAccountGetProperties.ts new file mode 100644 index 000000000000..da501f553341 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountGetProperties.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @summary Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetProperties.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetProperties() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.getProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountGetProperties().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountGetPropertiesCmkEnabled.ts b/sdk/storage/arm-storage/samples-dev/storageAccountGetPropertiesCmkEnabled.ts new file mode 100644 index 000000000000..5bebe3c294eb --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountGetPropertiesCmkEnabled.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @summary Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPropertiesCMKEnabled.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetPropertiesCmkEnabled() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.getProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountGetPropertiesCmkEnabled().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountHierarchicalNamespaceMigration.ts b/sdk/storage/arm-storage/samples-dev/storageAccountHierarchicalNamespaceMigration.ts new file mode 100644 index 000000000000..331b4c1cad99 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountHierarchicalNamespaceMigration.ts @@ -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. +/** + * This sample demonstrates how to Live Migration of storage account to enable Hns + * + * @summary Live Migration of storage account to enable Hns + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountHierarchicalNamespaceMigration.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountHierarchicalNamespaceMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const requestType = "HnsOnValidationRequest"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginHierarchicalNamespaceMigrationAndWait( + resourceGroupName, + accountName, + requestType + ); + console.log(result); +} + +storageAccountHierarchicalNamespaceMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountList.ts b/sdk/storage/arm-storage/samples-dev/storageAccountList.ts new file mode 100644 index 000000000000..eb12c21b5bc5 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountList.ts @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @summary Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.list()) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountListAccountSas.ts b/sdk/storage/arm-storage/samples-dev/storageAccountListAccountSas.ts new file mode 100644 index 000000000000..3ce2cd77e1d2 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountListAccountSas.ts @@ -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. +/** + * This sample demonstrates how to List SAS credentials of a storage account. + * + * @summary List SAS credentials of a storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListAccountSAS.json + */ +import { + AccountSasParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListAccountSas() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7985"; + const accountName = "sto8588"; + const parameters: AccountSasParameters = { + keyToSign: "key1", + sharedAccessExpiryTime: new Date("2017-05-24T11:42:03.1567373Z"), + permissions: "r", + protocols: "https,http", + resourceTypes: "s", + services: "b", + sharedAccessStartTime: new Date("2017-05-24T10:42:03.1567373Z") + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listAccountSAS( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountListAccountSas().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountListByResourceGroup.ts b/sdk/storage/arm-storage/samples-dev/storageAccountListByResourceGroup.ts new file mode 100644 index 000000000000..20801e4d7454 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountListByResourceGroup.ts @@ -0,0 +1,34 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @summary Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListByResourceGroup.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListByResourceGroup() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6117"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListByResourceGroup().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountListKeys.ts b/sdk/storage/arm-storage/samples-dev/storageAccountListKeys.ts new file mode 100644 index 000000000000..34adce3fc961 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountListKeys.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. + * + * @summary Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListKeys.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res418"; + const accountName = "sto2220"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountListKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountListObjectReplicationPolicies.ts b/sdk/storage/arm-storage/samples-dev/storageAccountListObjectReplicationPolicies.ts new file mode 100644 index 000000000000..4e62fc31260c --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountListObjectReplicationPolicies.ts @@ -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. +/** + * This sample demonstrates how to List the object replication policies associated with the storage account. + * + * @summary List the object replication policies associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListObjectReplicationPolicies.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.objectReplicationPoliciesOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountListPrivateEndpointConnections.ts b/sdk/storage/arm-storage/samples-dev/storageAccountListPrivateEndpointConnections.ts new file mode 100644 index 000000000000..7150c8a6c5aa --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountListPrivateEndpointConnections.ts @@ -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. +/** + * This sample demonstrates how to List all the private endpoint connections associated with the storage account. + * + * @summary List all the private endpoint connections associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateEndpointConnections.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListPrivateEndpointConnections() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListPrivateEndpointConnections().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountListPrivateLinkResources.ts b/sdk/storage/arm-storage/samples-dev/storageAccountListPrivateLinkResources.ts new file mode 100644 index 000000000000..8b2111b10fb2 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountListPrivateLinkResources.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the private link resources that need to be created for a storage account. + * + * @summary Gets the private link resources that need to be created for a storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateLinkResources.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListPrivateLinkResources() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateLinkResources.listByStorageAccount( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountListPrivateLinkResources().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountListServiceSas.ts b/sdk/storage/arm-storage/samples-dev/storageAccountListServiceSas.ts new file mode 100644 index 000000000000..4574decb1c87 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountListServiceSas.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. +/** + * This sample demonstrates how to List service SAS credentials of a specific resource. + * + * @summary List service SAS credentials of a specific resource. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListServiceSAS.json + */ +import { + ServiceSasParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListServiceSas() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7439"; + const accountName = "sto1299"; + const parameters: ServiceSasParameters = { + canonicalizedResource: "/blob/sto1299/music", + sharedAccessExpiryTime: new Date("2017-05-24T11:32:48.8457197Z"), + permissions: "l", + resource: "c" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listServiceSAS( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountListServiceSas().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountPatchEncryptionScope.ts b/sdk/storage/arm-storage/samples-dev/storageAccountPatchEncryptionScope.ts new file mode 100644 index 000000000000..7f13eb63232e --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountPatchEncryptionScope.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. +/** + * This sample demonstrates how to Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. + * + * @summary Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPatchEncryptionScope.json + */ +import { EncryptionScope, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountPatchEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope: EncryptionScope = { + keyVaultProperties: { + keyUri: + "https://testvault.vault.core.windows.net/keys/key1/863425f1358359c" + }, + source: "Microsoft.KeyVault" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.patch( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPatchEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountPutEncryptionScope.ts b/sdk/storage/arm-storage/samples-dev/storageAccountPutEncryptionScope.ts new file mode 100644 index 000000000000..555521bd2244 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountPutEncryptionScope.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. +/** + * This sample demonstrates how to Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * + * @summary Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScope.json + */ +import { EncryptionScope, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountPutEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope: EncryptionScope = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.put( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPutEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountPutEncryptionScopeWithInfrastructureEncryption.ts b/sdk/storage/arm-storage/samples-dev/storageAccountPutEncryptionScopeWithInfrastructureEncryption.ts new file mode 100644 index 000000000000..0321dabc2254 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountPutEncryptionScopeWithInfrastructureEncryption.ts @@ -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. +/** + * This sample demonstrates how to Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * + * @summary Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json + */ +import { EncryptionScope, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountPutEncryptionScopeWithInfrastructureEncryption() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope: EncryptionScope = { + requireInfrastructureEncryption: true + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.put( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPutEncryptionScopeWithInfrastructureEncryption().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountPutPrivateEndpointConnection.ts b/sdk/storage/arm-storage/samples-dev/storageAccountPutPrivateEndpointConnection.ts new file mode 100644 index 000000000000..ad1a687c30e6 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountPutPrivateEndpointConnection.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. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection associated with the storage account. + * + * @summary Update the state of specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutPrivateEndpointConnection.json + */ +import { + PrivateEndpointConnection, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountPutPrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const properties: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.put( + resourceGroupName, + accountName, + privateEndpointConnectionName, + properties + ); + console.log(result); +} + +storageAccountPutPrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountRegenerateKerbKey.ts b/sdk/storage/arm-storage/samples-dev/storageAccountRegenerateKerbKey.ts new file mode 100644 index 000000000000..b6e765dcb34b --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountRegenerateKerbKey.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. +/** + * This sample demonstrates how to Regenerates one of the access keys or Kerberos keys for the specified storage account. + * + * @summary Regenerates one of the access keys or Kerberos keys for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKerbKey.json + */ +import { + StorageAccountRegenerateKeyParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountRegenerateKerbKey() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const regenerateKey: StorageAccountRegenerateKeyParameters = { + keyName: "kerb1" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.regenerateKey( + resourceGroupName, + accountName, + regenerateKey + ); + console.log(result); +} + +storageAccountRegenerateKerbKey().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountRegenerateKey.ts b/sdk/storage/arm-storage/samples-dev/storageAccountRegenerateKey.ts new file mode 100644 index 000000000000..b6de20f5c75f --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountRegenerateKey.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. +/** + * This sample demonstrates how to Regenerates one of the access keys or Kerberos keys for the specified storage account. + * + * @summary Regenerates one of the access keys or Kerberos keys for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKey.json + */ +import { + StorageAccountRegenerateKeyParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountRegenerateKey() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const regenerateKey: StorageAccountRegenerateKeyParameters = { + keyName: "key2" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.regenerateKey( + resourceGroupName, + accountName, + regenerateKey + ); + console.log(result); +} + +storageAccountRegenerateKey().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountRevokeUserDelegationKeys.ts b/sdk/storage/arm-storage/samples-dev/storageAccountRevokeUserDelegationKeys.ts new file mode 100644 index 000000000000..56ad306b3539 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountRevokeUserDelegationKeys.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Revoke user delegation keys. + * + * @summary Revoke user delegation keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRevokeUserDelegationKeys.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountRevokeUserDelegationKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.revokeUserDelegationKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountRevokeUserDelegationKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountSetBlobInventoryPolicy.ts b/sdk/storage/arm-storage/samples-dev/storageAccountSetBlobInventoryPolicy.ts new file mode 100644 index 000000000000..8bd61920f6c5 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountSetBlobInventoryPolicy.ts @@ -0,0 +1,98 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the blob inventory policy to the specified storage account. + * + * @summary Sets the blob inventory policy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetBlobInventoryPolicy.json + */ +import { + BlobInventoryPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const blobInventoryPolicyName = "default"; + const properties: BlobInventoryPolicy = { + policy: { + type: "Inventory", + enabled: true, + rules: [ + { + name: "inventoryPolicyRule1", + definition: { + format: "Csv", + filters: { + blobTypes: ["blockBlob", "appendBlob", "pageBlob"], + includeBlobVersions: true, + includeSnapshots: true, + prefixMatch: ["inventoryprefix1", "inventoryprefix2"] + }, + objectType: "Blob", + schedule: "Daily", + schemaFields: [ + "Name", + "Creation-Time", + "Last-Modified", + "Content-Length", + "Content-MD5", + "BlobType", + "AccessTier", + "AccessTierChangeTime", + "Snapshot", + "VersionId", + "IsCurrentVersion", + "Metadata" + ] + }, + destination: "container1", + enabled: true + }, + { + name: "inventoryPolicyRule2", + definition: { + format: "Parquet", + objectType: "Container", + schedule: "Weekly", + schemaFields: [ + "Name", + "Last-Modified", + "Metadata", + "LeaseStatus", + "LeaseState", + "LeaseDuration", + "PublicAccess", + "HasImmutabilityPolicy", + "HasLegalHold" + ] + }, + destination: "container2", + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobInventoryPolicies.createOrUpdate( + resourceGroupName, + accountName, + blobInventoryPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicies.ts b/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicies.ts new file mode 100644 index 000000000000..64ed927e799b --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicies.ts @@ -0,0 +1,83 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy.json + */ +import { ManagementPolicy, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties: ManagementPolicy = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 } + }, + snapshot: { delete: { daysAfterCreationGreaterThan: 30 } } + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer1"] + } + }, + enabled: true + }, + { + name: "olcmtest2", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 } + } + }, + filters: { + blobIndexMatch: [ + { name: "tag1", op: "==", value: "val1" }, + { name: "tag2", op: "==", value: "val2" } + ], + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer2"] + } + }, + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyForBlockAndAppendBlobs.ts b/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyForBlockAndAppendBlobs.ts new file mode 100644 index 000000000000..f0095c076a23 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyForBlockAndAppendBlobs.ts @@ -0,0 +1,58 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json + */ +import { ManagementPolicy, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetManagementPolicyForBlockAndAppendBlobs() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties: ManagementPolicy = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { delete: { daysAfterModificationGreaterThan: 90 } }, + snapshot: { delete: { daysAfterCreationGreaterThan: 90 } }, + version: { delete: { daysAfterCreationGreaterThan: 90 } } + }, + filters: { + blobTypes: ["blockBlob", "appendBlob"], + prefixMatch: ["olcmtestcontainer1"] + } + }, + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyForBlockAndAppendBlobs().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.ts b/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.ts new file mode 100644 index 000000000000..859973ffda59 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.ts @@ -0,0 +1,64 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json + */ +import { ManagementPolicy, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties: ManagementPolicy = { + policy: { + rules: [ + { + name: "olcmtest", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterLastAccessTimeGreaterThan: 1000 }, + enableAutoTierToHotFromCool: true, + tierToArchive: { daysAfterLastAccessTimeGreaterThan: 90 }, + tierToCool: { daysAfterLastAccessTimeGreaterThan: 30 } + }, + snapshot: { delete: { daysAfterCreationGreaterThan: 30 } } + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer"] + } + }, + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyWithSnapshotAndVersion.ts b/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyWithSnapshotAndVersion.ts new file mode 100644 index 000000000000..5d53480a7e10 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountSetManagementPolicyWithSnapshotAndVersion.ts @@ -0,0 +1,70 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json + */ +import { ManagementPolicy, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetManagementPolicyWithSnapshotAndVersion() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties: ManagementPolicy = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 } + }, + snapshot: { + delete: { daysAfterCreationGreaterThan: 1000 }, + tierToArchive: { daysAfterCreationGreaterThan: 90 }, + tierToCool: { daysAfterCreationGreaterThan: 30 } + }, + version: { + delete: { daysAfterCreationGreaterThan: 1000 }, + tierToArchive: { daysAfterCreationGreaterThan: 90 }, + tierToCool: { daysAfterCreationGreaterThan: 30 } + } + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer1"] + } + }, + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyWithSnapshotAndVersion().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountUpdate.ts b/sdk/storage/arm-storage/samples-dev/storageAccountUpdate.ts new file mode 100644 index 000000000000..c8ca85d6cd32 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountUpdate.ts @@ -0,0 +1,69 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdate.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + defaultToOAuthAuthentication: false, + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + isLocalUserEnabled: true, + isSftpEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47" + } + ] + }, + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountUpdateAllowedCopyScopeToAad.ts b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateAllowedCopyScopeToAad.ts new file mode 100644 index 000000000000..aede1a452048 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateAllowedCopyScopeToAad.ts @@ -0,0 +1,67 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateAllowedCopyScopeToAad() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "AAD", + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47" + } + ] + }, + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateAllowedCopyScopeToAad().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountUpdateDisablePublicNetworkAccess.ts b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateDisablePublicNetworkAccess.ts new file mode 100644 index 000000000000..fd1370df1322 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateDisablePublicNetworkAccess.ts @@ -0,0 +1,67 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateDisablePublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47" + } + ] + }, + publicNetworkAccess: "Disabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateDisablePublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountUpdateObjectReplicationPolicyOnDestination.ts b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateObjectReplicationPolicyOnDestination.ts new file mode 100644 index 000000000000..501108735bb8 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateObjectReplicationPolicyOnDestination.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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json + */ +import { + ObjectReplicationPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateObjectReplicationPolicyOnDestination() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "dst112"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties: ObjectReplicationPolicy = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139" + }, + { destinationContainer: "dcont179", sourceContainer: "scont179" } + ], + sourceAccount: "src1122" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountUpdateObjectReplicationPolicyOnDestination().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountUpdateObjectReplicationPolicyOnSource.ts b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateObjectReplicationPolicyOnSource.ts new file mode 100644 index 000000000000..d9afedc19bbe --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateObjectReplicationPolicyOnSource.ts @@ -0,0 +1,56 @@ +/* + * 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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json + */ +import { + ObjectReplicationPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateObjectReplicationPolicyOnSource() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "src1122"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties: ObjectReplicationPolicy = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139" + }, + { + destinationContainer: "dcont179", + ruleId: "cfbb4bc2-8b60-429f-b05a-d1e0942b33b2", + sourceContainer: "scont179" + } + ], + sourceAccount: "src1122" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountUpdateObjectReplicationPolicyOnSource().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.ts b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.ts new file mode 100644 index 000000000000..0ba1e638de15 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.ts @@ -0,0 +1,65 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateUserAssignedEncryptionIdentityWithCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountUpdateParameters = { + encryption: { + encryptionIdentity: { + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}" + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": {} + } + }, + kind: "Storage", + sku: { name: "Standard_LRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateUserAssignedEncryptionIdentityWithCmk().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.ts b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.ts new file mode 100644 index 000000000000..9fc5a12de9b4 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.ts @@ -0,0 +1,67 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res131918"; + const accountName = "sto131918"; + const parameters: StorageAccountUpdateParameters = { + encryption: { + encryptionIdentity: { + encryptionFederatedIdentityClientId: + "3109d1c4-a5de-4d84-8832-feabb916a4b6", + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}" + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": {} + } + }, + kind: "Storage", + sku: { name: "Standard_LRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples-dev/storageAccountUpdateWithImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateWithImmutabilityPolicy.ts new file mode 100644 index 000000000000..0c07e5103463 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/storageAccountUpdateWithImmutabilityPolicy.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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateWithImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + immutableStorageWithVersioning: { + enabled: true, + immutabilityPolicy: { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 15, + state: "Locked" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateWithImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/tableOperationDelete.ts b/sdk/storage/arm-storage/samples-dev/tableOperationDelete.ts new file mode 100644 index 000000000000..5629481a1982 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/tableOperationDelete.ts @@ -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. +/** + * This sample demonstrates how to Deletes the table with the specified table name, under the specified account if it exists. + * + * @summary Deletes the table with the specified table name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.delete( + resourceGroupName, + accountName, + tableName + ); + console.log(result); +} + +tableOperationDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/tableOperationGet.ts b/sdk/storage/arm-storage/samples-dev/tableOperationGet.ts new file mode 100644 index 000000000000..659ede877889 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/tableOperationGet.ts @@ -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. +/** + * This sample demonstrates how to Gets the table with the specified table name, under the specified account if it exists. + * + * @summary Gets the table with the specified table name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.get( + resourceGroupName, + accountName, + tableName + ); + console.log(result); +} + +tableOperationGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/tableOperationList.ts b/sdk/storage/arm-storage/samples-dev/tableOperationList.ts new file mode 100644 index 000000000000..0deb0cb9c435 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/tableOperationList.ts @@ -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. +/** + * This sample demonstrates how to Gets a list of all the tables under the specified storage account + * + * @summary Gets a list of all the tables under the specified storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto328"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tableOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +tableOperationList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/tableOperationPatch.ts b/sdk/storage/arm-storage/samples-dev/tableOperationPatch.ts new file mode 100644 index 000000000000..7fcef4e91bd1 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/tableOperationPatch.ts @@ -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. +/** + * This sample demonstrates how to Creates a new table with the specified table name, under the specified account. + * + * @summary Creates a new table with the specified table name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPatch.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationPatch() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.update( + resourceGroupName, + accountName, + tableName + ); + console.log(result); +} + +tableOperationPatch().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/tableOperationPut.ts b/sdk/storage/arm-storage/samples-dev/tableOperationPut.ts new file mode 100644 index 000000000000..7ba3555c5934 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/tableOperationPut.ts @@ -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. +/** + * This sample demonstrates how to Creates a new table with the specified table name, under the specified account. + * + * @summary Creates a new table with the specified table name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPut.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.create( + resourceGroupName, + accountName, + tableName + ); + console.log(result); +} + +tableOperationPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/tableServicesGet.ts b/sdk/storage/arm-storage/samples-dev/tableServicesGet.ts new file mode 100644 index 000000000000..b5dd1517e1c7 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/tableServicesGet.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableServicesGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.getServiceProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +tableServicesGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/tableServicesList.ts b/sdk/storage/arm-storage/samples-dev/tableServicesList.ts new file mode 100644 index 000000000000..02dcabebebda --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/tableServicesList.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to List all table services for the storage account. + * + * @summary List all table services for the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableServicesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.list( + resourceGroupName, + accountName + ); + console.log(result); +} + +tableServicesList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/tableServicesPut.ts b/sdk/storage/arm-storage/samples-dev/tableServicesPut.ts new file mode 100644 index 000000000000..3b64d590d779 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/tableServicesPut.ts @@ -0,0 +1,75 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesPut.json + */ +import { + TableServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableServicesPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: TableServiceProperties = { + cors: { + corsRules: [ + { + allowedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100 + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2 + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: [ + "http://www.abc23.com", + "https://www.fabrikam.com/*" + ], + exposedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + maxAgeInSeconds: 2000 + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +tableServicesPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/updateContainers.ts b/sdk/storage/arm-storage/samples-dev/updateContainers.ts new file mode 100644 index 000000000000..e104e536d480 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/updateContainers.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. +/** + * This sample demonstrates how to Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @summary Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPatch.json + */ +import { BlobContainer, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer: BlobContainer = { + metadata: { metadata: "true" }, + publicAccess: "Container" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.update( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +updateContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/updateLocalUser.ts b/sdk/storage/arm-storage/samples-dev/updateLocalUser.ts new file mode 100644 index 000000000000..691f42d1eac8 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/updateLocalUser.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. +/** + * This sample demonstrates how to Create or update the properties of a local user associated with the storage account + * + * @summary Create or update the properties of a local user associated with the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserUpdate.json + */ +import { LocalUser, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const properties: LocalUser = { + hasSharedKey: false, + hasSshKey: false, + hasSshPassword: false, + homeDirectory: "homedirectory2" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.createOrUpdate( + resourceGroupName, + accountName, + username, + properties + ); + console.log(result); +} + +updateLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/updateShareAcls.ts b/sdk/storage/arm-storage/samples-dev/updateShareAcls.ts new file mode 100644 index 000000000000..a227af5cd77b --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/updateShareAcls.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. +/** + * This sample demonstrates how to Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * + * @summary Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareAclsPatch.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateShareAcls() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare: FileShare = { + signedIdentifiers: [ + { + accessPolicy: { + expiryTime: new Date("2021-05-01T08:49:37.0000000Z"), + permission: "rwd", + startTime: new Date("2021-04-01T08:49:37.0000000Z") + }, + id: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI" + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.update( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +updateShareAcls().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/updateShares.ts b/sdk/storage/arm-storage/samples-dev/updateShares.ts new file mode 100644 index 000000000000..0dff5cefc37f --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/updateShares.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. +/** + * This sample demonstrates how to Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * + * @summary Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPatch.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare: FileShare = { metadata: { type: "image" } }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.update( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +updateShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/usageList.ts b/sdk/storage/arm-storage/samples-dev/usageList.ts new file mode 100644 index 000000000000..d66e806f3fbf --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/usageList.ts @@ -0,0 +1,32 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the current usage count and the limit for the resources of the location under the subscription. + * + * @summary Gets the current usage count and the limit for the resources of the location under the subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListLocationUsage.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function usageList() { + const subscriptionId = "{subscription-id}"; + const location = "eastus2(stage)"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.listByLocation(location)) { + resArray.push(item); + } + console.log(resArray); +} + +usageList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples-dev/versionLevelWormContainerMigration.ts b/sdk/storage/arm-storage/samples-dev/versionLevelWormContainerMigration.ts new file mode 100644 index 000000000000..6835e37833f7 --- /dev/null +++ b/sdk/storage/arm-storage/samples-dev/versionLevelWormContainerMigration.ts @@ -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. +/** + * This sample demonstrates how to This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. + * + * @summary This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/ObjectLevelWormContainerMigration.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function versionLevelWormContainerMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.beginObjectLevelWormAndWait( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +versionLevelWormContainerMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/README.md b/sdk/storage/arm-storage/samples/v17/javascript/README.md new file mode 100644 index 000000000000..c3b7df5dad28 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/README.md @@ -0,0 +1,312 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [acquireALeaseOnAContainer.js][acquirealeaseonacontainer] | The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Acquire.json | +| [acquireALeaseOnAShare.js][acquirealeaseonashare] | The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Acquire.json | +| [blobRangesRestore.js][blobrangesrestore] | Restore blobs in the specified blob ranges x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobRangesRestore.json | +| [blobServicesPutLastAccessTimeBasedTracking.js][blobservicesputlastaccesstimebasedtracking] | Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json | +| [breakALeaseOnAContainer.js][breakaleaseonacontainer] | The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Break.json | +| [breakALeaseOnAShare.js][breakaleaseonashare] | The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Break.json | +| [clearLegalHoldContainers.js][clearlegalholdcontainers] | Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersClearLegalHold.json | +| [createLocalUser.js][createlocaluser] | Create or update the properties of a local user associated with the storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserCreate.json | +| [createNfsShares.js][createnfsshares] | Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_NFS.json | +| [createOrUpdateImmutabilityPolicy.js][createorupdateimmutabilitypolicy] | Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicy.json | +| [createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.js][createorupdateimmutabilitypolicywithallowprotectedappendwritesall] | Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll.json | +| [deleteContainers.js][deletecontainers] | Deletes specified container under its account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDelete.json | +| [deleteImmutabilityPolicy.js][deleteimmutabilitypolicy] | Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDeleteImmutabilityPolicy.json | +| [deleteLocalUser.js][deletelocaluser] | Deletes the local user associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserDelete.json | +| [deleteShares.js][deleteshares] | Deletes specified share under its account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesDelete.json | +| [deletedAccountGet.js][deletedaccountget] | Get properties of specified deleted account resource. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountGet.json | +| [deletedAccountList.js][deletedaccountlist] | Lists deleted accounts under the subscription. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountList.json | +| [extendImmutabilityPolicy.js][extendimmutabilitypolicy] | Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersExtendImmutabilityPolicy.json | +| [getBlobContainersGetWithAllowProtectedAppendWritesAll.js][getblobcontainersgetwithallowprotectedappendwritesall] | Gets properties of a specified container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json | +| [getBlobServices.js][getblobservices] | Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesGet.json | +| [getContainers.js][getcontainers] | Gets properties of a specified container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGet.json | +| [getFileServices.js][getfileservices] | Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesGet.json | +| [getImmutabilityPolicy.js][getimmutabilitypolicy] | Gets the existing immutability policy along with the corresponding ETag in response headers and body. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetImmutabilityPolicy.json | +| [getLocalUser.js][getlocaluser] | Get the local user of the storage account by username. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserGet.json | +| [getShareStats.js][getsharestats] | Gets properties of a specified share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet_Stats.json | +| [getShares.js][getshares] | Gets properties of a specified share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet.json | +| [listBlobServices.js][listblobservices] | List blob services of storage account. It returns a collection of one object named default. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesList.json | +| [listContainers.js][listcontainers] | Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersList.json | +| [listDeletedContainers.js][listdeletedcontainers] | Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedBlobContainersList.json | +| [listDeletedShares.js][listdeletedshares] | Lists all shares. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedFileSharesList.json | +| [listFileServices.js][listfileservices] | List all file services in storage accounts x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesList.json | +| [listLocalUserKeys.js][listlocaluserkeys] | List SSH authorized keys and shared key of the local user. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserListKeys.json | +| [listLocalUsers.js][listlocalusers] | List the local users associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUsersList.json | +| [listShareSnapshots.js][listsharesnapshots] | Lists all shares. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareSnapshotsList.json | +| [listShares.js][listshares] | Lists all shares. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesList.json | +| [lockImmutabilityPolicy.js][lockimmutabilitypolicy] | Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLockImmutabilityPolicy.json | +| [nfsV3AccountCreate.js][nfsv3accountcreate] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/NfsV3AccountCreate.json | +| [operationsList.js][operationslist] | Lists all of the available Storage Rest API operations. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/OperationsList.json | +| [putBlobServices.js][putblobservices] | Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPut.json | +| [putContainerWithDefaultEncryptionScope.js][putcontainerwithdefaultencryptionscope] | Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutDefaultEncryptionScope.json | +| [putContainerWithObjectLevelWorm.js][putcontainerwithobjectlevelworm] | Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutObjectLevelWorm.json | +| [putContainers.js][putcontainers] | Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPut.json | +| [putFileServices.js][putfileservices] | Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut.json | +| [putFileServicesEnableSecureSmbFeatures.js][putfileservicesenablesecuresmbfeatures] | Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSecureSmbFeatures.json | +| [putFileServicesEnableSmbMultichannel.js][putfileservicesenablesmbmultichannel] | Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSMBMultichannel.json | +| [putShares.js][putshares] | Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut.json | +| [putSharesWithAccessTier.js][putshareswithaccesstier] | Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_AccessTier.json | +| [queueOperationDelete.js][queueoperationdelete] | Deletes the queue with the specified queue name, under the specified account if it exists. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationDelete.json | +| [queueOperationGet.js][queueoperationget] | Gets the queue with the specified queue name, under the specified account if it exists. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationGet.json | +| [queueOperationList.js][queueoperationlist] | Gets a list of all the queues under the specified storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationList.json | +| [queueOperationPatch.js][queueoperationpatch] | Creates a new queue with the specified queue name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPatch.json | +| [queueOperationPut.js][queueoperationput] | Creates a new queue with the specified queue name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPut.json | +| [queueOperationPutWithMetadata.js][queueoperationputwithmetadata] | Creates a new queue with the specified queue name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPutWithMetadata.json | +| [queueServicesGet.js][queueservicesget] | Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesGet.json | +| [queueServicesList.js][queueserviceslist] | List all queue services for the storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesList.json | +| [queueServicesPut.js][queueservicesput] | Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesPut.json | +| [regenerateLocalUserPassword.js][regeneratelocaluserpassword] | Regenerate the local user SSH password. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserRegeneratePassword.json | +| [restoreShares.js][restoreshares] | Restore a file share within a valid retention days if share soft delete is enabled x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesRestore.json | +| [setLegalHoldContainers.js][setlegalholdcontainers] | Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHold.json | +| [setLegalHoldContainersWithAllowProtectedAppendWritesAll.js][setlegalholdcontainerswithallowprotectedappendwritesall] | Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHoldAllowProtectedAppendWritesAll.json | +| [skuList.js][skulist] | Lists the available SKUs supported by Microsoft.Storage for given subscription. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/SKUList.json | +| [storageAccountAbortHierarchicalNamespaceMigration.js][storageaccountaborthierarchicalnamespacemigration] | Abort live Migration of storage account to enable Hns x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountAbortHierarchicalNamespaceMigration.json | +| [storageAccountCheckNameAvailability.js][storageaccountchecknameavailability] | Checks that the storage account name is valid and is not already in use. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCheckNameAvailability.json | +| [storageAccountCreate.js][storageaccountcreate] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreate.json | +| [storageAccountCreateAllowedCopyScopeToAad.js][storageaccountcreateallowedcopyscopetoaad] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json | +| [storageAccountCreateAllowedCopyScopeToPrivateLink.js][storageaccountcreateallowedcopyscopetoprivatelink] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json | +| [storageAccountCreateDisallowPublicNetworkAccess.js][storageaccountcreatedisallowpublicnetworkaccess] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json | +| [storageAccountCreateEnablePublicNetworkAccess.js][storageaccountcreateenablepublicnetworkaccess] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json | +| [storageAccountCreateObjectReplicationPolicyOnDestination.js][storageaccountcreateobjectreplicationpolicyondestination] | Create or update the object replication policy of the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json | +| [storageAccountCreateObjectReplicationPolicyOnSource.js][storageaccountcreateobjectreplicationpolicyonsource] | Create or update the object replication policy of the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json | +| [storageAccountCreateUserAssignedEncryptionIdentityWithCmk.js][storageaccountcreateuserassignedencryptionidentitywithcmk] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json | +| [storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.js][storageaccountcreateuserassignedidentitywithfederatedidentityclientid] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json | +| [storageAccountCreateWithImmutabilityPolicy.js][storageaccountcreatewithimmutabilitypolicy] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateWithImmutabilityPolicy.json | +| [storageAccountDelete.js][storageaccountdelete] | Deletes a storage account in Microsoft Azure. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDelete.json | +| [storageAccountDeleteBlobInventoryPolicy.js][storageaccountdeleteblobinventorypolicy] | Deletes the blob inventory policy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteBlobInventoryPolicy.json | +| [storageAccountDeleteManagementPolicies.js][storageaccountdeletemanagementpolicies] | Deletes the managementpolicy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteManagementPolicy.json | +| [storageAccountDeleteObjectReplicationPolicies.js][storageaccountdeleteobjectreplicationpolicies] | Deletes the object replication policy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteObjectReplicationPolicy.json | +| [storageAccountDeletePrivateEndpointConnection.js][storageaccountdeleteprivateendpointconnection] | Deletes the specified private endpoint connection associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeletePrivateEndpointConnection.json | +| [storageAccountEnableAd.js][storageaccountenablead] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableAD.json | +| [storageAccountEnableCmk.js][storageaccountenablecmk] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableCMK.json | +| [storageAccountEncryptionScopeList.js][storageaccountencryptionscopelist] | Lists all the encryption scopes available under the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEncryptionScopeList.json | +| [storageAccountFailover.js][storageaccountfailover] | Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountFailover.json | +| [storageAccountGetBlobInventoryPolicy.js][storageaccountgetblobinventorypolicy] | Gets the blob inventory policy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListBlobInventoryPolicy.json | +| [storageAccountGetEncryptionScope.js][storageaccountgetencryptionscope] | Returns the properties for the specified encryption scope. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetEncryptionScope.json | +| [storageAccountGetManagementPolicies.js][storageaccountgetmanagementpolicies] | Gets the managementpolicy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetManagementPolicy.json | +| [storageAccountGetObjectReplicationPolicies.js][storageaccountgetobjectreplicationpolicies] | Get the object replication policy of the storage account by policy ID. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetObjectReplicationPolicy.json | +| [storageAccountGetPrivateEndpointConnection.js][storageaccountgetprivateendpointconnection] | Gets the specified private endpoint connection associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPrivateEndpointConnection.json | +| [storageAccountGetProperties.js][storageaccountgetproperties] | Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetProperties.json | +| [storageAccountGetPropertiesCmkEnabled.js][storageaccountgetpropertiescmkenabled] | Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPropertiesCMKEnabled.json | +| [storageAccountHierarchicalNamespaceMigration.js][storageaccounthierarchicalnamespacemigration] | Live Migration of storage account to enable Hns x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountHierarchicalNamespaceMigration.json | +| [storageAccountList.js][storageaccountlist] | Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountList.json | +| [storageAccountListAccountSas.js][storageaccountlistaccountsas] | List SAS credentials of a storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListAccountSAS.json | +| [storageAccountListByResourceGroup.js][storageaccountlistbyresourcegroup] | Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListByResourceGroup.json | +| [storageAccountListKeys.js][storageaccountlistkeys] | Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListKeys.json | +| [storageAccountListObjectReplicationPolicies.js][storageaccountlistobjectreplicationpolicies] | List the object replication policies associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListObjectReplicationPolicies.json | +| [storageAccountListPrivateEndpointConnections.js][storageaccountlistprivateendpointconnections] | List all the private endpoint connections associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateEndpointConnections.json | +| [storageAccountListPrivateLinkResources.js][storageaccountlistprivatelinkresources] | Gets the private link resources that need to be created for a storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateLinkResources.json | +| [storageAccountListServiceSas.js][storageaccountlistservicesas] | List service SAS credentials of a specific resource. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListServiceSAS.json | +| [storageAccountPatchEncryptionScope.js][storageaccountpatchencryptionscope] | Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPatchEncryptionScope.json | +| [storageAccountPutEncryptionScope.js][storageaccountputencryptionscope] | Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScope.json | +| [storageAccountPutEncryptionScopeWithInfrastructureEncryption.js][storageaccountputencryptionscopewithinfrastructureencryption] | Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json | +| [storageAccountPutPrivateEndpointConnection.js][storageaccountputprivateendpointconnection] | Update the state of specified private endpoint connection associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutPrivateEndpointConnection.json | +| [storageAccountRegenerateKerbKey.js][storageaccountregeneratekerbkey] | Regenerates one of the access keys or Kerberos keys for the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKerbKey.json | +| [storageAccountRegenerateKey.js][storageaccountregeneratekey] | Regenerates one of the access keys or Kerberos keys for the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKey.json | +| [storageAccountRevokeUserDelegationKeys.js][storageaccountrevokeuserdelegationkeys] | Revoke user delegation keys. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRevokeUserDelegationKeys.json | +| [storageAccountSetBlobInventoryPolicy.js][storageaccountsetblobinventorypolicy] | Sets the blob inventory policy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetBlobInventoryPolicy.json | +| [storageAccountSetManagementPolicies.js][storageaccountsetmanagementpolicies] | Sets the managementpolicy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy.json | +| [storageAccountSetManagementPolicyForBlockAndAppendBlobs.js][storageaccountsetmanagementpolicyforblockandappendblobs] | Sets the managementpolicy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json | +| [storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.js][storageaccountsetmanagementpolicylastaccesstimebasedblobactions] | Sets the managementpolicy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json | +| [storageAccountSetManagementPolicyWithSnapshotAndVersion.js][storageaccountsetmanagementpolicywithsnapshotandversion] | Sets the managementpolicy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json | +| [storageAccountUpdate.js][storageaccountupdate] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdate.json | +| [storageAccountUpdateAllowedCopyScopeToAad.js][storageaccountupdateallowedcopyscopetoaad] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json | +| [storageAccountUpdateDisablePublicNetworkAccess.js][storageaccountupdatedisablepublicnetworkaccess] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json | +| [storageAccountUpdateObjectReplicationPolicyOnDestination.js][storageaccountupdateobjectreplicationpolicyondestination] | Create or update the object replication policy of the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json | +| [storageAccountUpdateObjectReplicationPolicyOnSource.js][storageaccountupdateobjectreplicationpolicyonsource] | Create or update the object replication policy of the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json | +| [storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.js][storageaccountupdateuserassignedencryptionidentitywithcmk] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json | +| [storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.js][storageaccountupdateuserassignedidentitywithfederatedidentityclientid] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json | +| [storageAccountUpdateWithImmutabilityPolicy.js][storageaccountupdatewithimmutabilitypolicy] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json | +| [tableOperationDelete.js][tableoperationdelete] | Deletes the table with the specified table name, under the specified account if it exists. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationDelete.json | +| [tableOperationGet.js][tableoperationget] | Gets the table with the specified table name, under the specified account if it exists. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationGet.json | +| [tableOperationList.js][tableoperationlist] | Gets a list of all the tables under the specified storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationList.json | +| [tableOperationPatch.js][tableoperationpatch] | Creates a new table with the specified table name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPatch.json | +| [tableOperationPut.js][tableoperationput] | Creates a new table with the specified table name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPut.json | +| [tableServicesGet.js][tableservicesget] | Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesGet.json | +| [tableServicesList.js][tableserviceslist] | List all table services for the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesList.json | +| [tableServicesPut.js][tableservicesput] | Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesPut.json | +| [updateContainers.js][updatecontainers] | Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPatch.json | +| [updateLocalUser.js][updatelocaluser] | Create or update the properties of a local user associated with the storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserUpdate.json | +| [updateShareAcls.js][updateshareacls] | Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareAclsPatch.json | +| [updateShares.js][updateshares] | Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPatch.json | +| [usageList.js][usagelist] | Gets the current usage count and the limit for the resources of the location under the subscription. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListLocationUsage.json | +| [versionLevelWormContainerMigration.js][versionlevelwormcontainermigration] | This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/ObjectLevelWormContainerMigration.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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 acquireALeaseOnAContainer.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 node acquireALeaseOnAContainer.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[acquirealeaseonacontainer]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/acquireALeaseOnAContainer.js +[acquirealeaseonashare]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/acquireALeaseOnAShare.js +[blobrangesrestore]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/blobRangesRestore.js +[blobservicesputlastaccesstimebasedtracking]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/blobServicesPutLastAccessTimeBasedTracking.js +[breakaleaseonacontainer]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/breakALeaseOnAContainer.js +[breakaleaseonashare]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/breakALeaseOnAShare.js +[clearlegalholdcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/clearLegalHoldContainers.js +[createlocaluser]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/createLocalUser.js +[createnfsshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/createNfsShares.js +[createorupdateimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/createOrUpdateImmutabilityPolicy.js +[createorupdateimmutabilitypolicywithallowprotectedappendwritesall]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.js +[deletecontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/deleteContainers.js +[deleteimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/deleteImmutabilityPolicy.js +[deletelocaluser]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/deleteLocalUser.js +[deleteshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/deleteShares.js +[deletedaccountget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/deletedAccountGet.js +[deletedaccountlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/deletedAccountList.js +[extendimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/extendImmutabilityPolicy.js +[getblobcontainersgetwithallowprotectedappendwritesall]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/getBlobContainersGetWithAllowProtectedAppendWritesAll.js +[getblobservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/getBlobServices.js +[getcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/getContainers.js +[getfileservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/getFileServices.js +[getimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/getImmutabilityPolicy.js +[getlocaluser]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/getLocalUser.js +[getsharestats]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/getShareStats.js +[getshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/getShares.js +[listblobservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listBlobServices.js +[listcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listContainers.js +[listdeletedcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listDeletedContainers.js +[listdeletedshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listDeletedShares.js +[listfileservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listFileServices.js +[listlocaluserkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listLocalUserKeys.js +[listlocalusers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listLocalUsers.js +[listsharesnapshots]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listShareSnapshots.js +[listshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/listShares.js +[lockimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/lockImmutabilityPolicy.js +[nfsv3accountcreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/nfsV3AccountCreate.js +[operationslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/operationsList.js +[putblobservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putBlobServices.js +[putcontainerwithdefaultencryptionscope]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putContainerWithDefaultEncryptionScope.js +[putcontainerwithobjectlevelworm]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putContainerWithObjectLevelWorm.js +[putcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putContainers.js +[putfileservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putFileServices.js +[putfileservicesenablesecuresmbfeatures]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putFileServicesEnableSecureSmbFeatures.js +[putfileservicesenablesmbmultichannel]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putFileServicesEnableSmbMultichannel.js +[putshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putShares.js +[putshareswithaccesstier]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/putSharesWithAccessTier.js +[queueoperationdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueOperationDelete.js +[queueoperationget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueOperationGet.js +[queueoperationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueOperationList.js +[queueoperationpatch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPatch.js +[queueoperationput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPut.js +[queueoperationputwithmetadata]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPutWithMetadata.js +[queueservicesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueServicesGet.js +[queueserviceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueServicesList.js +[queueservicesput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/queueServicesPut.js +[regeneratelocaluserpassword]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/regenerateLocalUserPassword.js +[restoreshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/restoreShares.js +[setlegalholdcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/setLegalHoldContainers.js +[setlegalholdcontainerswithallowprotectedappendwritesall]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/setLegalHoldContainersWithAllowProtectedAppendWritesAll.js +[skulist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/skuList.js +[storageaccountaborthierarchicalnamespacemigration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountAbortHierarchicalNamespaceMigration.js +[storageaccountchecknameavailability]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCheckNameAvailability.js +[storageaccountcreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreate.js +[storageaccountcreateallowedcopyscopetoaad]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateAllowedCopyScopeToAad.js +[storageaccountcreateallowedcopyscopetoprivatelink]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateAllowedCopyScopeToPrivateLink.js +[storageaccountcreatedisallowpublicnetworkaccess]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateDisallowPublicNetworkAccess.js +[storageaccountcreateenablepublicnetworkaccess]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateEnablePublicNetworkAccess.js +[storageaccountcreateobjectreplicationpolicyondestination]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateObjectReplicationPolicyOnDestination.js +[storageaccountcreateobjectreplicationpolicyonsource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateObjectReplicationPolicyOnSource.js +[storageaccountcreateuserassignedencryptionidentitywithcmk]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.js +[storageaccountcreateuserassignedidentitywithfederatedidentityclientid]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.js +[storageaccountcreatewithimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateWithImmutabilityPolicy.js +[storageaccountdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDelete.js +[storageaccountdeleteblobinventorypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteBlobInventoryPolicy.js +[storageaccountdeletemanagementpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteManagementPolicies.js +[storageaccountdeleteobjectreplicationpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteObjectReplicationPolicies.js +[storageaccountdeleteprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeletePrivateEndpointConnection.js +[storageaccountenablead]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEnableAd.js +[storageaccountenablecmk]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEnableCmk.js +[storageaccountencryptionscopelist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEncryptionScopeList.js +[storageaccountfailover]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountFailover.js +[storageaccountgetblobinventorypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetBlobInventoryPolicy.js +[storageaccountgetencryptionscope]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetEncryptionScope.js +[storageaccountgetmanagementpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetManagementPolicies.js +[storageaccountgetobjectreplicationpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetObjectReplicationPolicies.js +[storageaccountgetprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetPrivateEndpointConnection.js +[storageaccountgetproperties]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetProperties.js +[storageaccountgetpropertiescmkenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetPropertiesCmkEnabled.js +[storageaccounthierarchicalnamespacemigration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountHierarchicalNamespaceMigration.js +[storageaccountlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountList.js +[storageaccountlistaccountsas]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListAccountSas.js +[storageaccountlistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListByResourceGroup.js +[storageaccountlistkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListKeys.js +[storageaccountlistobjectreplicationpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListObjectReplicationPolicies.js +[storageaccountlistprivateendpointconnections]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListPrivateEndpointConnections.js +[storageaccountlistprivatelinkresources]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListPrivateLinkResources.js +[storageaccountlistservicesas]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListServiceSas.js +[storageaccountpatchencryptionscope]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPatchEncryptionScope.js +[storageaccountputencryptionscope]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutEncryptionScope.js +[storageaccountputencryptionscopewithinfrastructureencryption]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutEncryptionScopeWithInfrastructureEncryption.js +[storageaccountputprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutPrivateEndpointConnection.js +[storageaccountregeneratekerbkey]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRegenerateKerbKey.js +[storageaccountregeneratekey]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRegenerateKey.js +[storageaccountrevokeuserdelegationkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRevokeUserDelegationKeys.js +[storageaccountsetblobinventorypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetBlobInventoryPolicy.js +[storageaccountsetmanagementpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicies.js +[storageaccountsetmanagementpolicyforblockandappendblobs]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyForBlockAndAppendBlobs.js +[storageaccountsetmanagementpolicylastaccesstimebasedblobactions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.js +[storageaccountsetmanagementpolicywithsnapshotandversion]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyWithSnapshotAndVersion.js +[storageaccountupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdate.js +[storageaccountupdateallowedcopyscopetoaad]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateAllowedCopyScopeToAad.js +[storageaccountupdatedisablepublicnetworkaccess]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateDisablePublicNetworkAccess.js +[storageaccountupdateobjectreplicationpolicyondestination]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateObjectReplicationPolicyOnDestination.js +[storageaccountupdateobjectreplicationpolicyonsource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateObjectReplicationPolicyOnSource.js +[storageaccountupdateuserassignedencryptionidentitywithcmk]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.js +[storageaccountupdateuserassignedidentitywithfederatedidentityclientid]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.js +[storageaccountupdatewithimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateWithImmutabilityPolicy.js +[tableoperationdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/tableOperationDelete.js +[tableoperationget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/tableOperationGet.js +[tableoperationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/tableOperationList.js +[tableoperationpatch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/tableOperationPatch.js +[tableoperationput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/tableOperationPut.js +[tableservicesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/tableServicesGet.js +[tableserviceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/tableServicesList.js +[tableservicesput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/tableServicesPut.js +[updatecontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/updateContainers.js +[updatelocaluser]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/updateLocalUser.js +[updateshareacls]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/updateShareAcls.js +[updateshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/updateShares.js +[usagelist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/usageList.js +[versionlevelwormcontainermigration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/javascript/versionLevelWormContainerMigration.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storage?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/arm-storage/README.md diff --git a/sdk/storage/arm-storage/samples/v17/javascript/acquireALeaseOnAContainer.js b/sdk/storage/arm-storage/samples/v17/javascript/acquireALeaseOnAContainer.js new file mode 100644 index 000000000000..0fb147569008 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/acquireALeaseOnAContainer.js @@ -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. +/** + * This sample demonstrates how to The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Acquire.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function acquireALeaseOnAContainer() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const parameters = { + action: "Acquire", + breakPeriod: undefined, + leaseDuration: -1, + leaseId: undefined, + proposedLeaseId: undefined, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lease( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +acquireALeaseOnAContainer().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/acquireALeaseOnAShare.js b/sdk/storage/arm-storage/samples/v17/javascript/acquireALeaseOnAShare.js new file mode 100644 index 000000000000..e87820e218f0 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/acquireALeaseOnAShare.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. +/** + * This sample demonstrates how to The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Acquire.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function acquireALeaseOnAShare() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share124"; + const parameters = { + action: "Acquire", + breakPeriod: undefined, + leaseDuration: -1, + leaseId: undefined, + proposedLeaseId: undefined, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.lease(resourceGroupName, accountName, shareName, options); + console.log(result); +} + +acquireALeaseOnAShare().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/blobRangesRestore.js b/sdk/storage/arm-storage/samples/v17/javascript/blobRangesRestore.js new file mode 100644 index 000000000000..3cdcde2a85b3 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/blobRangesRestore.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. +/** + * This sample demonstrates how to Restore blobs in the specified blob ranges + * + * @summary Restore blobs in the specified blob ranges + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobRangesRestore.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function blobRangesRestore() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + blobRanges: [ + { endRange: "container/blobpath2", startRange: "container/blobpath1" }, + { endRange: "", startRange: "container2/blobpath3" }, + ], + timeToRestore: new Date("2019-04-20T15:30:00.0000000Z"), + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginRestoreBlobRangesAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +blobRangesRestore().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/blobServicesPutLastAccessTimeBasedTracking.js b/sdk/storage/arm-storage/samples/v17/javascript/blobServicesPutLastAccessTimeBasedTracking.js new file mode 100644 index 000000000000..330c3cf88084 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/blobServicesPutLastAccessTimeBasedTracking.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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function blobServicesPutLastAccessTimeBasedTracking() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters = { + lastAccessTimeTrackingPolicy: { + name: "AccessTimeTracking", + blobType: ["blockBlob"], + enable: true, + trackingGranularityInDays: 1, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +blobServicesPutLastAccessTimeBasedTracking().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/breakALeaseOnAContainer.js b/sdk/storage/arm-storage/samples/v17/javascript/breakALeaseOnAContainer.js new file mode 100644 index 000000000000..bb146d8011e7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/breakALeaseOnAContainer.js @@ -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. +/** + * This sample demonstrates how to The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Break.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function breakALeaseOnAContainer() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const parameters = { + action: "Break", + breakPeriod: undefined, + leaseDuration: undefined, + leaseId: "8698f513-fa75-44a1-b8eb-30ba336af27d", + proposedLeaseId: undefined, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lease( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +breakALeaseOnAContainer().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/breakALeaseOnAShare.js b/sdk/storage/arm-storage/samples/v17/javascript/breakALeaseOnAShare.js new file mode 100644 index 000000000000..cad780978031 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/breakALeaseOnAShare.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. +/** + * This sample demonstrates how to The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Break.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function breakALeaseOnAShare() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share12"; + const parameters = { + action: "Break", + breakPeriod: undefined, + leaseDuration: undefined, + leaseId: "8698f513-fa75-44a1-b8eb-30ba336af27d", + proposedLeaseId: undefined, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.lease(resourceGroupName, accountName, shareName, options); + console.log(result); +} + +breakALeaseOnAShare().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/clearLegalHoldContainers.js b/sdk/storage/arm-storage/samples/v17/javascript/clearLegalHoldContainers.js new file mode 100644 index 000000000000..c90feec3decc --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/clearLegalHoldContainers.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. +/** + * This sample demonstrates how to Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * + * @summary Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersClearLegalHold.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function clearLegalHoldContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold = { tags: ["tag1", "tag2", "tag3"] }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.clearLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +clearLegalHoldContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/createLocalUser.js b/sdk/storage/arm-storage/samples/v17/javascript/createLocalUser.js new file mode 100644 index 000000000000..6a0c807777e4 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/createLocalUser.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. +/** + * This sample demonstrates how to Create or update the properties of a local user associated with the storage account + * + * @summary Create or update the properties of a local user associated with the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserCreate.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const properties = { + hasSshPassword: true, + homeDirectory: "homedirectory", + permissionScopes: [ + { permissions: "rwd", resourceName: "share1", service: "file" }, + { permissions: "rw", resourceName: "share2", service: "file" }, + ], + sshAuthorizedKeys: [{ description: "key name", key: "ssh-rsa keykeykeykeykey=" }], + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.createOrUpdate( + resourceGroupName, + accountName, + username, + properties + ); + console.log(result); +} + +createLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/createNfsShares.js b/sdk/storage/arm-storage/samples/v17/javascript/createNfsShares.js new file mode 100644 index 000000000000..33d8cd812c48 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/createNfsShares.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_NFS.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createNfsShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res346"; + const accountName = "sto666"; + const shareName = "share1235"; + const fileShare = { enabledProtocols: "NFS" }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +createNfsShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/createOrUpdateImmutabilityPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/createOrUpdateImmutabilityPolicy.js new file mode 100644 index 000000000000..928dae616aa4 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/createOrUpdateImmutabilityPolicy.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. +/** + * This sample demonstrates how to Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @summary Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const parameters = { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 3, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.createOrUpdateImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +createOrUpdateImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.js b/sdk/storage/arm-storage/samples/v17/javascript/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.js new file mode 100644 index 000000000000..a9d63c6f655e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.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. +/** + * This sample demonstrates how to Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @summary Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const parameters = { + allowProtectedAppendWritesAll: true, + immutabilityPeriodSinceCreationInDays: 3, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.createOrUpdateImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/deleteContainers.js b/sdk/storage/arm-storage/samples/v17/javascript/deleteContainers.js new file mode 100644 index 000000000000..5fa265253d01 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/deleteContainers.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Deletes specified container under its account. + * + * @summary Deletes specified container under its account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDelete.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deleteContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4079"; + const accountName = "sto4506"; + const containerName = "container9689"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.delete(resourceGroupName, accountName, containerName); + console.log(result); +} + +deleteContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/deleteImmutabilityPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/deleteImmutabilityPolicy.js new file mode 100644 index 000000000000..900693c254f8 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/deleteImmutabilityPolicy.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. +/** + * This sample demonstrates how to Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. + * + * @summary Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDeleteImmutabilityPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deleteImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1581"; + const accountName = "sto9621"; + const containerName = "container4910"; + const ifMatch = '"8d59f81a7fa7be0"'; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.deleteImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch + ); + console.log(result); +} + +deleteImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/deleteLocalUser.js b/sdk/storage/arm-storage/samples/v17/javascript/deleteLocalUser.js new file mode 100644 index 000000000000..89f8d7c08ec0 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/deleteLocalUser.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Deletes the local user associated with the specified storage account. + * + * @summary Deletes the local user associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserDelete.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deleteLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.delete(resourceGroupName, accountName, username); + console.log(result); +} + +deleteLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/deleteShares.js b/sdk/storage/arm-storage/samples/v17/javascript/deleteShares.js new file mode 100644 index 000000000000..b4916ee5d807 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/deleteShares.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Deletes specified share under its account. + * + * @summary Deletes specified share under its account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesDelete.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deleteShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4079"; + const accountName = "sto4506"; + const shareName = "share9689"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.delete(resourceGroupName, accountName, shareName); + console.log(result); +} + +deleteShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/deletedAccountGet.js b/sdk/storage/arm-storage/samples/v17/javascript/deletedAccountGet.js new file mode 100644 index 000000000000..3109584bb976 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/deletedAccountGet.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Get properties of specified deleted account resource. + * + * @summary Get properties of specified deleted account resource. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deletedAccountGet() { + const subscriptionId = "{subscription-id}"; + const deletedAccountName = "sto1125"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.deletedAccounts.get(deletedAccountName, location); + console.log(result); +} + +deletedAccountGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/deletedAccountList.js b/sdk/storage/arm-storage/samples/v17/javascript/deletedAccountList.js new file mode 100644 index 000000000000..bb5df153df78 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/deletedAccountList.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists deleted accounts under the subscription. + * + * @summary Lists deleted accounts under the subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function deletedAccountList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deletedAccounts.list()) { + resArray.push(item); + } + console.log(resArray); +} + +deletedAccountList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/extendImmutabilityPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/extendImmutabilityPolicy.js new file mode 100644 index 000000000000..8b5ebd697089 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/extendImmutabilityPolicy.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. +/** + * This sample demonstrates how to Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * + * @summary Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersExtendImmutabilityPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function extendImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6238"; + const accountName = "sto232"; + const containerName = "container5023"; + const ifMatch = '"8d59f830d0c3bf9"'; + const parameters = { + immutabilityPeriodSinceCreationInDays: 100, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.extendImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch, + options + ); + console.log(result); +} + +extendImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/getBlobContainersGetWithAllowProtectedAppendWritesAll.js b/sdk/storage/arm-storage/samples/v17/javascript/getBlobContainersGetWithAllowProtectedAppendWritesAll.js new file mode 100644 index 000000000000..d5f96ac90dba --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/getBlobContainersGetWithAllowProtectedAppendWritesAll.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets properties of a specified container. + * + * @summary Gets properties of a specified container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getBlobContainersGetWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const containerName = "container1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.get(resourceGroupName, accountName, containerName); + console.log(result); +} + +getBlobContainersGetWithAllowProtectedAppendWritesAll().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/getBlobServices.js b/sdk/storage/arm-storage/samples/v17/javascript/getBlobServices.js new file mode 100644 index 000000000000..380f09be0855 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/getBlobServices.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.getServiceProperties(resourceGroupName, accountName); + console.log(result); +} + +getBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/getContainers.js b/sdk/storage/arm-storage/samples/v17/javascript/getContainers.js new file mode 100644 index 000000000000..69ecd4cf817e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/getContainers.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets properties of a specified container. + * + * @summary Gets properties of a specified container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const containerName = "container1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.get(resourceGroupName, accountName, containerName); + console.log(result); +} + +getContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/getFileServices.js b/sdk/storage/arm-storage/samples/v17/javascript/getFileServices.js new file mode 100644 index 000000000000..946022d79805 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/getFileServices.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.getServiceProperties(resourceGroupName, accountName); + console.log(result); +} + +getFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/getImmutabilityPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/getImmutabilityPolicy.js new file mode 100644 index 000000000000..5196781c1472 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/getImmutabilityPolicy.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. +/** + * This sample demonstrates how to Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @summary Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetImmutabilityPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res5221"; + const accountName = "sto9177"; + const containerName = "container3489"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.getImmutabilityPolicy( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +getImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/getLocalUser.js b/sdk/storage/arm-storage/samples/v17/javascript/getLocalUser.js new file mode 100644 index 000000000000..6b4fdfe894cf --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/getLocalUser.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Get the local user of the storage account by username. + * + * @summary Get the local user of the storage account by username. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.get(resourceGroupName, accountName, username); + console.log(result); +} + +getLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/getShareStats.js b/sdk/storage/arm-storage/samples/v17/javascript/getShareStats.js new file mode 100644 index 000000000000..63fb75fd7602 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/getShareStats.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets properties of a specified share. + * + * @summary Gets properties of a specified share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet_Stats.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getShareStats() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const shareName = "share1634"; + const expand = "stats"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.get(resourceGroupName, accountName, shareName, options); + console.log(result); +} + +getShareStats().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/getShares.js b/sdk/storage/arm-storage/samples/v17/javascript/getShares.js new file mode 100644 index 000000000000..0c8f141e20b7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/getShares.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets properties of a specified share. + * + * @summary Gets properties of a specified share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const shareName = "share1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.get(resourceGroupName, accountName, shareName); + console.log(result); +} + +getShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listBlobServices.js b/sdk/storage/arm-storage/samples/v17/javascript/listBlobServices.js new file mode 100644 index 000000000000..ca10afb42f3f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listBlobServices.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to List blob services of storage account. It returns a collection of one object named default. + * + * @summary List blob services of storage account. It returns a collection of one object named default. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobServices.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +listBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listContainers.js b/sdk/storage/arm-storage/samples/v17/javascript/listContainers.js new file mode 100644 index 000000000000..b6e42caf3fc1 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listContainers.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @summary Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobContainers.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +listContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listDeletedContainers.js b/sdk/storage/arm-storage/samples/v17/javascript/listDeletedContainers.js new file mode 100644 index 000000000000..a6d4ea703455 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listDeletedContainers.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. +/** + * This sample demonstrates how to Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @summary Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedBlobContainersList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listDeletedContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const include = "deleted"; + const options = { include: include }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobContainers.list(resourceGroupName, accountName, options)) { + resArray.push(item); + } + console.log(resArray); +} + +listDeletedContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listDeletedShares.js b/sdk/storage/arm-storage/samples/v17/javascript/listDeletedShares.js new file mode 100644 index 000000000000..fd971c24795d --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listDeletedShares.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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedFileSharesList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listDeletedShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const expand = "deleted"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list(resourceGroupName, accountName, options)) { + resArray.push(item); + } + console.log(resArray); +} + +listDeletedShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listFileServices.js b/sdk/storage/arm-storage/samples/v17/javascript/listFileServices.js new file mode 100644 index 000000000000..32d5cbac8a92 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listFileServices.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to List all file services in storage accounts + * + * @summary List all file services in storage accounts + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.list(resourceGroupName, accountName); + console.log(result); +} + +listFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listLocalUserKeys.js b/sdk/storage/arm-storage/samples/v17/javascript/listLocalUserKeys.js new file mode 100644 index 000000000000..444e8cbda918 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listLocalUserKeys.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. +/** + * This sample demonstrates how to List SSH authorized keys and shared key of the local user. + * + * @summary List SSH authorized keys and shared key of the local user. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserListKeys.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listLocalUserKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.listKeys( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +listLocalUserKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listLocalUsers.js b/sdk/storage/arm-storage/samples/v17/javascript/listLocalUsers.js new file mode 100644 index 000000000000..d7575d7a4a12 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listLocalUsers.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to List the local users associated with the storage account. + * + * @summary List the local users associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUsersList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listLocalUsers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.localUsersOperations.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +listLocalUsers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listShareSnapshots.js b/sdk/storage/arm-storage/samples/v17/javascript/listShareSnapshots.js new file mode 100644 index 000000000000..28f682ab2495 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listShareSnapshots.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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareSnapshotsList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listShareSnapshots() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const expand = "snapshots"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list(resourceGroupName, accountName, options)) { + resArray.push(item); + } + console.log(resArray); +} + +listShareSnapshots().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/listShares.js b/sdk/storage/arm-storage/samples/v17/javascript/listShares.js new file mode 100644 index 000000000000..2887ba493d14 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/listShares.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function listShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +listShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/lockImmutabilityPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/lockImmutabilityPolicy.js new file mode 100644 index 000000000000..c9bc7f68dd38 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/lockImmutabilityPolicy.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. +/** + * This sample demonstrates how to Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * + * @summary Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLockImmutabilityPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function lockImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res2702"; + const accountName = "sto5009"; + const containerName = "container1631"; + const ifMatch = '"8d59f825b721dd3"'; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lockImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch + ); + console.log(result); +} + +lockImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/nfsV3AccountCreate.js b/sdk/storage/arm-storage/samples/v17/javascript/nfsV3AccountCreate.js new file mode 100644 index 000000000000..9c204ddfc2bc --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/nfsV3AccountCreate.js @@ -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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/NfsV3AccountCreate.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function nfsV3AccountCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + isHnsEnabled: true, + enableNfsV3: true, + kind: "BlockBlobStorage", + location: "eastus", + networkRuleSet: { + bypass: "AzureServices", + defaultAction: "Allow", + ipRules: [], + virtualNetworkRules: [ + { + virtualNetworkResourceId: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Network/virtualNetworks/net123/subnets/subnet12", + }, + ], + }, + sku: { name: "Premium_LRS" }, + enableHttpsTrafficOnly: false, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +nfsV3AccountCreate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/operationsList.js b/sdk/storage/arm-storage/samples/v17/javascript/operationsList.js new file mode 100644 index 000000000000..9b90bd8de590 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/operationsList.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all of the available Storage Rest API operations. + * + * @summary Lists all of the available Storage Rest API operations. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/OperationsList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/package.json b/sdk/storage/arm-storage/samples/v17/javascript/package.json new file mode 100644 index 000000000000..0f6a5f9e088f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-storage-samples-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/storage/arm-storage" + }, + "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/storage/arm-storage", + "dependencies": { + "@azure/arm-storage": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putBlobServices.js b/sdk/storage/arm-storage/samples/v17/javascript/putBlobServices.js new file mode 100644 index 000000000000..f1094a88a881 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putBlobServices.js @@ -0,0 +1,65 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPut.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters = { + changeFeed: { enabled: true, retentionInDays: 7 }, + cors: { + corsRules: [ + { + allowedHeaders: ["x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*"], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100, + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2, + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: ["http://www.abc23.com", "https://www.fabrikam.com/*"], + exposedHeaders: ["x-ms-meta-abc", "x-ms-meta-data*", "x -ms-meta-target*"], + maxAgeInSeconds: 2000, + }, + ], + }, + defaultServiceVersion: "2017-07-29", + deleteRetentionPolicy: { days: 300, enabled: true }, + isVersioningEnabled: true, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putContainerWithDefaultEncryptionScope.js b/sdk/storage/arm-storage/samples/v17/javascript/putContainerWithDefaultEncryptionScope.js new file mode 100644 index 000000000000..db9062415360 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putContainerWithDefaultEncryptionScope.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutDefaultEncryptionScope.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putContainerWithDefaultEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer = { + defaultEncryptionScope: "encryptionscope185", + denyEncryptionScopeOverride: true, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainerWithDefaultEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putContainerWithObjectLevelWorm.js b/sdk/storage/arm-storage/samples/v17/javascript/putContainerWithObjectLevelWorm.js new file mode 100644 index 000000000000..125591c985b9 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putContainerWithObjectLevelWorm.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutObjectLevelWorm.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putContainerWithObjectLevelWorm() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer = { + immutableStorageWithVersioning: { enabled: true }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainerWithObjectLevelWorm().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putContainers.js b/sdk/storage/arm-storage/samples/v17/javascript/putContainers.js new file mode 100644 index 000000000000..07a2aaef4312 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putContainers.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPut.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putFileServices.js b/sdk/storage/arm-storage/samples/v17/javascript/putFileServices.js new file mode 100644 index 000000000000..2bf39c590814 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putFileServices.js @@ -0,0 +1,61 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters = { + cors: { + corsRules: [ + { + allowedHeaders: ["x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*"], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100, + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2, + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: ["http://www.abc23.com", "https://www.fabrikam.com/*"], + exposedHeaders: ["x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*"], + maxAgeInSeconds: 2000, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putFileServicesEnableSecureSmbFeatures.js b/sdk/storage/arm-storage/samples/v17/javascript/putFileServicesEnableSecureSmbFeatures.js new file mode 100644 index 000000000000..a0faa65874d0 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putFileServicesEnableSecureSmbFeatures.js @@ -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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSecureSmbFeatures.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putFileServicesEnableSecureSmbFeatures() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters = { + protocolSettings: { + smb: { + authenticationMethods: "NTLMv2;Kerberos", + channelEncryption: "AES-128-CCM;AES-128-GCM;AES-256-GCM", + kerberosTicketEncryption: "RC4-HMAC;AES-256", + versions: "SMB2.1;SMB3.0;SMB3.1.1", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServicesEnableSecureSmbFeatures().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putFileServicesEnableSmbMultichannel.js b/sdk/storage/arm-storage/samples/v17/javascript/putFileServicesEnableSmbMultichannel.js new file mode 100644 index 000000000000..9a5ac0c6c66b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putFileServicesEnableSmbMultichannel.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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSMBMultichannel.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putFileServicesEnableSmbMultichannel() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters = { + protocolSettings: { smb: { multichannel: { enabled: true } } }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServicesEnableSmbMultichannel().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putShares.js b/sdk/storage/arm-storage/samples/v17/javascript/putShares.js new file mode 100644 index 000000000000..b94064688571 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putShares.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +putShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/putSharesWithAccessTier.js b/sdk/storage/arm-storage/samples/v17/javascript/putSharesWithAccessTier.js new file mode 100644 index 000000000000..4e92cabf4c9c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/putSharesWithAccessTier.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_AccessTier.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function putSharesWithAccessTier() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res346"; + const accountName = "sto666"; + const shareName = "share1235"; + const fileShare = { accessTier: "Hot" }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +putSharesWithAccessTier().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueOperationDelete.js b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationDelete.js new file mode 100644 index 000000000000..8a51680f8cff --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationDelete.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Deletes the queue with the specified queue name, under the specified account if it exists. + * + * @summary Deletes the queue with the specified queue name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationDelete.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueOperationDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.delete(resourceGroupName, accountName, queueName); + console.log(result); +} + +queueOperationDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueOperationGet.js b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationGet.js new file mode 100644 index 000000000000..94549f485f5a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationGet.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the queue with the specified queue name, under the specified account if it exists. + * + * @summary Gets the queue with the specified queue name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueOperationGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.get(resourceGroupName, accountName, queueName); + console.log(result); +} + +queueOperationGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueOperationList.js b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationList.js new file mode 100644 index 000000000000..b2070255626b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationList.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets a list of all the queues under the specified storage account + * + * @summary Gets a list of all the queues under the specified storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueOperationList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto328"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.queue.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +queueOperationList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPatch.js b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPatch.js new file mode 100644 index 000000000000..3af9c395b2cc --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPatch.js @@ -0,0 +1,32 @@ +/* + * 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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPatch.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueOperationPatch() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.update(resourceGroupName, accountName, queueName, queue); + console.log(result); +} + +queueOperationPatch().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPut.js b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPut.js new file mode 100644 index 000000000000..4a3a351840e3 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPut.js @@ -0,0 +1,32 @@ +/* + * 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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPut.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueOperationPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.create(resourceGroupName, accountName, queueName, queue); + console.log(result); +} + +queueOperationPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPutWithMetadata.js b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPutWithMetadata.js new file mode 100644 index 000000000000..69012c28e141 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueOperationPutWithMetadata.js @@ -0,0 +1,34 @@ +/* + * 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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPutWithMetadata.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueOperationPutWithMetadata() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue = { + metadata: { sample1: "meta1", sample2: "meta2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.create(resourceGroupName, accountName, queueName, queue); + console.log(result); +} + +queueOperationPutWithMetadata().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueServicesGet.js b/sdk/storage/arm-storage/samples/v17/javascript/queueServicesGet.js new file mode 100644 index 000000000000..6f45b4fa9ef9 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueServicesGet.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueServicesGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.getServiceProperties(resourceGroupName, accountName); + console.log(result); +} + +queueServicesGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueServicesList.js b/sdk/storage/arm-storage/samples/v17/javascript/queueServicesList.js new file mode 100644 index 000000000000..309b3ca73a9e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueServicesList.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to List all queue services for the storage account + * + * @summary List all queue services for the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueServicesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.list(resourceGroupName, accountName); + console.log(result); +} + +queueServicesList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/queueServicesPut.js b/sdk/storage/arm-storage/samples/v17/javascript/queueServicesPut.js new file mode 100644 index 000000000000..5a43c6814470 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/queueServicesPut.js @@ -0,0 +1,61 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesPut.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queueServicesPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters = { + cors: { + corsRules: [ + { + allowedHeaders: ["x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*"], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100, + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2, + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: ["http://www.abc23.com", "https://www.fabrikam.com/*"], + exposedHeaders: ["x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*"], + maxAgeInSeconds: 2000, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +queueServicesPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/regenerateLocalUserPassword.js b/sdk/storage/arm-storage/samples/v17/javascript/regenerateLocalUserPassword.js new file mode 100644 index 000000000000..78122c05b331 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/regenerateLocalUserPassword.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. +/** + * This sample demonstrates how to Regenerate the local user SSH password. + * + * @summary Regenerate the local user SSH password. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserRegeneratePassword.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function regenerateLocalUserPassword() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.regeneratePassword( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +regenerateLocalUserPassword().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/restoreShares.js b/sdk/storage/arm-storage/samples/v17/javascript/restoreShares.js new file mode 100644 index 000000000000..4a421e3deeff --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/restoreShares.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. +/** + * This sample demonstrates how to Restore a file share within a valid retention days if share soft delete is enabled + * + * @summary Restore a file share within a valid retention days if share soft delete is enabled + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesRestore.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function restoreShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share1249"; + const deletedShare = { + deletedShareName: "share1249", + deletedShareVersion: "1234567890", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.restore( + resourceGroupName, + accountName, + shareName, + deletedShare + ); + console.log(result); +} + +restoreShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/sample.env b/sdk/storage/arm-storage/samples/v17/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/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/storage/arm-storage/samples/v17/javascript/setLegalHoldContainers.js b/sdk/storage/arm-storage/samples/v17/javascript/setLegalHoldContainers.js new file mode 100644 index 000000000000..3b5725488f0c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/setLegalHoldContainers.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. +/** + * This sample demonstrates how to Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @summary Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHold.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function setLegalHoldContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold = { tags: ["tag1", "tag2", "tag3"] }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.setLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +setLegalHoldContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/setLegalHoldContainersWithAllowProtectedAppendWritesAll.js b/sdk/storage/arm-storage/samples/v17/javascript/setLegalHoldContainersWithAllowProtectedAppendWritesAll.js new file mode 100644 index 000000000000..fa4fab7f0028 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/setLegalHoldContainersWithAllowProtectedAppendWritesAll.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. +/** + * This sample demonstrates how to Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @summary Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHoldAllowProtectedAppendWritesAll.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function setLegalHoldContainersWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold = { + allowProtectedAppendWritesAll: true, + tags: ["tag1", "tag2", "tag3"], + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.setLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +setLegalHoldContainersWithAllowProtectedAppendWritesAll().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/skuList.js b/sdk/storage/arm-storage/samples/v17/javascript/skuList.js new file mode 100644 index 000000000000..b6240c5403a8 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/skuList.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists the available SKUs supported by Microsoft.Storage for given subscription. + * + * @summary Lists the available SKUs supported by Microsoft.Storage for given subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/SKUList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function skuList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.skus.list()) { + resArray.push(item); + } + console.log(resArray); +} + +skuList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountAbortHierarchicalNamespaceMigration.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountAbortHierarchicalNamespaceMigration.js new file mode 100644 index 000000000000..d536c117b594 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountAbortHierarchicalNamespaceMigration.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Abort live Migration of storage account to enable Hns + * + * @summary Abort live Migration of storage account to enable Hns + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountAbortHierarchicalNamespaceMigration.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountAbortHierarchicalNamespaceMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginAbortHierarchicalNamespaceMigrationAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountAbortHierarchicalNamespaceMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCheckNameAvailability.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCheckNameAvailability.js new file mode 100644 index 000000000000..51ee0e7823f4 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCheckNameAvailability.js @@ -0,0 +1,32 @@ +/* + * 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. +/** + * This sample demonstrates how to Checks that the storage account name is valid and is not already in use. + * + * @summary Checks that the storage account name is valid and is not already in use. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCheckNameAvailability.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCheckNameAvailability() { + const subscriptionId = "{subscription-id}"; + const accountName = { + name: "sto3363", + type: "Microsoft.Storage/storageAccounts", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.checkNameAvailability(accountName); + console.log(result); +} + +storageAccountCheckNameAvailability().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreate.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreate.js new file mode 100644 index 000000000000..69dc098c42ec --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreate.js @@ -0,0 +1,62 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreate.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + defaultToOAuthAuthentication: false, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + isSftpEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting", + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateAllowedCopyScopeToAad.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateAllowedCopyScopeToAad.js new file mode 100644 index 000000000000..410159734bd8 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateAllowedCopyScopeToAad.js @@ -0,0 +1,60 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateAllowedCopyScopeToAad() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "AAD", + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting", + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateAllowedCopyScopeToAad().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateAllowedCopyScopeToPrivateLink.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateAllowedCopyScopeToPrivateLink.js new file mode 100644 index 000000000000..5b703958503d --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateAllowedCopyScopeToPrivateLink.js @@ -0,0 +1,60 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateAllowedCopyScopeToPrivateLink() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "PrivateLink", + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting", + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateAllowedCopyScopeToPrivateLink().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateDisallowPublicNetworkAccess.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateDisallowPublicNetworkAccess.js new file mode 100644 index 000000000000..361ffead7686 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateDisallowPublicNetworkAccess.js @@ -0,0 +1,61 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateDisallowPublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + publicNetworkAccess: "Disabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting", + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateDisallowPublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateEnablePublicNetworkAccess.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateEnablePublicNetworkAccess.js new file mode 100644 index 000000000000..c7b664f597db --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateEnablePublicNetworkAccess.js @@ -0,0 +1,61 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateEnablePublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + publicNetworkAccess: "Enabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting", + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateEnablePublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateObjectReplicationPolicyOnDestination.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateObjectReplicationPolicyOnDestination.js new file mode 100644 index 000000000000..0d9c65fc753e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateObjectReplicationPolicyOnDestination.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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateObjectReplicationPolicyOnDestination() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "dst112"; + const objectReplicationPolicyId = "default"; + const properties = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + sourceContainer: "scont139", + }, + ], + sourceAccount: "src1122", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountCreateObjectReplicationPolicyOnDestination().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateObjectReplicationPolicyOnSource.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateObjectReplicationPolicyOnSource.js new file mode 100644 index 000000000000..957b7d6c8dd4 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateObjectReplicationPolicyOnSource.js @@ -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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateObjectReplicationPolicyOnSource() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "src1122"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { + minCreationTime: "2020-02-19T16:05:00Z", + prefixMatch: ["blobA", "blobB"], + }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139", + }, + ], + sourceAccount: "src1122", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountCreateObjectReplicationPolicyOnSource().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.js new file mode 100644 index 000000000000..e4aef8161608 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.js @@ -0,0 +1,62 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateUserAssignedEncryptionIdentityWithCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + encryption: { + encryptionIdentity: { + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "", + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": + {}, + }, + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_LRS" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateUserAssignedEncryptionIdentityWithCmk().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.js new file mode 100644 index 000000000000..48182acd412b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.js @@ -0,0 +1,63 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res131918"; + const accountName = "sto131918"; + const parameters = { + encryption: { + encryptionIdentity: { + encryptionFederatedIdentityClientId: "f83c6b1b-4d34-47e4-bb34-9d83df58b540", + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "", + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": + {}, + }, + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_LRS" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateWithImmutabilityPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateWithImmutabilityPolicy.js new file mode 100644 index 000000000000..4a0c94944f8a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountCreateWithImmutabilityPolicy.js @@ -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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateWithImmutabilityPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountCreateWithImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + immutableStorageWithVersioning: { + enabled: true, + immutabilityPolicy: { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 15, + state: "Unlocked", + }, + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_GRS" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateWithImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDelete.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDelete.js new file mode 100644 index 000000000000..810adcd54a57 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDelete.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Deletes a storage account in Microsoft Azure. + * + * @summary Deletes a storage account in Microsoft Azure. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDelete.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.delete(resourceGroupName, accountName); + console.log(result); +} + +storageAccountDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteBlobInventoryPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteBlobInventoryPolicy.js new file mode 100644 index 000000000000..3d85968f331b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteBlobInventoryPolicy.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. +/** + * This sample demonstrates how to Deletes the blob inventory policy associated with the specified storage account. + * + * @summary Deletes the blob inventory policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteBlobInventoryPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountDeleteBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const blobInventoryPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobInventoryPolicies.delete( + resourceGroupName, + accountName, + blobInventoryPolicyName + ); + console.log(result); +} + +storageAccountDeleteBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteManagementPolicies.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteManagementPolicies.js new file mode 100644 index 000000000000..6c519521efcb --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteManagementPolicies.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. +/** + * This sample demonstrates how to Deletes the managementpolicy associated with the specified storage account. + * + * @summary Deletes the managementpolicy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteManagementPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountDeleteManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const managementPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.delete( + resourceGroupName, + accountName, + managementPolicyName + ); + console.log(result); +} + +storageAccountDeleteManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteObjectReplicationPolicies.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteObjectReplicationPolicies.js new file mode 100644 index 000000000000..abbdf60abecb --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeleteObjectReplicationPolicies.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. +/** + * This sample demonstrates how to Deletes the object replication policy associated with the specified storage account. + * + * @summary Deletes the object replication policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteObjectReplicationPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountDeleteObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const objectReplicationPolicyId = "{objectReplicationPolicy-Id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.delete( + resourceGroupName, + accountName, + objectReplicationPolicyId + ); + console.log(result); +} + +storageAccountDeleteObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeletePrivateEndpointConnection.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeletePrivateEndpointConnection.js new file mode 100644 index 000000000000..312c2e5a707f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountDeletePrivateEndpointConnection.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. +/** + * This sample demonstrates how to Deletes the specified private endpoint connection associated with the storage account. + * + * @summary Deletes the specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeletePrivateEndpointConnection.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountDeletePrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.delete( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +storageAccountDeletePrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEnableAd.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEnableAd.js new file mode 100644 index 000000000000..6d6ab985c526 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEnableAd.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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableAD.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountEnableAd() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters = { + azureFilesIdentityBasedAuthentication: { + activeDirectoryProperties: { + accountType: "User", + azureStorageSid: "S-1-5-21-2400535526-2334094090-2402026252-0012", + domainGuid: "aebfc118-9fa9-4732-a21f-d98e41a77ae1", + domainName: "adtest.com", + domainSid: "S-1-5-21-2400535526-2334094090-2402026252", + forestName: "adtest.com", + netBiosDomainName: "adtest.com", + samAccountName: "sam12498", + }, + directoryServiceOptions: "AD", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update(resourceGroupName, accountName, parameters); + console.log(result); +} + +storageAccountEnableAd().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEnableCmk.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEnableCmk.js new file mode 100644 index 000000000000..29e16e085481 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEnableCmk.js @@ -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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableCMK.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountEnableCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters = { + encryption: { + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "", + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update(resourceGroupName, accountName, parameters); + console.log(result); +} + +storageAccountEnableCmk().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEncryptionScopeList.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEncryptionScopeList.js new file mode 100644 index 000000000000..e79200d2818d --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountEncryptionScopeList.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all the encryption scopes available under the specified storage account. + * + * @summary Lists all the encryption scopes available under the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEncryptionScopeList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountEncryptionScopeList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.encryptionScopes.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountEncryptionScopeList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountFailover.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountFailover.js new file mode 100644 index 000000000000..e91ac157bbc9 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountFailover.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @summary Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountFailover.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountFailover() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginFailoverAndWait(resourceGroupName, accountName); + console.log(result); +} + +storageAccountFailover().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetBlobInventoryPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetBlobInventoryPolicy.js new file mode 100644 index 000000000000..0ec07adc426b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetBlobInventoryPolicy.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the blob inventory policy associated with the specified storage account. + * + * @summary Gets the blob inventory policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListBlobInventoryPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountGetBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobInventoryPolicies.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountGetBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetEncryptionScope.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetEncryptionScope.js new file mode 100644 index 000000000000..6f31ca898d6b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetEncryptionScope.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. +/** + * This sample demonstrates how to Returns the properties for the specified encryption scope. + * + * @summary Returns the properties for the specified encryption scope. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetEncryptionScope.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountGetEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.get( + resourceGroupName, + accountName, + encryptionScopeName + ); + console.log(result); +} + +storageAccountGetEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetManagementPolicies.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetManagementPolicies.js new file mode 100644 index 000000000000..543944e0c191 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetManagementPolicies.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. +/** + * This sample demonstrates how to Gets the managementpolicy associated with the specified storage account. + * + * @summary Gets the managementpolicy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetManagementPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountGetManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const managementPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.get( + resourceGroupName, + accountName, + managementPolicyName + ); + console.log(result); +} + +storageAccountGetManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetObjectReplicationPolicies.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetObjectReplicationPolicies.js new file mode 100644 index 000000000000..d94d8f68be86 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetObjectReplicationPolicies.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. +/** + * This sample demonstrates how to Get the object replication policy of the storage account by policy ID. + * + * @summary Get the object replication policy of the storage account by policy ID. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetObjectReplicationPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountGetObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const objectReplicationPolicyId = "{objectReplicationPolicy-Id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.get( + resourceGroupName, + accountName, + objectReplicationPolicyId + ); + console.log(result); +} + +storageAccountGetObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetPrivateEndpointConnection.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetPrivateEndpointConnection.js new file mode 100644 index 000000000000..2b6a9a35d4a2 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetPrivateEndpointConnection.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. +/** + * This sample demonstrates how to Gets the specified private endpoint connection associated with the storage account. + * + * @summary Gets the specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPrivateEndpointConnection.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountGetPrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +storageAccountGetPrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetProperties.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetProperties.js new file mode 100644 index 000000000000..6a438a522728 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetProperties.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @summary Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetProperties.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountGetProperties() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.getProperties(resourceGroupName, accountName); + console.log(result); +} + +storageAccountGetProperties().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetPropertiesCmkEnabled.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetPropertiesCmkEnabled.js new file mode 100644 index 000000000000..dfe2d0495875 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountGetPropertiesCmkEnabled.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @summary Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPropertiesCMKEnabled.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountGetPropertiesCmkEnabled() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.getProperties(resourceGroupName, accountName); + console.log(result); +} + +storageAccountGetPropertiesCmkEnabled().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountHierarchicalNamespaceMigration.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountHierarchicalNamespaceMigration.js new file mode 100644 index 000000000000..b6c90ac0555f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountHierarchicalNamespaceMigration.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. +/** + * This sample demonstrates how to Live Migration of storage account to enable Hns + * + * @summary Live Migration of storage account to enable Hns + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountHierarchicalNamespaceMigration.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountHierarchicalNamespaceMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const requestType = "HnsOnValidationRequest"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginHierarchicalNamespaceMigrationAndWait( + resourceGroupName, + accountName, + requestType + ); + console.log(result); +} + +storageAccountHierarchicalNamespaceMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountList.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountList.js new file mode 100644 index 000000000000..7f8e593e4435 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountList.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @summary Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.list()) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListAccountSas.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListAccountSas.js new file mode 100644 index 000000000000..e2715d747b46 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListAccountSas.js @@ -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. +/** + * This sample demonstrates how to List SAS credentials of a storage account. + * + * @summary List SAS credentials of a storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListAccountSAS.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountListAccountSas() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7985"; + const accountName = "sto8588"; + const parameters = { + keyToSign: "key1", + sharedAccessExpiryTime: new Date("2017-05-24T11:42:03.1567373Z"), + permissions: "r", + protocols: "https,http", + resourceTypes: "s", + services: "b", + sharedAccessStartTime: new Date("2017-05-24T10:42:03.1567373Z"), + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listAccountSAS( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountListAccountSas().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListByResourceGroup.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListByResourceGroup.js new file mode 100644 index 000000000000..21240fdb959e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListByResourceGroup.js @@ -0,0 +1,32 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @summary Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListByResourceGroup.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountListByResourceGroup() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6117"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListByResourceGroup().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListKeys.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListKeys.js new file mode 100644 index 000000000000..5e4968753dff --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListKeys.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. + * + * @summary Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListKeys.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountListKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res418"; + const accountName = "sto2220"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listKeys(resourceGroupName, accountName); + console.log(result); +} + +storageAccountListKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListObjectReplicationPolicies.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListObjectReplicationPolicies.js new file mode 100644 index 000000000000..b69f34762e39 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListObjectReplicationPolicies.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. +/** + * This sample demonstrates how to List the object replication policies associated with the storage account. + * + * @summary List the object replication policies associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListObjectReplicationPolicies.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountListObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.objectReplicationPoliciesOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListPrivateEndpointConnections.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListPrivateEndpointConnections.js new file mode 100644 index 000000000000..5839adb7d9fa --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListPrivateEndpointConnections.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to List all the private endpoint connections associated with the storage account. + * + * @summary List all the private endpoint connections associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateEndpointConnections.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountListPrivateEndpointConnections() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListPrivateEndpointConnections().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListPrivateLinkResources.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListPrivateLinkResources.js new file mode 100644 index 000000000000..fabcdf89984c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListPrivateLinkResources.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the private link resources that need to be created for a storage account. + * + * @summary Gets the private link resources that need to be created for a storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateLinkResources.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountListPrivateLinkResources() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateLinkResources.listByStorageAccount( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountListPrivateLinkResources().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListServiceSas.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListServiceSas.js new file mode 100644 index 000000000000..c62d19fadc44 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountListServiceSas.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. +/** + * This sample demonstrates how to List service SAS credentials of a specific resource. + * + * @summary List service SAS credentials of a specific resource. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListServiceSAS.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountListServiceSas() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7439"; + const accountName = "sto1299"; + const parameters = { + canonicalizedResource: "/blob/sto1299/music", + sharedAccessExpiryTime: new Date("2017-05-24T11:32:48.8457197Z"), + permissions: "l", + resource: "c", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listServiceSAS( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountListServiceSas().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPatchEncryptionScope.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPatchEncryptionScope.js new file mode 100644 index 000000000000..2817ebbb1b4e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPatchEncryptionScope.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. +/** + * This sample demonstrates how to Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. + * + * @summary Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPatchEncryptionScope.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountPatchEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope = { + keyVaultProperties: { + keyUri: "https://testvault.vault.core.windows.net/keys/key1/863425f1358359c", + }, + source: "Microsoft.KeyVault", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.patch( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPatchEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutEncryptionScope.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutEncryptionScope.js new file mode 100644 index 000000000000..fed7fa6a893e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutEncryptionScope.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. +/** + * This sample demonstrates how to Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * + * @summary Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScope.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountPutEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.put( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPutEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutEncryptionScopeWithInfrastructureEncryption.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutEncryptionScopeWithInfrastructureEncryption.js new file mode 100644 index 000000000000..94bea1445a0f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutEncryptionScopeWithInfrastructureEncryption.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. +/** + * This sample demonstrates how to Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * + * @summary Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountPutEncryptionScopeWithInfrastructureEncryption() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope = { + requireInfrastructureEncryption: true, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.put( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPutEncryptionScopeWithInfrastructureEncryption().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutPrivateEndpointConnection.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutPrivateEndpointConnection.js new file mode 100644 index 000000000000..0100451421a4 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountPutPrivateEndpointConnection.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. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection associated with the storage account. + * + * @summary Update the state of specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutPrivateEndpointConnection.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountPutPrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const properties = { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.put( + resourceGroupName, + accountName, + privateEndpointConnectionName, + properties + ); + console.log(result); +} + +storageAccountPutPrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRegenerateKerbKey.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRegenerateKerbKey.js new file mode 100644 index 000000000000..87817cb35a22 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRegenerateKerbKey.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. +/** + * This sample demonstrates how to Regenerates one of the access keys or Kerberos keys for the specified storage account. + * + * @summary Regenerates one of the access keys or Kerberos keys for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKerbKey.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountRegenerateKerbKey() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const regenerateKey = { + keyName: "kerb1", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.regenerateKey( + resourceGroupName, + accountName, + regenerateKey + ); + console.log(result); +} + +storageAccountRegenerateKerbKey().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRegenerateKey.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRegenerateKey.js new file mode 100644 index 000000000000..497d279f4c7d --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRegenerateKey.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. +/** + * This sample demonstrates how to Regenerates one of the access keys or Kerberos keys for the specified storage account. + * + * @summary Regenerates one of the access keys or Kerberos keys for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKey.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountRegenerateKey() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const regenerateKey = { + keyName: "key2", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.regenerateKey( + resourceGroupName, + accountName, + regenerateKey + ); + console.log(result); +} + +storageAccountRegenerateKey().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRevokeUserDelegationKeys.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRevokeUserDelegationKeys.js new file mode 100644 index 000000000000..1b12e8ae9ecc --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountRevokeUserDelegationKeys.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Revoke user delegation keys. + * + * @summary Revoke user delegation keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRevokeUserDelegationKeys.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountRevokeUserDelegationKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.revokeUserDelegationKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountRevokeUserDelegationKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetBlobInventoryPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetBlobInventoryPolicy.js new file mode 100644 index 000000000000..b4355e17daa1 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetBlobInventoryPolicy.js @@ -0,0 +1,95 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the blob inventory policy to the specified storage account. + * + * @summary Sets the blob inventory policy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetBlobInventoryPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountSetBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const blobInventoryPolicyName = "default"; + const properties = { + policy: { + type: "Inventory", + enabled: true, + rules: [ + { + name: "inventoryPolicyRule1", + definition: { + format: "Csv", + filters: { + blobTypes: ["blockBlob", "appendBlob", "pageBlob"], + includeBlobVersions: true, + includeSnapshots: true, + prefixMatch: ["inventoryprefix1", "inventoryprefix2"], + }, + objectType: "Blob", + schedule: "Daily", + schemaFields: [ + "Name", + "Creation-Time", + "Last-Modified", + "Content-Length", + "Content-MD5", + "BlobType", + "AccessTier", + "AccessTierChangeTime", + "Snapshot", + "VersionId", + "IsCurrentVersion", + "Metadata", + ], + }, + destination: "container1", + enabled: true, + }, + { + name: "inventoryPolicyRule2", + definition: { + format: "Parquet", + objectType: "Container", + schedule: "Weekly", + schemaFields: [ + "Name", + "Last-Modified", + "Metadata", + "LeaseStatus", + "LeaseState", + "LeaseDuration", + "PublicAccess", + "HasImmutabilityPolicy", + "HasLegalHold", + ], + }, + destination: "container2", + enabled: true, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobInventoryPolicies.createOrUpdate( + resourceGroupName, + accountName, + blobInventoryPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicies.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicies.js new file mode 100644 index 000000000000..cf2ae32049c3 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicies.js @@ -0,0 +1,83 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountSetManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 }, + }, + snapshot: { delete: { daysAfterCreationGreaterThan: 30 } }, + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer1"], + }, + }, + enabled: true, + }, + { + name: "olcmtest2", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 }, + }, + }, + filters: { + blobIndexMatch: [ + { name: "tag1", op: "==", value: "val1" }, + { name: "tag2", op: "==", value: "val2" }, + ], + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer2"], + }, + }, + enabled: true, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyForBlockAndAppendBlobs.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyForBlockAndAppendBlobs.js new file mode 100644 index 000000000000..e2c8496d642a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyForBlockAndAppendBlobs.js @@ -0,0 +1,58 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountSetManagementPolicyForBlockAndAppendBlobs() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { delete: { daysAfterModificationGreaterThan: 90 } }, + snapshot: { delete: { daysAfterCreationGreaterThan: 90 } }, + version: { delete: { daysAfterCreationGreaterThan: 90 } }, + }, + filters: { + blobTypes: ["blockBlob", "appendBlob"], + prefixMatch: ["olcmtestcontainer1"], + }, + }, + enabled: true, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyForBlockAndAppendBlobs().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.js new file mode 100644 index 000000000000..e294c9e5ebb2 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.js @@ -0,0 +1,62 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties = { + policy: { + rules: [ + { + name: "olcmtest", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterLastAccessTimeGreaterThan: 1000 }, + enableAutoTierToHotFromCool: true, + tierToArchive: { daysAfterLastAccessTimeGreaterThan: 90 }, + tierToCool: { daysAfterLastAccessTimeGreaterThan: 30 }, + }, + snapshot: { delete: { daysAfterCreationGreaterThan: 30 } }, + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer"], + }, + }, + enabled: true, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyWithSnapshotAndVersion.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyWithSnapshotAndVersion.js new file mode 100644 index 000000000000..c940c3f19958 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountSetManagementPolicyWithSnapshotAndVersion.js @@ -0,0 +1,70 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountSetManagementPolicyWithSnapshotAndVersion() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 }, + }, + snapshot: { + delete: { daysAfterCreationGreaterThan: 1000 }, + tierToArchive: { daysAfterCreationGreaterThan: 90 }, + tierToCool: { daysAfterCreationGreaterThan: 30 }, + }, + version: { + delete: { daysAfterCreationGreaterThan: 1000 }, + tierToArchive: { daysAfterCreationGreaterThan: 90 }, + tierToCool: { daysAfterCreationGreaterThan: 30 }, + }, + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer1"], + }, + }, + enabled: true, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyWithSnapshotAndVersion().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdate.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdate.js new file mode 100644 index 000000000000..97e704c8ab56 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdate.js @@ -0,0 +1,62 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdate.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountUpdate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + defaultToOAuthAuthentication: false, + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + isLocalUserEnabled: true, + isSftpEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47", + }, + ], + }, + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting", + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update(resourceGroupName, accountName, parameters); + console.log(result); +} + +storageAccountUpdate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateAllowedCopyScopeToAad.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateAllowedCopyScopeToAad.js new file mode 100644 index 000000000000..58c04e37f7f8 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateAllowedCopyScopeToAad.js @@ -0,0 +1,60 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountUpdateAllowedCopyScopeToAad() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "AAD", + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47", + }, + ], + }, + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting", + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update(resourceGroupName, accountName, parameters); + console.log(result); +} + +storageAccountUpdateAllowedCopyScopeToAad().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateDisablePublicNetworkAccess.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateDisablePublicNetworkAccess.js new file mode 100644 index 000000000000..4899cb52817e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateDisablePublicNetworkAccess.js @@ -0,0 +1,60 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountUpdateDisablePublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47", + }, + ], + }, + publicNetworkAccess: "Disabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting", + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update(resourceGroupName, accountName, parameters); + console.log(result); +} + +storageAccountUpdateDisablePublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateObjectReplicationPolicyOnDestination.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateObjectReplicationPolicyOnDestination.js new file mode 100644 index 000000000000..b838fe29b0e7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateObjectReplicationPolicyOnDestination.js @@ -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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountUpdateObjectReplicationPolicyOnDestination() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "dst112"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139", + }, + { destinationContainer: "dcont179", sourceContainer: "scont179" }, + ], + sourceAccount: "src1122", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountUpdateObjectReplicationPolicyOnDestination().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateObjectReplicationPolicyOnSource.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateObjectReplicationPolicyOnSource.js new file mode 100644 index 000000000000..e6ca1cf95557 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateObjectReplicationPolicyOnSource.js @@ -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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountUpdateObjectReplicationPolicyOnSource() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "src1122"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139", + }, + { + destinationContainer: "dcont179", + ruleId: "cfbb4bc2-8b60-429f-b05a-d1e0942b33b2", + sourceContainer: "scont179", + }, + ], + sourceAccount: "src1122", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountUpdateObjectReplicationPolicyOnSource().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.js new file mode 100644 index 000000000000..6c86b7fb1b55 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.js @@ -0,0 +1,57 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountUpdateUserAssignedEncryptionIdentityWithCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters = { + encryption: { + encryptionIdentity: { + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "", + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": + {}, + }, + }, + kind: "Storage", + sku: { name: "Standard_LRS" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update(resourceGroupName, accountName, parameters); + console.log(result); +} + +storageAccountUpdateUserAssignedEncryptionIdentityWithCmk().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.js new file mode 100644 index 000000000000..381a92bc6802 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.js @@ -0,0 +1,58 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res131918"; + const accountName = "sto131918"; + const parameters = { + encryption: { + encryptionIdentity: { + encryptionFederatedIdentityClientId: "3109d1c4-a5de-4d84-8832-feabb916a4b6", + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "", + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" }, + }, + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": + {}, + }, + }, + kind: "Storage", + sku: { name: "Standard_LRS" }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update(resourceGroupName, accountName, parameters); + console.log(result); +} + +storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateWithImmutabilityPolicy.js b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateWithImmutabilityPolicy.js new file mode 100644 index 000000000000..e22b90a95f99 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/storageAccountUpdateWithImmutabilityPolicy.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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageAccountUpdateWithImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters = { + immutableStorageWithVersioning: { + enabled: true, + immutabilityPolicy: { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 15, + state: "Locked", + }, + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update(resourceGroupName, accountName, parameters); + console.log(result); +} + +storageAccountUpdateWithImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/tableOperationDelete.js b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationDelete.js new file mode 100644 index 000000000000..27bc9c850a44 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationDelete.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Deletes the table with the specified table name, under the specified account if it exists. + * + * @summary Deletes the table with the specified table name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationDelete.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function tableOperationDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.delete(resourceGroupName, accountName, tableName); + console.log(result); +} + +tableOperationDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/tableOperationGet.js b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationGet.js new file mode 100644 index 000000000000..c2af73414a73 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationGet.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the table with the specified table name, under the specified account if it exists. + * + * @summary Gets the table with the specified table name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function tableOperationGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.get(resourceGroupName, accountName, tableName); + console.log(result); +} + +tableOperationGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/tableOperationList.js b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationList.js new file mode 100644 index 000000000000..5667e9bc05eb --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationList.js @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets a list of all the tables under the specified storage account + * + * @summary Gets a list of all the tables under the specified storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function tableOperationList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto328"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tableOperations.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +tableOperationList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/tableOperationPatch.js b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationPatch.js new file mode 100644 index 000000000000..a3c572930aa6 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationPatch.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Creates a new table with the specified table name, under the specified account. + * + * @summary Creates a new table with the specified table name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPatch.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function tableOperationPatch() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.update(resourceGroupName, accountName, tableName); + console.log(result); +} + +tableOperationPatch().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/tableOperationPut.js b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationPut.js new file mode 100644 index 000000000000..cc8b06dd0335 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/tableOperationPut.js @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Creates a new table with the specified table name, under the specified account. + * + * @summary Creates a new table with the specified table name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPut.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function tableOperationPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.create(resourceGroupName, accountName, tableName); + console.log(result); +} + +tableOperationPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/tableServicesGet.js b/sdk/storage/arm-storage/samples/v17/javascript/tableServicesGet.js new file mode 100644 index 000000000000..fc839abcdc13 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/tableServicesGet.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesGet.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function tableServicesGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.getServiceProperties(resourceGroupName, accountName); + console.log(result); +} + +tableServicesGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/tableServicesList.js b/sdk/storage/arm-storage/samples/v17/javascript/tableServicesList.js new file mode 100644 index 000000000000..47758257757a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/tableServicesList.js @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to List all table services for the storage account. + * + * @summary List all table services for the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesList.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function tableServicesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.list(resourceGroupName, accountName); + console.log(result); +} + +tableServicesList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/tableServicesPut.js b/sdk/storage/arm-storage/samples/v17/javascript/tableServicesPut.js new file mode 100644 index 000000000000..dc7df1018b09 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/tableServicesPut.js @@ -0,0 +1,61 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesPut.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function tableServicesPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters = { + cors: { + corsRules: [ + { + allowedHeaders: ["x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*"], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100, + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2, + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: ["http://www.abc23.com", "https://www.fabrikam.com/*"], + exposedHeaders: ["x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*"], + maxAgeInSeconds: 2000, + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +tableServicesPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/updateContainers.js b/sdk/storage/arm-storage/samples/v17/javascript/updateContainers.js new file mode 100644 index 000000000000..597114b9ae5a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/updateContainers.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. +/** + * This sample demonstrates how to Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @summary Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPatch.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function updateContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer = { + metadata: { metadata: "true" }, + publicAccess: "Container", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.update( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +updateContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/updateLocalUser.js b/sdk/storage/arm-storage/samples/v17/javascript/updateLocalUser.js new file mode 100644 index 000000000000..a02c267150aa --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/updateLocalUser.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. +/** + * This sample demonstrates how to Create or update the properties of a local user associated with the storage account + * + * @summary Create or update the properties of a local user associated with the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserUpdate.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function updateLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const properties = { + hasSharedKey: false, + hasSshKey: false, + hasSshPassword: false, + homeDirectory: "homedirectory2", + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.createOrUpdate( + resourceGroupName, + accountName, + username, + properties + ); + console.log(result); +} + +updateLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/updateShareAcls.js b/sdk/storage/arm-storage/samples/v17/javascript/updateShareAcls.js new file mode 100644 index 000000000000..da9a24f05d3c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/updateShareAcls.js @@ -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. +/** + * This sample demonstrates how to Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * + * @summary Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareAclsPatch.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function updateShareAcls() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare = { + signedIdentifiers: [ + { + accessPolicy: { + expiryTime: new Date("2021-05-01T08:49:37.0000000Z"), + permission: "rwd", + startTime: new Date("2021-04-01T08:49:37.0000000Z"), + }, + id: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI", + }, + ], + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.update( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +updateShareAcls().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/updateShares.js b/sdk/storage/arm-storage/samples/v17/javascript/updateShares.js new file mode 100644 index 000000000000..746f4451d620 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/updateShares.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. +/** + * This sample demonstrates how to Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * + * @summary Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPatch.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function updateShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare = { metadata: { type: "image" } }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.update( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +updateShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/usageList.js b/sdk/storage/arm-storage/samples/v17/javascript/usageList.js new file mode 100644 index 000000000000..3f36845f6819 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/usageList.js @@ -0,0 +1,32 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the current usage count and the limit for the resources of the location under the subscription. + * + * @summary Gets the current usage count and the limit for the resources of the location under the subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListLocationUsage.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function usageList() { + const subscriptionId = "{subscription-id}"; + const location = "eastus2(stage)"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.listByLocation(location)) { + resArray.push(item); + } + console.log(resArray); +} + +usageList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/javascript/versionLevelWormContainerMigration.js b/sdk/storage/arm-storage/samples/v17/javascript/versionLevelWormContainerMigration.js new file mode 100644 index 000000000000..ec58a5abaf6b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/javascript/versionLevelWormContainerMigration.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. +/** + * This sample demonstrates how to This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. + * + * @summary This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/ObjectLevelWormContainerMigration.json + */ +const { StorageManagementClient } = require("@azure/arm-storage"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function versionLevelWormContainerMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.beginObjectLevelWormAndWait( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +versionLevelWormContainerMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/README.md b/sdk/storage/arm-storage/samples/v17/typescript/README.md new file mode 100644 index 000000000000..eeedc26d8f4e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/README.md @@ -0,0 +1,325 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [acquireALeaseOnAContainer.ts][acquirealeaseonacontainer] | The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Acquire.json | +| [acquireALeaseOnAShare.ts][acquirealeaseonashare] | The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Acquire.json | +| [blobRangesRestore.ts][blobrangesrestore] | Restore blobs in the specified blob ranges x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobRangesRestore.json | +| [blobServicesPutLastAccessTimeBasedTracking.ts][blobservicesputlastaccesstimebasedtracking] | Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json | +| [breakALeaseOnAContainer.ts][breakaleaseonacontainer] | The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Break.json | +| [breakALeaseOnAShare.ts][breakaleaseonashare] | The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Break.json | +| [clearLegalHoldContainers.ts][clearlegalholdcontainers] | Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersClearLegalHold.json | +| [createLocalUser.ts][createlocaluser] | Create or update the properties of a local user associated with the storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserCreate.json | +| [createNfsShares.ts][createnfsshares] | Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_NFS.json | +| [createOrUpdateImmutabilityPolicy.ts][createorupdateimmutabilitypolicy] | Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicy.json | +| [createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.ts][createorupdateimmutabilitypolicywithallowprotectedappendwritesall] | Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll.json | +| [deleteContainers.ts][deletecontainers] | Deletes specified container under its account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDelete.json | +| [deleteImmutabilityPolicy.ts][deleteimmutabilitypolicy] | Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDeleteImmutabilityPolicy.json | +| [deleteLocalUser.ts][deletelocaluser] | Deletes the local user associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserDelete.json | +| [deleteShares.ts][deleteshares] | Deletes specified share under its account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesDelete.json | +| [deletedAccountGet.ts][deletedaccountget] | Get properties of specified deleted account resource. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountGet.json | +| [deletedAccountList.ts][deletedaccountlist] | Lists deleted accounts under the subscription. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountList.json | +| [extendImmutabilityPolicy.ts][extendimmutabilitypolicy] | Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersExtendImmutabilityPolicy.json | +| [getBlobContainersGetWithAllowProtectedAppendWritesAll.ts][getblobcontainersgetwithallowprotectedappendwritesall] | Gets properties of a specified container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json | +| [getBlobServices.ts][getblobservices] | Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesGet.json | +| [getContainers.ts][getcontainers] | Gets properties of a specified container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGet.json | +| [getFileServices.ts][getfileservices] | Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesGet.json | +| [getImmutabilityPolicy.ts][getimmutabilitypolicy] | Gets the existing immutability policy along with the corresponding ETag in response headers and body. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetImmutabilityPolicy.json | +| [getLocalUser.ts][getlocaluser] | Get the local user of the storage account by username. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserGet.json | +| [getShareStats.ts][getsharestats] | Gets properties of a specified share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet_Stats.json | +| [getShares.ts][getshares] | Gets properties of a specified share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet.json | +| [listBlobServices.ts][listblobservices] | List blob services of storage account. It returns a collection of one object named default. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesList.json | +| [listContainers.ts][listcontainers] | Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersList.json | +| [listDeletedContainers.ts][listdeletedcontainers] | Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedBlobContainersList.json | +| [listDeletedShares.ts][listdeletedshares] | Lists all shares. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedFileSharesList.json | +| [listFileServices.ts][listfileservices] | List all file services in storage accounts x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesList.json | +| [listLocalUserKeys.ts][listlocaluserkeys] | List SSH authorized keys and shared key of the local user. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserListKeys.json | +| [listLocalUsers.ts][listlocalusers] | List the local users associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUsersList.json | +| [listShareSnapshots.ts][listsharesnapshots] | Lists all shares. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareSnapshotsList.json | +| [listShares.ts][listshares] | Lists all shares. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesList.json | +| [lockImmutabilityPolicy.ts][lockimmutabilitypolicy] | Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLockImmutabilityPolicy.json | +| [nfsV3AccountCreate.ts][nfsv3accountcreate] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/NfsV3AccountCreate.json | +| [operationsList.ts][operationslist] | Lists all of the available Storage Rest API operations. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/OperationsList.json | +| [putBlobServices.ts][putblobservices] | Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPut.json | +| [putContainerWithDefaultEncryptionScope.ts][putcontainerwithdefaultencryptionscope] | Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutDefaultEncryptionScope.json | +| [putContainerWithObjectLevelWorm.ts][putcontainerwithobjectlevelworm] | Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutObjectLevelWorm.json | +| [putContainers.ts][putcontainers] | Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPut.json | +| [putFileServices.ts][putfileservices] | Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut.json | +| [putFileServicesEnableSecureSmbFeatures.ts][putfileservicesenablesecuresmbfeatures] | Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSecureSmbFeatures.json | +| [putFileServicesEnableSmbMultichannel.ts][putfileservicesenablesmbmultichannel] | Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSMBMultichannel.json | +| [putShares.ts][putshares] | Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut.json | +| [putSharesWithAccessTier.ts][putshareswithaccesstier] | Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_AccessTier.json | +| [queueOperationDelete.ts][queueoperationdelete] | Deletes the queue with the specified queue name, under the specified account if it exists. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationDelete.json | +| [queueOperationGet.ts][queueoperationget] | Gets the queue with the specified queue name, under the specified account if it exists. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationGet.json | +| [queueOperationList.ts][queueoperationlist] | Gets a list of all the queues under the specified storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationList.json | +| [queueOperationPatch.ts][queueoperationpatch] | Creates a new queue with the specified queue name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPatch.json | +| [queueOperationPut.ts][queueoperationput] | Creates a new queue with the specified queue name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPut.json | +| [queueOperationPutWithMetadata.ts][queueoperationputwithmetadata] | Creates a new queue with the specified queue name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPutWithMetadata.json | +| [queueServicesGet.ts][queueservicesget] | Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesGet.json | +| [queueServicesList.ts][queueserviceslist] | List all queue services for the storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesList.json | +| [queueServicesPut.ts][queueservicesput] | Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesPut.json | +| [regenerateLocalUserPassword.ts][regeneratelocaluserpassword] | Regenerate the local user SSH password. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserRegeneratePassword.json | +| [restoreShares.ts][restoreshares] | Restore a file share within a valid retention days if share soft delete is enabled x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesRestore.json | +| [setLegalHoldContainers.ts][setlegalholdcontainers] | Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHold.json | +| [setLegalHoldContainersWithAllowProtectedAppendWritesAll.ts][setlegalholdcontainerswithallowprotectedappendwritesall] | Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHoldAllowProtectedAppendWritesAll.json | +| [skuList.ts][skulist] | Lists the available SKUs supported by Microsoft.Storage for given subscription. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/SKUList.json | +| [storageAccountAbortHierarchicalNamespaceMigration.ts][storageaccountaborthierarchicalnamespacemigration] | Abort live Migration of storage account to enable Hns x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountAbortHierarchicalNamespaceMigration.json | +| [storageAccountCheckNameAvailability.ts][storageaccountchecknameavailability] | Checks that the storage account name is valid and is not already in use. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCheckNameAvailability.json | +| [storageAccountCreate.ts][storageaccountcreate] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreate.json | +| [storageAccountCreateAllowedCopyScopeToAad.ts][storageaccountcreateallowedcopyscopetoaad] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json | +| [storageAccountCreateAllowedCopyScopeToPrivateLink.ts][storageaccountcreateallowedcopyscopetoprivatelink] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json | +| [storageAccountCreateDisallowPublicNetworkAccess.ts][storageaccountcreatedisallowpublicnetworkaccess] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json | +| [storageAccountCreateEnablePublicNetworkAccess.ts][storageaccountcreateenablepublicnetworkaccess] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json | +| [storageAccountCreateObjectReplicationPolicyOnDestination.ts][storageaccountcreateobjectreplicationpolicyondestination] | Create or update the object replication policy of the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json | +| [storageAccountCreateObjectReplicationPolicyOnSource.ts][storageaccountcreateobjectreplicationpolicyonsource] | Create or update the object replication policy of the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json | +| [storageAccountCreateUserAssignedEncryptionIdentityWithCmk.ts][storageaccountcreateuserassignedencryptionidentitywithcmk] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json | +| [storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.ts][storageaccountcreateuserassignedidentitywithfederatedidentityclientid] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json | +| [storageAccountCreateWithImmutabilityPolicy.ts][storageaccountcreatewithimmutabilitypolicy] | Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateWithImmutabilityPolicy.json | +| [storageAccountDelete.ts][storageaccountdelete] | Deletes a storage account in Microsoft Azure. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDelete.json | +| [storageAccountDeleteBlobInventoryPolicy.ts][storageaccountdeleteblobinventorypolicy] | Deletes the blob inventory policy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteBlobInventoryPolicy.json | +| [storageAccountDeleteManagementPolicies.ts][storageaccountdeletemanagementpolicies] | Deletes the managementpolicy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteManagementPolicy.json | +| [storageAccountDeleteObjectReplicationPolicies.ts][storageaccountdeleteobjectreplicationpolicies] | Deletes the object replication policy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteObjectReplicationPolicy.json | +| [storageAccountDeletePrivateEndpointConnection.ts][storageaccountdeleteprivateendpointconnection] | Deletes the specified private endpoint connection associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeletePrivateEndpointConnection.json | +| [storageAccountEnableAd.ts][storageaccountenablead] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableAD.json | +| [storageAccountEnableCmk.ts][storageaccountenablecmk] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableCMK.json | +| [storageAccountEncryptionScopeList.ts][storageaccountencryptionscopelist] | Lists all the encryption scopes available under the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEncryptionScopeList.json | +| [storageAccountFailover.ts][storageaccountfailover] | Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountFailover.json | +| [storageAccountGetBlobInventoryPolicy.ts][storageaccountgetblobinventorypolicy] | Gets the blob inventory policy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListBlobInventoryPolicy.json | +| [storageAccountGetEncryptionScope.ts][storageaccountgetencryptionscope] | Returns the properties for the specified encryption scope. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetEncryptionScope.json | +| [storageAccountGetManagementPolicies.ts][storageaccountgetmanagementpolicies] | Gets the managementpolicy associated with the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetManagementPolicy.json | +| [storageAccountGetObjectReplicationPolicies.ts][storageaccountgetobjectreplicationpolicies] | Get the object replication policy of the storage account by policy ID. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetObjectReplicationPolicy.json | +| [storageAccountGetPrivateEndpointConnection.ts][storageaccountgetprivateendpointconnection] | Gets the specified private endpoint connection associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPrivateEndpointConnection.json | +| [storageAccountGetProperties.ts][storageaccountgetproperties] | Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetProperties.json | +| [storageAccountGetPropertiesCmkEnabled.ts][storageaccountgetpropertiescmkenabled] | Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPropertiesCMKEnabled.json | +| [storageAccountHierarchicalNamespaceMigration.ts][storageaccounthierarchicalnamespacemigration] | Live Migration of storage account to enable Hns x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountHierarchicalNamespaceMigration.json | +| [storageAccountList.ts][storageaccountlist] | Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountList.json | +| [storageAccountListAccountSas.ts][storageaccountlistaccountsas] | List SAS credentials of a storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListAccountSAS.json | +| [storageAccountListByResourceGroup.ts][storageaccountlistbyresourcegroup] | Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListByResourceGroup.json | +| [storageAccountListKeys.ts][storageaccountlistkeys] | Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListKeys.json | +| [storageAccountListObjectReplicationPolicies.ts][storageaccountlistobjectreplicationpolicies] | List the object replication policies associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListObjectReplicationPolicies.json | +| [storageAccountListPrivateEndpointConnections.ts][storageaccountlistprivateendpointconnections] | List all the private endpoint connections associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateEndpointConnections.json | +| [storageAccountListPrivateLinkResources.ts][storageaccountlistprivatelinkresources] | Gets the private link resources that need to be created for a storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateLinkResources.json | +| [storageAccountListServiceSas.ts][storageaccountlistservicesas] | List service SAS credentials of a specific resource. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListServiceSAS.json | +| [storageAccountPatchEncryptionScope.ts][storageaccountpatchencryptionscope] | Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPatchEncryptionScope.json | +| [storageAccountPutEncryptionScope.ts][storageaccountputencryptionscope] | Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScope.json | +| [storageAccountPutEncryptionScopeWithInfrastructureEncryption.ts][storageaccountputencryptionscopewithinfrastructureencryption] | Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json | +| [storageAccountPutPrivateEndpointConnection.ts][storageaccountputprivateendpointconnection] | Update the state of specified private endpoint connection associated with the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutPrivateEndpointConnection.json | +| [storageAccountRegenerateKerbKey.ts][storageaccountregeneratekerbkey] | Regenerates one of the access keys or Kerberos keys for the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKerbKey.json | +| [storageAccountRegenerateKey.ts][storageaccountregeneratekey] | Regenerates one of the access keys or Kerberos keys for the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKey.json | +| [storageAccountRevokeUserDelegationKeys.ts][storageaccountrevokeuserdelegationkeys] | Revoke user delegation keys. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRevokeUserDelegationKeys.json | +| [storageAccountSetBlobInventoryPolicy.ts][storageaccountsetblobinventorypolicy] | Sets the blob inventory policy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetBlobInventoryPolicy.json | +| [storageAccountSetManagementPolicies.ts][storageaccountsetmanagementpolicies] | Sets the managementpolicy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy.json | +| [storageAccountSetManagementPolicyForBlockAndAppendBlobs.ts][storageaccountsetmanagementpolicyforblockandappendblobs] | Sets the managementpolicy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json | +| [storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.ts][storageaccountsetmanagementpolicylastaccesstimebasedblobactions] | Sets the managementpolicy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json | +| [storageAccountSetManagementPolicyWithSnapshotAndVersion.ts][storageaccountsetmanagementpolicywithsnapshotandversion] | Sets the managementpolicy to the specified storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json | +| [storageAccountUpdate.ts][storageaccountupdate] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdate.json | +| [storageAccountUpdateAllowedCopyScopeToAad.ts][storageaccountupdateallowedcopyscopetoaad] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json | +| [storageAccountUpdateDisablePublicNetworkAccess.ts][storageaccountupdatedisablepublicnetworkaccess] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json | +| [storageAccountUpdateObjectReplicationPolicyOnDestination.ts][storageaccountupdateobjectreplicationpolicyondestination] | Create or update the object replication policy of the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json | +| [storageAccountUpdateObjectReplicationPolicyOnSource.ts][storageaccountupdateobjectreplicationpolicyonsource] | Create or update the object replication policy of the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json | +| [storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.ts][storageaccountupdateuserassignedencryptionidentitywithcmk] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json | +| [storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.ts][storageaccountupdateuserassignedidentitywithfederatedidentityclientid] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json | +| [storageAccountUpdateWithImmutabilityPolicy.ts][storageaccountupdatewithimmutabilitypolicy] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json | +| [tableOperationDelete.ts][tableoperationdelete] | Deletes the table with the specified table name, under the specified account if it exists. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationDelete.json | +| [tableOperationGet.ts][tableoperationget] | Gets the table with the specified table name, under the specified account if it exists. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationGet.json | +| [tableOperationList.ts][tableoperationlist] | Gets a list of all the tables under the specified storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationList.json | +| [tableOperationPatch.ts][tableoperationpatch] | Creates a new table with the specified table name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPatch.json | +| [tableOperationPut.ts][tableoperationput] | Creates a new table with the specified table name, under the specified account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPut.json | +| [tableServicesGet.ts][tableservicesget] | Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesGet.json | +| [tableServicesList.ts][tableserviceslist] | List all table services for the storage account. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesList.json | +| [tableServicesPut.ts][tableservicesput] | Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesPut.json | +| [updateContainers.ts][updatecontainers] | Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPatch.json | +| [updateLocalUser.ts][updatelocaluser] | Create or update the properties of a local user associated with the storage account x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserUpdate.json | +| [updateShareAcls.ts][updateshareacls] | Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareAclsPatch.json | +| [updateShares.ts][updateshares] | Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPatch.json | +| [usageList.ts][usagelist] | Gets the current usage count and the limit for the resources of the location under the subscription. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListLocationUsage.json | +| [versionLevelWormContainerMigration.ts][versionlevelwormcontainermigration] | This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/ObjectLevelWormContainerMigration.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +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/acquireALeaseOnAContainer.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 node dist/acquireALeaseOnAContainer.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[acquirealeaseonacontainer]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/acquireALeaseOnAContainer.ts +[acquirealeaseonashare]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/acquireALeaseOnAShare.ts +[blobrangesrestore]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/blobRangesRestore.ts +[blobservicesputlastaccesstimebasedtracking]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/blobServicesPutLastAccessTimeBasedTracking.ts +[breakaleaseonacontainer]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/breakALeaseOnAContainer.ts +[breakaleaseonashare]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/breakALeaseOnAShare.ts +[clearlegalholdcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/clearLegalHoldContainers.ts +[createlocaluser]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/createLocalUser.ts +[createnfsshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/createNfsShares.ts +[createorupdateimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/createOrUpdateImmutabilityPolicy.ts +[createorupdateimmutabilitypolicywithallowprotectedappendwritesall]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.ts +[deletecontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/deleteContainers.ts +[deleteimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/deleteImmutabilityPolicy.ts +[deletelocaluser]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/deleteLocalUser.ts +[deleteshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/deleteShares.ts +[deletedaccountget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/deletedAccountGet.ts +[deletedaccountlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/deletedAccountList.ts +[extendimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/extendImmutabilityPolicy.ts +[getblobcontainersgetwithallowprotectedappendwritesall]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/getBlobContainersGetWithAllowProtectedAppendWritesAll.ts +[getblobservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/getBlobServices.ts +[getcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/getContainers.ts +[getfileservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/getFileServices.ts +[getimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/getImmutabilityPolicy.ts +[getlocaluser]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/getLocalUser.ts +[getsharestats]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/getShareStats.ts +[getshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/getShares.ts +[listblobservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listBlobServices.ts +[listcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listContainers.ts +[listdeletedcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listDeletedContainers.ts +[listdeletedshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listDeletedShares.ts +[listfileservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listFileServices.ts +[listlocaluserkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listLocalUserKeys.ts +[listlocalusers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listLocalUsers.ts +[listsharesnapshots]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listShareSnapshots.ts +[listshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/listShares.ts +[lockimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/lockImmutabilityPolicy.ts +[nfsv3accountcreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/nfsV3AccountCreate.ts +[operationslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/operationsList.ts +[putblobservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putBlobServices.ts +[putcontainerwithdefaultencryptionscope]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putContainerWithDefaultEncryptionScope.ts +[putcontainerwithobjectlevelworm]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putContainerWithObjectLevelWorm.ts +[putcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putContainers.ts +[putfileservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServices.ts +[putfileservicesenablesecuresmbfeatures]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServicesEnableSecureSmbFeatures.ts +[putfileservicesenablesmbmultichannel]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServicesEnableSmbMultichannel.ts +[putshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putShares.ts +[putshareswithaccesstier]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/putSharesWithAccessTier.ts +[queueoperationdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationDelete.ts +[queueoperationget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationGet.ts +[queueoperationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationList.ts +[queueoperationpatch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPatch.ts +[queueoperationput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPut.ts +[queueoperationputwithmetadata]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPutWithMetadata.ts +[queueservicesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesGet.ts +[queueserviceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesList.ts +[queueservicesput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesPut.ts +[regeneratelocaluserpassword]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/regenerateLocalUserPassword.ts +[restoreshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/restoreShares.ts +[setlegalholdcontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/setLegalHoldContainers.ts +[setlegalholdcontainerswithallowprotectedappendwritesall]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/setLegalHoldContainersWithAllowProtectedAppendWritesAll.ts +[skulist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/skuList.ts +[storageaccountaborthierarchicalnamespacemigration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountAbortHierarchicalNamespaceMigration.ts +[storageaccountchecknameavailability]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCheckNameAvailability.ts +[storageaccountcreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreate.ts +[storageaccountcreateallowedcopyscopetoaad]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateAllowedCopyScopeToAad.ts +[storageaccountcreateallowedcopyscopetoprivatelink]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateAllowedCopyScopeToPrivateLink.ts +[storageaccountcreatedisallowpublicnetworkaccess]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateDisallowPublicNetworkAccess.ts +[storageaccountcreateenablepublicnetworkaccess]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateEnablePublicNetworkAccess.ts +[storageaccountcreateobjectreplicationpolicyondestination]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateObjectReplicationPolicyOnDestination.ts +[storageaccountcreateobjectreplicationpolicyonsource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateObjectReplicationPolicyOnSource.ts +[storageaccountcreateuserassignedencryptionidentitywithcmk]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.ts +[storageaccountcreateuserassignedidentitywithfederatedidentityclientid]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.ts +[storageaccountcreatewithimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateWithImmutabilityPolicy.ts +[storageaccountdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDelete.ts +[storageaccountdeleteblobinventorypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteBlobInventoryPolicy.ts +[storageaccountdeletemanagementpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteManagementPolicies.ts +[storageaccountdeleteobjectreplicationpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteObjectReplicationPolicies.ts +[storageaccountdeleteprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeletePrivateEndpointConnection.ts +[storageaccountenablead]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEnableAd.ts +[storageaccountenablecmk]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEnableCmk.ts +[storageaccountencryptionscopelist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEncryptionScopeList.ts +[storageaccountfailover]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountFailover.ts +[storageaccountgetblobinventorypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetBlobInventoryPolicy.ts +[storageaccountgetencryptionscope]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetEncryptionScope.ts +[storageaccountgetmanagementpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetManagementPolicies.ts +[storageaccountgetobjectreplicationpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetObjectReplicationPolicies.ts +[storageaccountgetprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetPrivateEndpointConnection.ts +[storageaccountgetproperties]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetProperties.ts +[storageaccountgetpropertiescmkenabled]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetPropertiesCmkEnabled.ts +[storageaccounthierarchicalnamespacemigration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountHierarchicalNamespaceMigration.ts +[storageaccountlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountList.ts +[storageaccountlistaccountsas]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListAccountSas.ts +[storageaccountlistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListByResourceGroup.ts +[storageaccountlistkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListKeys.ts +[storageaccountlistobjectreplicationpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListObjectReplicationPolicies.ts +[storageaccountlistprivateendpointconnections]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListPrivateEndpointConnections.ts +[storageaccountlistprivatelinkresources]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListPrivateLinkResources.ts +[storageaccountlistservicesas]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListServiceSas.ts +[storageaccountpatchencryptionscope]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPatchEncryptionScope.ts +[storageaccountputencryptionscope]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutEncryptionScope.ts +[storageaccountputencryptionscopewithinfrastructureencryption]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutEncryptionScopeWithInfrastructureEncryption.ts +[storageaccountputprivateendpointconnection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutPrivateEndpointConnection.ts +[storageaccountregeneratekerbkey]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRegenerateKerbKey.ts +[storageaccountregeneratekey]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRegenerateKey.ts +[storageaccountrevokeuserdelegationkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRevokeUserDelegationKeys.ts +[storageaccountsetblobinventorypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetBlobInventoryPolicy.ts +[storageaccountsetmanagementpolicies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicies.ts +[storageaccountsetmanagementpolicyforblockandappendblobs]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyForBlockAndAppendBlobs.ts +[storageaccountsetmanagementpolicylastaccesstimebasedblobactions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.ts +[storageaccountsetmanagementpolicywithsnapshotandversion]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyWithSnapshotAndVersion.ts +[storageaccountupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdate.ts +[storageaccountupdateallowedcopyscopetoaad]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateAllowedCopyScopeToAad.ts +[storageaccountupdatedisablepublicnetworkaccess]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateDisablePublicNetworkAccess.ts +[storageaccountupdateobjectreplicationpolicyondestination]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateObjectReplicationPolicyOnDestination.ts +[storageaccountupdateobjectreplicationpolicyonsource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateObjectReplicationPolicyOnSource.ts +[storageaccountupdateuserassignedencryptionidentitywithcmk]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.ts +[storageaccountupdateuserassignedidentitywithfederatedidentityclientid]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.ts +[storageaccountupdatewithimmutabilitypolicy]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateWithImmutabilityPolicy.ts +[tableoperationdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationDelete.ts +[tableoperationget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationGet.ts +[tableoperationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationList.ts +[tableoperationpatch]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationPatch.ts +[tableoperationput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationPut.ts +[tableservicesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesGet.ts +[tableserviceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesList.ts +[tableservicesput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesPut.ts +[updatecontainers]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/updateContainers.ts +[updatelocaluser]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/updateLocalUser.ts +[updateshareacls]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/updateShareAcls.ts +[updateshares]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/updateShares.ts +[usagelist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/usageList.ts +[versionlevelwormcontainermigration]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/arm-storage/samples/v17/typescript/src/versionLevelWormContainerMigration.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storage?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/arm-storage/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/storage/arm-storage/samples/v17/typescript/package.json b/sdk/storage/arm-storage/samples/v17/typescript/package.json new file mode 100644 index 000000000000..a1ed7c163a04 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-storage-samples-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/storage/arm-storage" + }, + "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/storage/arm-storage", + "dependencies": { + "@azure/arm-storage": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/storage/arm-storage/samples/v17/typescript/sample.env b/sdk/storage/arm-storage/samples/v17/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/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/storage/arm-storage/samples/v17/typescript/src/acquireALeaseOnAContainer.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/acquireALeaseOnAContainer.ts new file mode 100644 index 000000000000..e235beb0774b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/acquireALeaseOnAContainer.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. +/** + * This sample demonstrates how to The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Acquire.json + */ +import { + LeaseContainerRequest, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function acquireALeaseOnAContainer() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const parameters: LeaseContainerRequest = { + action: "Acquire", + breakPeriod: undefined, + leaseDuration: -1, + leaseId: undefined, + proposedLeaseId: undefined + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lease( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +acquireALeaseOnAContainer().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/acquireALeaseOnAShare.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/acquireALeaseOnAShare.ts new file mode 100644 index 000000000000..2c741d44433c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/acquireALeaseOnAShare.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. +/** + * This sample demonstrates how to The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Acquire.json + */ +import { LeaseShareRequest, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function acquireALeaseOnAShare() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share124"; + const parameters: LeaseShareRequest = { + action: "Acquire", + breakPeriod: undefined, + leaseDuration: -1, + leaseId: undefined, + proposedLeaseId: undefined + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.lease( + resourceGroupName, + accountName, + shareName, + options + ); + console.log(result); +} + +acquireALeaseOnAShare().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/blobRangesRestore.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/blobRangesRestore.ts new file mode 100644 index 000000000000..afae81fe8b07 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/blobRangesRestore.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. +/** + * This sample demonstrates how to Restore blobs in the specified blob ranges + * + * @summary Restore blobs in the specified blob ranges + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobRangesRestore.json + */ +import { + BlobRestoreParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function blobRangesRestore() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: BlobRestoreParameters = { + blobRanges: [ + { endRange: "container/blobpath2", startRange: "container/blobpath1" }, + { endRange: "", startRange: "container2/blobpath3" } + ], + timeToRestore: new Date("2019-04-20T15:30:00.0000000Z") + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginRestoreBlobRangesAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +blobRangesRestore().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/blobServicesPutLastAccessTimeBasedTracking.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/blobServicesPutLastAccessTimeBasedTracking.ts new file mode 100644 index 000000000000..88bb720e93c3 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/blobServicesPutLastAccessTimeBasedTracking.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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json + */ +import { + BlobServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function blobServicesPutLastAccessTimeBasedTracking() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: BlobServiceProperties = { + lastAccessTimeTrackingPolicy: { + name: "AccessTimeTracking", + blobType: ["blockBlob"], + enable: true, + trackingGranularityInDays: 1 + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +blobServicesPutLastAccessTimeBasedTracking().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/breakALeaseOnAContainer.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/breakALeaseOnAContainer.ts new file mode 100644 index 000000000000..645ca85ec195 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/breakALeaseOnAContainer.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. +/** + * This sample demonstrates how to The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Container operation establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLease_Break.json + */ +import { + LeaseContainerRequest, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function breakALeaseOnAContainer() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const parameters: LeaseContainerRequest = { + action: "Break", + breakPeriod: undefined, + leaseDuration: undefined, + leaseId: "8698f513-fa75-44a1-b8eb-30ba336af27d", + proposedLeaseId: undefined + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lease( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +breakALeaseOnAContainer().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/breakALeaseOnAShare.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/breakALeaseOnAShare.ts new file mode 100644 index 000000000000..4bded8ea5f55 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/breakALeaseOnAShare.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. +/** + * This sample demonstrates how to The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * + * @summary The Lease Share operation establishes and manages a lock on a share for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesLease_Break.json + */ +import { LeaseShareRequest, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function breakALeaseOnAShare() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share12"; + const parameters: LeaseShareRequest = { + action: "Break", + breakPeriod: undefined, + leaseDuration: undefined, + leaseId: "8698f513-fa75-44a1-b8eb-30ba336af27d", + proposedLeaseId: undefined + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.lease( + resourceGroupName, + accountName, + shareName, + options + ); + console.log(result); +} + +breakALeaseOnAShare().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/clearLegalHoldContainers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/clearLegalHoldContainers.ts new file mode 100644 index 000000000000..cf27258db70c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/clearLegalHoldContainers.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. +/** + * This sample demonstrates how to Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * + * @summary Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the specified tags in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersClearLegalHold.json + */ +import { LegalHold, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function clearLegalHoldContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold: LegalHold = { tags: ["tag1", "tag2", "tag3"] }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.clearLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +clearLegalHoldContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/createLocalUser.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/createLocalUser.ts new file mode 100644 index 000000000000..dd96b341fd3b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/createLocalUser.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. +/** + * This sample demonstrates how to Create or update the properties of a local user associated with the storage account + * + * @summary Create or update the properties of a local user associated with the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserCreate.json + */ +import { LocalUser, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const properties: LocalUser = { + hasSshPassword: true, + homeDirectory: "homedirectory", + permissionScopes: [ + { permissions: "rwd", resourceName: "share1", service: "file" }, + { permissions: "rw", resourceName: "share2", service: "file" } + ], + sshAuthorizedKeys: [ + { description: "key name", key: "ssh-rsa keykeykeykeykey=" } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.createOrUpdate( + resourceGroupName, + accountName, + username, + properties + ); + console.log(result); +} + +createLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/createNfsShares.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/createNfsShares.ts new file mode 100644 index 000000000000..e3b59eccb4c4 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/createNfsShares.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_NFS.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createNfsShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res346"; + const accountName = "sto666"; + const shareName = "share1235"; + const fileShare: FileShare = { enabledProtocols: "NFS" }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +createNfsShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/createOrUpdateImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/createOrUpdateImmutabilityPolicy.ts new file mode 100644 index 000000000000..501a3797926f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/createOrUpdateImmutabilityPolicy.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. +/** + * This sample demonstrates how to Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @summary Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicy.json + */ +import { + ImmutabilityPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const parameters: ImmutabilityPolicy = { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 3 + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.createOrUpdateImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +createOrUpdateImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.ts new file mode 100644 index 000000000000..8a39a272ef81 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll.ts @@ -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. +/** + * This sample demonstrates how to Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * + * @summary Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutImmutabilityPolicyAllowProtectedAppendWritesAll.json + */ +import { + ImmutabilityPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const parameters: ImmutabilityPolicy = { + allowProtectedAppendWritesAll: true, + immutabilityPeriodSinceCreationInDays: 3 + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.createOrUpdateImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + options + ); + console.log(result); +} + +createOrUpdateImmutabilityPolicyWithAllowProtectedAppendWritesAll().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/deleteContainers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/deleteContainers.ts new file mode 100644 index 000000000000..88efa773ad9c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/deleteContainers.ts @@ -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. +/** + * This sample demonstrates how to Deletes specified container under its account. + * + * @summary Deletes specified container under its account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4079"; + const accountName = "sto4506"; + const containerName = "container9689"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.delete( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +deleteContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/deleteImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/deleteImmutabilityPolicy.ts new file mode 100644 index 000000000000..32f20895886f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/deleteImmutabilityPolicy.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. +/** + * This sample demonstrates how to Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. + * + * @summary Aborts an unlocked immutability policy. The response of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in If-Match is required for this operation. Deleting a locked immutability policy is not allowed, the only way is to delete the container after deleting all expired blobs inside the policy locked container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersDeleteImmutabilityPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1581"; + const accountName = "sto9621"; + const containerName = "container4910"; + const ifMatch = '"8d59f81a7fa7be0"'; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.deleteImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch + ); + console.log(result); +} + +deleteImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/deleteLocalUser.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/deleteLocalUser.ts new file mode 100644 index 000000000000..56c806bd7e1a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/deleteLocalUser.ts @@ -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. +/** + * This sample demonstrates how to Deletes the local user associated with the specified storage account. + * + * @summary Deletes the local user associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.delete( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +deleteLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/deleteShares.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/deleteShares.ts new file mode 100644 index 000000000000..8ab118e288d1 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/deleteShares.ts @@ -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. +/** + * This sample demonstrates how to Deletes specified share under its account. + * + * @summary Deletes specified share under its account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deleteShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4079"; + const accountName = "sto4506"; + const shareName = "share9689"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.delete( + resourceGroupName, + accountName, + shareName + ); + console.log(result); +} + +deleteShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/deletedAccountGet.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/deletedAccountGet.ts new file mode 100644 index 000000000000..dc379a6a9644 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/deletedAccountGet.ts @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to Get properties of specified deleted account resource. + * + * @summary Get properties of specified deleted account resource. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deletedAccountGet() { + const subscriptionId = "{subscription-id}"; + const deletedAccountName = "sto1125"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.deletedAccounts.get(deletedAccountName, location); + console.log(result); +} + +deletedAccountGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/deletedAccountList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/deletedAccountList.ts new file mode 100644 index 000000000000..da0bd9a3c423 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/deletedAccountList.ts @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists deleted accounts under the subscription. + * + * @summary Lists deleted accounts under the subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedAccountList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function deletedAccountList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.deletedAccounts.list()) { + resArray.push(item); + } + console.log(resArray); +} + +deletedAccountList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/extendImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/extendImmutabilityPolicy.ts new file mode 100644 index 000000000000..92ff81bb5112 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/extendImmutabilityPolicy.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. +/** + * This sample demonstrates how to Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * + * @summary Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersExtendImmutabilityPolicy.json + */ +import { + ImmutabilityPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function extendImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6238"; + const accountName = "sto232"; + const containerName = "container5023"; + const ifMatch = '"8d59f830d0c3bf9"'; + const parameters: ImmutabilityPolicy = { + immutabilityPeriodSinceCreationInDays: 100 + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.extendImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch, + options + ); + console.log(result); +} + +extendImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/getBlobContainersGetWithAllowProtectedAppendWritesAll.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/getBlobContainersGetWithAllowProtectedAppendWritesAll.ts new file mode 100644 index 000000000000..c4c37bd8f994 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/getBlobContainersGetWithAllowProtectedAppendWritesAll.ts @@ -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. +/** + * This sample demonstrates how to Gets properties of a specified container. + * + * @summary Gets properties of a specified container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetWithAllowProtectedAppendWritesAll.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getBlobContainersGetWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const containerName = "container1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.get( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +getBlobContainersGetWithAllowProtectedAppendWritesAll().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/getBlobServices.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/getBlobServices.ts new file mode 100644 index 000000000000..c30c57b41e50 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/getBlobServices.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.getServiceProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +getBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/getContainers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/getContainers.ts new file mode 100644 index 000000000000..8e12a39ded3e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/getContainers.ts @@ -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. +/** + * This sample demonstrates how to Gets properties of a specified container. + * + * @summary Gets properties of a specified container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const containerName = "container1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.get( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +getContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/getFileServices.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/getFileServices.ts new file mode 100644 index 000000000000..530e31c01ba4 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/getFileServices.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.getServiceProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +getFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/getImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/getImmutabilityPolicy.ts new file mode 100644 index 000000000000..8f0765be7701 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/getImmutabilityPolicy.ts @@ -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. +/** + * This sample demonstrates how to Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * + * @summary Gets the existing immutability policy along with the corresponding ETag in response headers and body. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersGetImmutabilityPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res5221"; + const accountName = "sto9177"; + const containerName = "container3489"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.getImmutabilityPolicy( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +getImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/getLocalUser.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/getLocalUser.ts new file mode 100644 index 000000000000..107a555f0c91 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/getLocalUser.ts @@ -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. +/** + * This sample demonstrates how to Get the local user of the storage account by username. + * + * @summary Get the local user of the storage account by username. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.get( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +getLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/getShareStats.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/getShareStats.ts new file mode 100644 index 000000000000..622ea88ebc9c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/getShareStats.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. +/** + * This sample demonstrates how to Gets properties of a specified share. + * + * @summary Gets properties of a specified share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet_Stats.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getShareStats() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const shareName = "share1634"; + const expand = "stats"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.get( + resourceGroupName, + accountName, + shareName, + options + ); + console.log(result); +} + +getShareStats().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/getShares.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/getShares.ts new file mode 100644 index 000000000000..e5e2cf7e3f29 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/getShares.ts @@ -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. +/** + * This sample demonstrates how to Gets properties of a specified share. + * + * @summary Gets properties of a specified share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9871"; + const accountName = "sto6217"; + const shareName = "share1634"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.get( + resourceGroupName, + accountName, + shareName + ); + console.log(result); +} + +getShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listBlobServices.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listBlobServices.ts new file mode 100644 index 000000000000..4e105de62233 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listBlobServices.ts @@ -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. +/** + * This sample demonstrates how to List blob services of storage account. It returns a collection of one object named default. + * + * @summary List blob services of storage account. It returns a collection of one object named default. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobServices.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listContainers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listContainers.ts new file mode 100644 index 000000000000..bdfe0e2a2cb1 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listContainers.ts @@ -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. +/** + * This sample demonstrates how to Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @summary Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobContainers.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listDeletedContainers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listDeletedContainers.ts new file mode 100644 index 000000000000..ecf31494b8c7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listDeletedContainers.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. +/** + * This sample demonstrates how to Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * + * @summary Lists all containers and does not support a prefix like data plane. Also SRP today does not return continuation token. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedBlobContainersList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listDeletedContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const include = "deleted"; + const options = { include: include }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobContainers.list( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDeletedContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listDeletedShares.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listDeletedShares.ts new file mode 100644 index 000000000000..ede8fa2a2929 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listDeletedShares.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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/DeletedFileSharesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listDeletedShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const expand = "deleted"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listDeletedShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listFileServices.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listFileServices.ts new file mode 100644 index 000000000000..87199dc12a48 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listFileServices.ts @@ -0,0 +1,30 @@ +/* + * 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. +/** + * This sample demonstrates how to List all file services in storage accounts + * + * @summary List all file services in storage accounts + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.list(resourceGroupName, accountName); + console.log(result); +} + +listFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listLocalUserKeys.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listLocalUserKeys.ts new file mode 100644 index 000000000000..4849af2c2031 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listLocalUserKeys.ts @@ -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. +/** + * This sample demonstrates how to List SSH authorized keys and shared key of the local user. + * + * @summary List SSH authorized keys and shared key of the local user. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserListKeys.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listLocalUserKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.listKeys( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +listLocalUserKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listLocalUsers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listLocalUsers.ts new file mode 100644 index 000000000000..bf1b70863ce7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listLocalUsers.ts @@ -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. +/** + * This sample demonstrates how to List the local users associated with the storage account. + * + * @summary List the local users associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUsersList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listLocalUsers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.localUsersOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listLocalUsers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listShareSnapshots.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listShareSnapshots.ts new file mode 100644 index 000000000000..14878083abb2 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listShareSnapshots.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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareSnapshotsList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listShareSnapshots() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const expand = "snapshots"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list( + resourceGroupName, + accountName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +listShareSnapshots().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/listShares.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/listShares.ts new file mode 100644 index 000000000000..98419d90a8dc --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/listShares.ts @@ -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. +/** + * This sample demonstrates how to Lists all shares. + * + * @summary Lists all shares. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function listShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fileShares.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/lockImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/lockImmutabilityPolicy.ts new file mode 100644 index 000000000000..cf121a98416c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/lockImmutabilityPolicy.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. +/** + * This sample demonstrates how to Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * + * @summary Sets the ImmutabilityPolicy to Locked state. The only action allowed on a Locked policy is ExtendImmutabilityPolicy action. ETag in If-Match is required for this operation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersLockImmutabilityPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function lockImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res2702"; + const accountName = "sto5009"; + const containerName = "container1631"; + const ifMatch = '"8d59f825b721dd3"'; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.lockImmutabilityPolicy( + resourceGroupName, + accountName, + containerName, + ifMatch + ); + console.log(result); +} + +lockImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/nfsV3AccountCreate.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/nfsV3AccountCreate.ts new file mode 100644 index 000000000000..64b0abfcd07d --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/nfsV3AccountCreate.ts @@ -0,0 +1,56 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/NfsV3AccountCreate.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function nfsV3AccountCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + isHnsEnabled: true, + enableNfsV3: true, + kind: "BlockBlobStorage", + location: "eastus", + networkRuleSet: { + bypass: "AzureServices", + defaultAction: "Allow", + ipRules: [], + virtualNetworkRules: [ + { + virtualNetworkResourceId: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Network/virtualNetworks/net123/subnets/subnet12" + } + ] + }, + sku: { name: "Premium_LRS" }, + enableHttpsTrafficOnly: false + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +nfsV3AccountCreate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/operationsList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/operationsList.ts new file mode 100644 index 000000000000..d3ed92178652 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/operationsList.ts @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all of the available Storage Rest API operations. + * + * @summary Lists all of the available Storage Rest API operations. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/OperationsList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putBlobServices.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putBlobServices.ts new file mode 100644 index 000000000000..8783cd8d594a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putBlobServices.ts @@ -0,0 +1,79 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobServicesPut.json + */ +import { + BlobServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putBlobServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: BlobServiceProperties = { + changeFeed: { enabled: true, retentionInDays: 7 }, + cors: { + corsRules: [ + { + allowedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100 + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2 + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: [ + "http://www.abc23.com", + "https://www.fabrikam.com/*" + ], + exposedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x -ms-meta-target*" + ], + maxAgeInSeconds: 2000 + } + ] + }, + defaultServiceVersion: "2017-07-29", + deleteRetentionPolicy: { days: 300, enabled: true }, + isVersioningEnabled: true + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putBlobServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putContainerWithDefaultEncryptionScope.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putContainerWithDefaultEncryptionScope.ts new file mode 100644 index 000000000000..787f9df56e66 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putContainerWithDefaultEncryptionScope.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutDefaultEncryptionScope.json + */ +import { BlobContainer, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putContainerWithDefaultEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer: BlobContainer = { + defaultEncryptionScope: "encryptionscope185", + denyEncryptionScopeOverride: true + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainerWithDefaultEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putContainerWithObjectLevelWorm.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putContainerWithObjectLevelWorm.ts new file mode 100644 index 000000000000..156b9db832ca --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putContainerWithObjectLevelWorm.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPutObjectLevelWorm.json + */ +import { BlobContainer, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putContainerWithObjectLevelWorm() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer: BlobContainer = { + immutableStorageWithVersioning: { enabled: true } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainerWithObjectLevelWorm().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putContainers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putContainers.ts new file mode 100644 index 000000000000..4810d3313275 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putContainers.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. +/** + * This sample demonstrates how to Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * + * @summary Creates a new container under the specified account as described by request body. The container resource includes metadata and properties for that container. It does not include a list of the blobs contained by the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPut.json + */ +import { BlobContainer, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer: BlobContainer = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.create( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +putContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServices.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServices.ts new file mode 100644 index 000000000000..26d074d21b2a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServices.ts @@ -0,0 +1,75 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut.json + */ +import { + FileServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putFileServices() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: FileServiceProperties = { + cors: { + corsRules: [ + { + allowedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100 + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2 + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: [ + "http://www.abc23.com", + "https://www.fabrikam.com/*" + ], + exposedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + maxAgeInSeconds: 2000 + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServices().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServicesEnableSecureSmbFeatures.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServicesEnableSecureSmbFeatures.ts new file mode 100644 index 000000000000..e02f71924425 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServicesEnableSecureSmbFeatures.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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSecureSmbFeatures.json + */ +import { + FileServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putFileServicesEnableSecureSmbFeatures() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: FileServiceProperties = { + protocolSettings: { + smb: { + authenticationMethods: "NTLMv2;Kerberos", + channelEncryption: "AES-128-CCM;AES-128-GCM;AES-256-GCM", + kerberosTicketEncryption: "RC4-HMAC;AES-256", + versions: "SMB2.1;SMB3.0;SMB3.1.1" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServicesEnableSecureSmbFeatures().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServicesEnableSmbMultichannel.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServicesEnableSmbMultichannel.ts new file mode 100644 index 000000000000..cacb5f72f5a6 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putFileServicesEnableSmbMultichannel.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. +/** + * This sample demonstrates how to Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileServicesPut_EnableSMBMultichannel.json + */ +import { + FileServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putFileServicesEnableSmbMultichannel() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: FileServiceProperties = { + protocolSettings: { smb: { multichannel: { enabled: true } } } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +putFileServicesEnableSmbMultichannel().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putShares.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putShares.ts new file mode 100644 index 000000000000..6dbdfb87aa2b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putShares.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare: FileShare = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +putShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/putSharesWithAccessTier.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/putSharesWithAccessTier.ts new file mode 100644 index 000000000000..05658d18810c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/putSharesWithAccessTier.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. +/** + * This sample demonstrates how to Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * + * @summary Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPut_AccessTier.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function putSharesWithAccessTier() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res346"; + const accountName = "sto666"; + const shareName = "share1235"; + const fileShare: FileShare = { accessTier: "Hot" }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.create( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +putSharesWithAccessTier().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationDelete.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationDelete.ts new file mode 100644 index 000000000000..4819a66383c8 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationDelete.ts @@ -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. +/** + * This sample demonstrates how to Deletes the queue with the specified queue name, under the specified account if it exists. + * + * @summary Deletes the queue with the specified queue name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.delete( + resourceGroupName, + accountName, + queueName + ); + console.log(result); +} + +queueOperationDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationGet.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationGet.ts new file mode 100644 index 000000000000..0fdd38e2ff5e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationGet.ts @@ -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. +/** + * This sample demonstrates how to Gets the queue with the specified queue name, under the specified account if it exists. + * + * @summary Gets the queue with the specified queue name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.get( + resourceGroupName, + accountName, + queueName + ); + console.log(result); +} + +queueOperationGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationList.ts new file mode 100644 index 000000000000..4ca31cb2ee93 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationList.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets a list of all the queues under the specified storage account + * + * @summary Gets a list of all the queues under the specified storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto328"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.queue.list(resourceGroupName, accountName)) { + resArray.push(item); + } + console.log(resArray); +} + +queueOperationList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPatch.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPatch.ts new file mode 100644 index 000000000000..e1b8fc33047a --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPatch.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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPatch.json + */ +import { StorageQueue, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationPatch() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue: StorageQueue = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.update( + resourceGroupName, + accountName, + queueName, + queue + ); + console.log(result); +} + +queueOperationPatch().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPut.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPut.ts new file mode 100644 index 000000000000..ec99ab868cb9 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPut.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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPut.json + */ +import { StorageQueue, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue: StorageQueue = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.create( + resourceGroupName, + accountName, + queueName, + queue + ); + console.log(result); +} + +queueOperationPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPutWithMetadata.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPutWithMetadata.ts new file mode 100644 index 000000000000..5ac95d69c401 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueOperationPutWithMetadata.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. +/** + * This sample demonstrates how to Creates a new queue with the specified queue name, under the specified account. + * + * @summary Creates a new queue with the specified queue name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueOperationPutWithMetadata.json + */ +import { StorageQueue, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueOperationPutWithMetadata() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const queueName = "queue6185"; + const queue: StorageQueue = { + metadata: { sample1: "meta1", sample2: "meta2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queue.create( + resourceGroupName, + accountName, + queueName, + queue + ); + console.log(result); +} + +queueOperationPutWithMetadata().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesGet.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesGet.ts new file mode 100644 index 000000000000..d3c34c442aac --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesGet.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueServicesGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.getServiceProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +queueServicesGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesList.ts new file mode 100644 index 000000000000..c5199bbdef2d --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesList.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to List all queue services for the storage account + * + * @summary List all queue services for the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueServicesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.list( + resourceGroupName, + accountName + ); + console.log(result); +} + +queueServicesList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesPut.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesPut.ts new file mode 100644 index 000000000000..7014b257d808 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/queueServicesPut.ts @@ -0,0 +1,75 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/QueueServicesPut.json + */ +import { + QueueServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queueServicesPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: QueueServiceProperties = { + cors: { + corsRules: [ + { + allowedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100 + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2 + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: [ + "http://www.abc23.com", + "https://www.fabrikam.com/*" + ], + exposedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + maxAgeInSeconds: 2000 + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.queueServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +queueServicesPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/regenerateLocalUserPassword.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/regenerateLocalUserPassword.ts new file mode 100644 index 000000000000..5c821ddc446b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/regenerateLocalUserPassword.ts @@ -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. +/** + * This sample demonstrates how to Regenerate the local user SSH password. + * + * @summary Regenerate the local user SSH password. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserRegeneratePassword.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function regenerateLocalUserPassword() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.regeneratePassword( + resourceGroupName, + accountName, + username + ); + console.log(result); +} + +regenerateLocalUserPassword().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/restoreShares.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/restoreShares.ts new file mode 100644 index 000000000000..ca60098fc6f7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/restoreShares.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. +/** + * This sample demonstrates how to Restore a file share within a valid retention days if share soft delete is enabled + * + * @summary Restore a file share within a valid retention days if share soft delete is enabled + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesRestore.json + */ +import { DeletedShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function restoreShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share1249"; + const deletedShare: DeletedShare = { + deletedShareName: "share1249", + deletedShareVersion: "1234567890" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.restore( + resourceGroupName, + accountName, + shareName, + deletedShare + ); + console.log(result); +} + +restoreShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/setLegalHoldContainers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/setLegalHoldContainers.ts new file mode 100644 index 000000000000..0bfed01f2f8e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/setLegalHoldContainers.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. +/** + * This sample demonstrates how to Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @summary Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHold.json + */ +import { LegalHold, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function setLegalHoldContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold: LegalHold = { tags: ["tag1", "tag2", "tag3"] }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.setLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +setLegalHoldContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/setLegalHoldContainersWithAllowProtectedAppendWritesAll.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/setLegalHoldContainersWithAllowProtectedAppendWritesAll.ts new file mode 100644 index 000000000000..07ab05a71884 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/setLegalHoldContainersWithAllowProtectedAppendWritesAll.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. +/** + * This sample demonstrates how to Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * + * @summary Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersSetLegalHoldAllowProtectedAppendWritesAll.json + */ +import { LegalHold, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function setLegalHoldContainersWithAllowProtectedAppendWritesAll() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4303"; + const accountName = "sto7280"; + const containerName = "container8723"; + const legalHold: LegalHold = { + allowProtectedAppendWritesAll: true, + tags: ["tag1", "tag2", "tag3"] + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.setLegalHold( + resourceGroupName, + accountName, + containerName, + legalHold + ); + console.log(result); +} + +setLegalHoldContainersWithAllowProtectedAppendWritesAll().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/skuList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/skuList.ts new file mode 100644 index 000000000000..a25eb2c8a420 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/skuList.ts @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists the available SKUs supported by Microsoft.Storage for given subscription. + * + * @summary Lists the available SKUs supported by Microsoft.Storage for given subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/SKUList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function skuList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.skus.list()) { + resArray.push(item); + } + console.log(resArray); +} + +skuList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountAbortHierarchicalNamespaceMigration.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountAbortHierarchicalNamespaceMigration.ts new file mode 100644 index 000000000000..8e310256f743 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountAbortHierarchicalNamespaceMigration.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Abort live Migration of storage account to enable Hns + * + * @summary Abort live Migration of storage account to enable Hns + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountAbortHierarchicalNamespaceMigration.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountAbortHierarchicalNamespaceMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginAbortHierarchicalNamespaceMigrationAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountAbortHierarchicalNamespaceMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCheckNameAvailability.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCheckNameAvailability.ts new file mode 100644 index 000000000000..9c65263ecfe0 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCheckNameAvailability.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. +/** + * This sample demonstrates how to Checks that the storage account name is valid and is not already in use. + * + * @summary Checks that the storage account name is valid and is not already in use. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCheckNameAvailability.json + */ +import { + StorageAccountCheckNameAvailabilityParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCheckNameAvailability() { + const subscriptionId = "{subscription-id}"; + const accountName: StorageAccountCheckNameAvailabilityParameters = { + name: "sto3363", + type: "Microsoft.Storage/storageAccounts" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.checkNameAvailability( + accountName + ); + console.log(result); +} + +storageAccountCheckNameAvailability().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreate.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreate.ts new file mode 100644 index 000000000000..1856d388e00f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreate.ts @@ -0,0 +1,65 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreate.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + defaultToOAuthAuthentication: false, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + isSftpEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateAllowedCopyScopeToAad.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateAllowedCopyScopeToAad.ts new file mode 100644 index 000000000000..b7666ed96180 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateAllowedCopyScopeToAad.ts @@ -0,0 +1,63 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToAAD.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateAllowedCopyScopeToAad() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "AAD", + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateAllowedCopyScopeToAad().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateAllowedCopyScopeToPrivateLink.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateAllowedCopyScopeToPrivateLink.ts new file mode 100644 index 000000000000..860a153fc421 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateAllowedCopyScopeToPrivateLink.ts @@ -0,0 +1,63 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateAllowedCopyScopeToPrivateLink.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateAllowedCopyScopeToPrivateLink() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "PrivateLink", + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateAllowedCopyScopeToPrivateLink().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateDisallowPublicNetworkAccess.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateDisallowPublicNetworkAccess.ts new file mode 100644 index 000000000000..117fa428a1ec --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateDisallowPublicNetworkAccess.ts @@ -0,0 +1,64 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateDisallowPublicNetworkAccess.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateDisallowPublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + publicNetworkAccess: "Disabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateDisallowPublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateEnablePublicNetworkAccess.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateEnablePublicNetworkAccess.ts new file mode 100644 index 000000000000..1734aab52ce7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateEnablePublicNetworkAccess.ts @@ -0,0 +1,64 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateEnablePublicNetworkAccess.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateEnablePublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + requireInfrastructureEncryption: false, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + isHnsEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + kind: "Storage", + location: "eastus", + minimumTlsVersion: "TLS1_2", + publicNetworkAccess: "Enabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" }, + sku: { name: "Standard_GRS" }, + tags: { key1: "value1", key2: "value2" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateEnablePublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateObjectReplicationPolicyOnDestination.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateObjectReplicationPolicyOnDestination.ts new file mode 100644 index 000000000000..280814ab518f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateObjectReplicationPolicyOnDestination.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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json + */ +import { + ObjectReplicationPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateObjectReplicationPolicyOnDestination() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "dst112"; + const objectReplicationPolicyId = "default"; + const properties: ObjectReplicationPolicy = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + sourceContainer: "scont139" + } + ], + sourceAccount: "src1122" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountCreateObjectReplicationPolicyOnDestination().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateObjectReplicationPolicyOnSource.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateObjectReplicationPolicyOnSource.ts new file mode 100644 index 000000000000..99102ae86a0b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateObjectReplicationPolicyOnSource.ts @@ -0,0 +1,54 @@ +/* + * 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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json + */ +import { + ObjectReplicationPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateObjectReplicationPolicyOnSource() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "src1122"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties: ObjectReplicationPolicy = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { + minCreationTime: "2020-02-19T16:05:00Z", + prefixMatch: ["blobA", "blobB"] + }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139" + } + ], + sourceAccount: "src1122" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountCreateObjectReplicationPolicyOnSource().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.ts new file mode 100644 index 000000000000..f04f2de0e9f5 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateUserAssignedEncryptionIdentityWithCmk.ts @@ -0,0 +1,66 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateUserAssignedEncryptionIdentityWithCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + encryption: { + encryptionIdentity: { + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}" + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": {} + } + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_LRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateUserAssignedEncryptionIdentityWithCmk().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.ts new file mode 100644 index 000000000000..70aabbb6662d --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.ts @@ -0,0 +1,68 @@ +/* + * 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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res131918"; + const accountName = "sto131918"; + const parameters: StorageAccountCreateParameters = { + encryption: { + encryptionIdentity: { + encryptionFederatedIdentityClientId: + "f83c6b1b-4d34-47e4-bb34-9d83df58b540", + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}" + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": {} + } + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_LRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateUserAssignedIdentityWithFederatedIdentityClientId().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateWithImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateWithImmutabilityPolicy.ts new file mode 100644 index 000000000000..80f0de1ba0b7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountCreateWithImmutabilityPolicy.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. +/** + * This sample demonstrates how to Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * + * @summary Asynchronously creates a new storage account with the specified parameters. If an account is already created and a subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountCreateWithImmutabilityPolicy.json + */ +import { + StorageAccountCreateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountCreateWithImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountCreateParameters = { + extendedLocation: { name: "losangeles001", type: "EdgeZone" }, + immutableStorageWithVersioning: { + enabled: true, + immutabilityPolicy: { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 15, + state: "Unlocked" + } + }, + kind: "Storage", + location: "eastus", + sku: { name: "Standard_GRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginCreateAndWait( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountCreateWithImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDelete.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDelete.ts new file mode 100644 index 000000000000..d7620767a972 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDelete.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Deletes a storage account in Microsoft Azure. + * + * @summary Deletes a storage account in Microsoft Azure. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.delete( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteBlobInventoryPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteBlobInventoryPolicy.ts new file mode 100644 index 000000000000..c78997073511 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteBlobInventoryPolicy.ts @@ -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. +/** + * This sample demonstrates how to Deletes the blob inventory policy associated with the specified storage account. + * + * @summary Deletes the blob inventory policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteBlobInventoryPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDeleteBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const blobInventoryPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobInventoryPolicies.delete( + resourceGroupName, + accountName, + blobInventoryPolicyName + ); + console.log(result); +} + +storageAccountDeleteBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteManagementPolicies.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteManagementPolicies.ts new file mode 100644 index 000000000000..f35ea945e75f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteManagementPolicies.ts @@ -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. +/** + * This sample demonstrates how to Deletes the managementpolicy associated with the specified storage account. + * + * @summary Deletes the managementpolicy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteManagementPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDeleteManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const managementPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.delete( + resourceGroupName, + accountName, + managementPolicyName + ); + console.log(result); +} + +storageAccountDeleteManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteObjectReplicationPolicies.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteObjectReplicationPolicies.ts new file mode 100644 index 000000000000..9ba035f94547 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeleteObjectReplicationPolicies.ts @@ -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. +/** + * This sample demonstrates how to Deletes the object replication policy associated with the specified storage account. + * + * @summary Deletes the object replication policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeleteObjectReplicationPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDeleteObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const objectReplicationPolicyId = "{objectReplicationPolicy-Id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.delete( + resourceGroupName, + accountName, + objectReplicationPolicyId + ); + console.log(result); +} + +storageAccountDeleteObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeletePrivateEndpointConnection.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeletePrivateEndpointConnection.ts new file mode 100644 index 000000000000..6399b7192493 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountDeletePrivateEndpointConnection.ts @@ -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. +/** + * This sample demonstrates how to Deletes the specified private endpoint connection associated with the storage account. + * + * @summary Deletes the specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountDeletePrivateEndpointConnection.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountDeletePrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.delete( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +storageAccountDeletePrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEnableAd.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEnableAd.ts new file mode 100644 index 000000000000..be44c2db1248 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEnableAd.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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableAD.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountEnableAd() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + azureFilesIdentityBasedAuthentication: { + activeDirectoryProperties: { + accountType: "User", + azureStorageSid: "S-1-5-21-2400535526-2334094090-2402026252-0012", + domainGuid: "aebfc118-9fa9-4732-a21f-d98e41a77ae1", + domainName: "adtest.com", + domainSid: "S-1-5-21-2400535526-2334094090-2402026252", + forestName: "adtest.com", + netBiosDomainName: "adtest.com", + samAccountName: "sam12498" + }, + directoryServiceOptions: "AD" + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountEnableAd().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEnableCmk.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEnableCmk.ts new file mode 100644 index 000000000000..632e82be5bf0 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEnableCmk.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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEnableCMK.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountEnableCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + encryption: { + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountEnableCmk().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEncryptionScopeList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEncryptionScopeList.ts new file mode 100644 index 000000000000..2aac5f479a38 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountEncryptionScopeList.ts @@ -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. +/** + * This sample demonstrates how to Lists all the encryption scopes available under the specified storage account. + * + * @summary Lists all the encryption scopes available under the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountEncryptionScopeList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountEncryptionScopeList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.encryptionScopes.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountEncryptionScopeList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountFailover.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountFailover.ts new file mode 100644 index 000000000000..6c34e5ad2786 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountFailover.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * + * @summary Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountFailover.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountFailover() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginFailoverAndWait( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountFailover().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetBlobInventoryPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetBlobInventoryPolicy.ts new file mode 100644 index 000000000000..4f246ace3f36 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetBlobInventoryPolicy.ts @@ -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. +/** + * This sample demonstrates how to Gets the blob inventory policy associated with the specified storage account. + * + * @summary Gets the blob inventory policy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListBlobInventoryPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.blobInventoryPolicies.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountGetBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetEncryptionScope.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetEncryptionScope.ts new file mode 100644 index 000000000000..5d2c1d9f31e8 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetEncryptionScope.ts @@ -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. +/** + * This sample demonstrates how to Returns the properties for the specified encryption scope. + * + * @summary Returns the properties for the specified encryption scope. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetEncryptionScope.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.get( + resourceGroupName, + accountName, + encryptionScopeName + ); + console.log(result); +} + +storageAccountGetEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetManagementPolicies.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetManagementPolicies.ts new file mode 100644 index 000000000000..9f8e9daaf025 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetManagementPolicies.ts @@ -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. +/** + * This sample demonstrates how to Gets the managementpolicy associated with the specified storage account. + * + * @summary Gets the managementpolicy associated with the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetManagementPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const managementPolicyName = "default"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.get( + resourceGroupName, + accountName, + managementPolicyName + ); + console.log(result); +} + +storageAccountGetManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetObjectReplicationPolicies.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetObjectReplicationPolicies.ts new file mode 100644 index 000000000000..68373eb072b2 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetObjectReplicationPolicies.ts @@ -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. +/** + * This sample demonstrates how to Get the object replication policy of the storage account by policy ID. + * + * @summary Get the object replication policy of the storage account by policy ID. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetObjectReplicationPolicy.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const objectReplicationPolicyId = "{objectReplicationPolicy-Id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.get( + resourceGroupName, + accountName, + objectReplicationPolicyId + ); + console.log(result); +} + +storageAccountGetObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetPrivateEndpointConnection.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetPrivateEndpointConnection.ts new file mode 100644 index 000000000000..68e50dba8b26 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetPrivateEndpointConnection.ts @@ -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. +/** + * This sample demonstrates how to Gets the specified private endpoint connection associated with the storage account. + * + * @summary Gets the specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPrivateEndpointConnection.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetPrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + accountName, + privateEndpointConnectionName + ); + console.log(result); +} + +storageAccountGetPrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetProperties.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetProperties.ts new file mode 100644 index 000000000000..da501f553341 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetProperties.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @summary Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetProperties.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetProperties() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.getProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountGetProperties().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetPropertiesCmkEnabled.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetPropertiesCmkEnabled.ts new file mode 100644 index 000000000000..5bebe3c294eb --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountGetPropertiesCmkEnabled.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * + * @summary Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountGetPropertiesCMKEnabled.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountGetPropertiesCmkEnabled() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.getProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountGetPropertiesCmkEnabled().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountHierarchicalNamespaceMigration.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountHierarchicalNamespaceMigration.ts new file mode 100644 index 000000000000..331b4c1cad99 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountHierarchicalNamespaceMigration.ts @@ -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. +/** + * This sample demonstrates how to Live Migration of storage account to enable Hns + * + * @summary Live Migration of storage account to enable Hns + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountHierarchicalNamespaceMigration.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountHierarchicalNamespaceMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4228"; + const accountName = "sto2434"; + const requestType = "HnsOnValidationRequest"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.beginHierarchicalNamespaceMigrationAndWait( + resourceGroupName, + accountName, + requestType + ); + console.log(result); +} + +storageAccountHierarchicalNamespaceMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountList.ts new file mode 100644 index 000000000000..eb12c21b5bc5 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountList.ts @@ -0,0 +1,31 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @summary Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountList() { + const subscriptionId = "{subscription-id}"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.list()) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListAccountSas.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListAccountSas.ts new file mode 100644 index 000000000000..3ce2cd77e1d2 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListAccountSas.ts @@ -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. +/** + * This sample demonstrates how to List SAS credentials of a storage account. + * + * @summary List SAS credentials of a storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListAccountSAS.json + */ +import { + AccountSasParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListAccountSas() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7985"; + const accountName = "sto8588"; + const parameters: AccountSasParameters = { + keyToSign: "key1", + sharedAccessExpiryTime: new Date("2017-05-24T11:42:03.1567373Z"), + permissions: "r", + protocols: "https,http", + resourceTypes: "s", + services: "b", + sharedAccessStartTime: new Date("2017-05-24T10:42:03.1567373Z") + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listAccountSAS( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountListAccountSas().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListByResourceGroup.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListByResourceGroup.ts new file mode 100644 index 000000000000..20801e4d7454 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListByResourceGroup.ts @@ -0,0 +1,34 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * + * @summary Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListByResourceGroup.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListByResourceGroup() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6117"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageAccounts.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListByResourceGroup().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListKeys.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListKeys.ts new file mode 100644 index 000000000000..34adce3fc961 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListKeys.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. + * + * @summary Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListKeys.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res418"; + const accountName = "sto2220"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountListKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListObjectReplicationPolicies.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListObjectReplicationPolicies.ts new file mode 100644 index 000000000000..4e62fc31260c --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListObjectReplicationPolicies.ts @@ -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. +/** + * This sample demonstrates how to List the object replication policies associated with the storage account. + * + * @summary List the object replication policies associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListObjectReplicationPolicies.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListObjectReplicationPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.objectReplicationPoliciesOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListObjectReplicationPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListPrivateEndpointConnections.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListPrivateEndpointConnections.ts new file mode 100644 index 000000000000..7150c8a6c5aa --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListPrivateEndpointConnections.ts @@ -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. +/** + * This sample demonstrates how to List all the private endpoint connections associated with the storage account. + * + * @summary List all the private endpoint connections associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateEndpointConnections.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListPrivateEndpointConnections() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageAccountListPrivateEndpointConnections().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListPrivateLinkResources.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListPrivateLinkResources.ts new file mode 100644 index 000000000000..8b2111b10fb2 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListPrivateLinkResources.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the private link resources that need to be created for a storage account. + * + * @summary Gets the private link resources that need to be created for a storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListPrivateLinkResources.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListPrivateLinkResources() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateLinkResources.listByStorageAccount( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountListPrivateLinkResources().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListServiceSas.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListServiceSas.ts new file mode 100644 index 000000000000..4574decb1c87 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountListServiceSas.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. +/** + * This sample demonstrates how to List service SAS credentials of a specific resource. + * + * @summary List service SAS credentials of a specific resource. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListServiceSAS.json + */ +import { + ServiceSasParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountListServiceSas() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7439"; + const accountName = "sto1299"; + const parameters: ServiceSasParameters = { + canonicalizedResource: "/blob/sto1299/music", + sharedAccessExpiryTime: new Date("2017-05-24T11:32:48.8457197Z"), + permissions: "l", + resource: "c" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.listServiceSAS( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountListServiceSas().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPatchEncryptionScope.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPatchEncryptionScope.ts new file mode 100644 index 000000000000..7f13eb63232e --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPatchEncryptionScope.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. +/** + * This sample demonstrates how to Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. + * + * @summary Update encryption scope properties as specified in the request body. Update fails if the specified encryption scope does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPatchEncryptionScope.json + */ +import { EncryptionScope, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountPatchEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope: EncryptionScope = { + keyVaultProperties: { + keyUri: + "https://testvault.vault.core.windows.net/keys/key1/863425f1358359c" + }, + source: "Microsoft.KeyVault" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.patch( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPatchEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutEncryptionScope.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutEncryptionScope.ts new file mode 100644 index 000000000000..555521bd2244 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutEncryptionScope.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. +/** + * This sample demonstrates how to Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * + * @summary Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScope.json + */ +import { EncryptionScope, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountPutEncryptionScope() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope: EncryptionScope = {}; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.put( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPutEncryptionScope().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutEncryptionScopeWithInfrastructureEncryption.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutEncryptionScopeWithInfrastructureEncryption.ts new file mode 100644 index 000000000000..0321dabc2254 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutEncryptionScopeWithInfrastructureEncryption.ts @@ -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. +/** + * This sample demonstrates how to Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * + * @summary Synchronously creates or updates an encryption scope under the specified storage account. If an encryption scope is already created and a subsequent request is issued with different properties, the encryption scope properties will be updated per the specified request. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json + */ +import { EncryptionScope, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountPutEncryptionScopeWithInfrastructureEncryption() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "resource-group-name"; + const accountName = "{storage-account-name}"; + const encryptionScopeName = "{encryption-scope-name}"; + const encryptionScope: EncryptionScope = { + requireInfrastructureEncryption: true + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.encryptionScopes.put( + resourceGroupName, + accountName, + encryptionScopeName, + encryptionScope + ); + console.log(result); +} + +storageAccountPutEncryptionScopeWithInfrastructureEncryption().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutPrivateEndpointConnection.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutPrivateEndpointConnection.ts new file mode 100644 index 000000000000..ad1a687c30e6 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountPutPrivateEndpointConnection.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. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection associated with the storage account. + * + * @summary Update the state of specified private endpoint connection associated with the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountPutPrivateEndpointConnection.json + */ +import { + PrivateEndpointConnection, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountPutPrivateEndpointConnection() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const properties: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.privateEndpointConnections.put( + resourceGroupName, + accountName, + privateEndpointConnectionName, + properties + ); + console.log(result); +} + +storageAccountPutPrivateEndpointConnection().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRegenerateKerbKey.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRegenerateKerbKey.ts new file mode 100644 index 000000000000..b6e765dcb34b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRegenerateKerbKey.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. +/** + * This sample demonstrates how to Regenerates one of the access keys or Kerberos keys for the specified storage account. + * + * @summary Regenerates one of the access keys or Kerberos keys for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKerbKey.json + */ +import { + StorageAccountRegenerateKeyParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountRegenerateKerbKey() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const regenerateKey: StorageAccountRegenerateKeyParameters = { + keyName: "kerb1" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.regenerateKey( + resourceGroupName, + accountName, + regenerateKey + ); + console.log(result); +} + +storageAccountRegenerateKerbKey().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRegenerateKey.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRegenerateKey.ts new file mode 100644 index 000000000000..b6de20f5c75f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRegenerateKey.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. +/** + * This sample demonstrates how to Regenerates one of the access keys or Kerberos keys for the specified storage account. + * + * @summary Regenerates one of the access keys or Kerberos keys for the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRegenerateKey.json + */ +import { + StorageAccountRegenerateKeyParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountRegenerateKey() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const regenerateKey: StorageAccountRegenerateKeyParameters = { + keyName: "key2" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.regenerateKey( + resourceGroupName, + accountName, + regenerateKey + ); + console.log(result); +} + +storageAccountRegenerateKey().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRevokeUserDelegationKeys.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRevokeUserDelegationKeys.ts new file mode 100644 index 000000000000..56ad306b3539 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountRevokeUserDelegationKeys.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Revoke user delegation keys. + * + * @summary Revoke user delegation keys. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountRevokeUserDelegationKeys.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountRevokeUserDelegationKeys() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4167"; + const accountName = "sto3539"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.revokeUserDelegationKeys( + resourceGroupName, + accountName + ); + console.log(result); +} + +storageAccountRevokeUserDelegationKeys().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetBlobInventoryPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetBlobInventoryPolicy.ts new file mode 100644 index 000000000000..8bd61920f6c5 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetBlobInventoryPolicy.ts @@ -0,0 +1,98 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the blob inventory policy to the specified storage account. + * + * @summary Sets the blob inventory policy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetBlobInventoryPolicy.json + */ +import { + BlobInventoryPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetBlobInventoryPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const blobInventoryPolicyName = "default"; + const properties: BlobInventoryPolicy = { + policy: { + type: "Inventory", + enabled: true, + rules: [ + { + name: "inventoryPolicyRule1", + definition: { + format: "Csv", + filters: { + blobTypes: ["blockBlob", "appendBlob", "pageBlob"], + includeBlobVersions: true, + includeSnapshots: true, + prefixMatch: ["inventoryprefix1", "inventoryprefix2"] + }, + objectType: "Blob", + schedule: "Daily", + schemaFields: [ + "Name", + "Creation-Time", + "Last-Modified", + "Content-Length", + "Content-MD5", + "BlobType", + "AccessTier", + "AccessTierChangeTime", + "Snapshot", + "VersionId", + "IsCurrentVersion", + "Metadata" + ] + }, + destination: "container1", + enabled: true + }, + { + name: "inventoryPolicyRule2", + definition: { + format: "Parquet", + objectType: "Container", + schedule: "Weekly", + schemaFields: [ + "Name", + "Last-Modified", + "Metadata", + "LeaseStatus", + "LeaseState", + "LeaseDuration", + "PublicAccess", + "HasImmutabilityPolicy", + "HasLegalHold" + ] + }, + destination: "container2", + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobInventoryPolicies.createOrUpdate( + resourceGroupName, + accountName, + blobInventoryPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetBlobInventoryPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicies.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicies.ts new file mode 100644 index 000000000000..64ed927e799b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicies.ts @@ -0,0 +1,83 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy.json + */ +import { ManagementPolicy, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetManagementPolicies() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties: ManagementPolicy = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 } + }, + snapshot: { delete: { daysAfterCreationGreaterThan: 30 } } + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer1"] + } + }, + enabled: true + }, + { + name: "olcmtest2", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 } + } + }, + filters: { + blobIndexMatch: [ + { name: "tag1", op: "==", value: "val1" }, + { name: "tag2", op: "==", value: "val2" } + ], + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer2"] + } + }, + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicies().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyForBlockAndAppendBlobs.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyForBlockAndAppendBlobs.ts new file mode 100644 index 000000000000..f0095c076a23 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyForBlockAndAppendBlobs.ts @@ -0,0 +1,58 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json + */ +import { ManagementPolicy, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetManagementPolicyForBlockAndAppendBlobs() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties: ManagementPolicy = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { delete: { daysAfterModificationGreaterThan: 90 } }, + snapshot: { delete: { daysAfterCreationGreaterThan: 90 } }, + version: { delete: { daysAfterCreationGreaterThan: 90 } } + }, + filters: { + blobTypes: ["blockBlob", "appendBlob"], + prefixMatch: ["olcmtestcontainer1"] + } + }, + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyForBlockAndAppendBlobs().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.ts new file mode 100644 index 000000000000..859973ffda59 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions.ts @@ -0,0 +1,64 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json + */ +import { ManagementPolicy, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties: ManagementPolicy = { + policy: { + rules: [ + { + name: "olcmtest", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterLastAccessTimeGreaterThan: 1000 }, + enableAutoTierToHotFromCool: true, + tierToArchive: { daysAfterLastAccessTimeGreaterThan: 90 }, + tierToCool: { daysAfterLastAccessTimeGreaterThan: 30 } + }, + snapshot: { delete: { daysAfterCreationGreaterThan: 30 } } + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer"] + } + }, + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyLastAccessTimeBasedBlobActions().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyWithSnapshotAndVersion.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyWithSnapshotAndVersion.ts new file mode 100644 index 000000000000..5d53480a7e10 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountSetManagementPolicyWithSnapshotAndVersion.ts @@ -0,0 +1,70 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the managementpolicy to the specified storage account. + * + * @summary Sets the managementpolicy to the specified storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json + */ +import { ManagementPolicy, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountSetManagementPolicyWithSnapshotAndVersion() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "sto9699"; + const managementPolicyName = "default"; + const properties: ManagementPolicy = { + policy: { + rules: [ + { + name: "olcmtest1", + type: "Lifecycle", + definition: { + actions: { + baseBlob: { + delete: { daysAfterModificationGreaterThan: 1000 }, + tierToArchive: { daysAfterModificationGreaterThan: 90 }, + tierToCool: { daysAfterModificationGreaterThan: 30 } + }, + snapshot: { + delete: { daysAfterCreationGreaterThan: 1000 }, + tierToArchive: { daysAfterCreationGreaterThan: 90 }, + tierToCool: { daysAfterCreationGreaterThan: 30 } + }, + version: { + delete: { daysAfterCreationGreaterThan: 1000 }, + tierToArchive: { daysAfterCreationGreaterThan: 90 }, + tierToCool: { daysAfterCreationGreaterThan: 30 } + } + }, + filters: { + blobTypes: ["blockBlob"], + prefixMatch: ["olcmtestcontainer1"] + } + }, + enabled: true + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.managementPolicies.createOrUpdate( + resourceGroupName, + accountName, + managementPolicyName, + properties + ); + console.log(result); +} + +storageAccountSetManagementPolicyWithSnapshotAndVersion().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdate.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdate.ts new file mode 100644 index 000000000000..c8ca85d6cd32 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdate.ts @@ -0,0 +1,69 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdate.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + defaultToOAuthAuthentication: false, + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + isLocalUserEnabled: true, + isSftpEnabled: true, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47" + } + ] + }, + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdate().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateAllowedCopyScopeToAad.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateAllowedCopyScopeToAad.ts new file mode 100644 index 000000000000..aede1a452048 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateAllowedCopyScopeToAad.ts @@ -0,0 +1,67 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateAllowedCopyScopeToAAD.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateAllowedCopyScopeToAad() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + allowedCopyScope: "AAD", + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47" + } + ] + }, + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateAllowedCopyScopeToAad().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateDisablePublicNetworkAccess.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateDisablePublicNetworkAccess.ts new file mode 100644 index 000000000000..fd1370df1322 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateDisablePublicNetworkAccess.ts @@ -0,0 +1,67 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateDisablePublicNetworkAccess.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateDisablePublicNetworkAccess() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + allowBlobPublicAccess: false, + allowSharedKeyAccess: true, + encryption: { + keySource: "Microsoft.Storage", + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + keyPolicy: { keyExpirationPeriodInDays: 20 }, + minimumTlsVersion: "TLS1_2", + networkRuleSet: { + defaultAction: "Allow", + resourceAccessRules: [ + { + resourceId: + "/subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace", + tenantId: "72f988bf-86f1-41af-91ab-2d7cd011db47" + } + ] + }, + publicNetworkAccess: "Disabled", + routingPreference: { + publishInternetEndpoints: true, + publishMicrosoftEndpoints: true, + routingChoice: "MicrosoftRouting" + }, + sasPolicy: { expirationAction: "Log", sasExpirationPeriod: "1.15:59:59" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateDisablePublicNetworkAccess().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateObjectReplicationPolicyOnDestination.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateObjectReplicationPolicyOnDestination.ts new file mode 100644 index 000000000000..501108735bb8 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateObjectReplicationPolicyOnDestination.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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json + */ +import { + ObjectReplicationPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateObjectReplicationPolicyOnDestination() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "dst112"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties: ObjectReplicationPolicy = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139" + }, + { destinationContainer: "dcont179", sourceContainer: "scont179" } + ], + sourceAccount: "src1122" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountUpdateObjectReplicationPolicyOnDestination().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateObjectReplicationPolicyOnSource.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateObjectReplicationPolicyOnSource.ts new file mode 100644 index 000000000000..d9afedc19bbe --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateObjectReplicationPolicyOnSource.ts @@ -0,0 +1,56 @@ +/* + * 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. +/** + * This sample demonstrates how to Create or update the object replication policy of the storage account. + * + * @summary Create or update the object replication policy of the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json + */ +import { + ObjectReplicationPolicy, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateObjectReplicationPolicyOnSource() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const accountName = "src1122"; + const objectReplicationPolicyId = "2a20bb73-5717-4635-985a-5d4cf777438f"; + const properties: ObjectReplicationPolicy = { + destinationAccount: "dst112", + rules: [ + { + destinationContainer: "dcont139", + filters: { prefixMatch: ["blobA", "blobB"] }, + ruleId: "d5d18a48-8801-4554-aeaa-74faf65f5ef9", + sourceContainer: "scont139" + }, + { + destinationContainer: "dcont179", + ruleId: "cfbb4bc2-8b60-429f-b05a-d1e0942b33b2", + sourceContainer: "scont179" + } + ], + sourceAccount: "src1122" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.objectReplicationPoliciesOperations.createOrUpdate( + resourceGroupName, + accountName, + objectReplicationPolicyId, + properties + ); + console.log(result); +} + +storageAccountUpdateObjectReplicationPolicyOnSource().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.ts new file mode 100644 index 000000000000..0ba1e638de15 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateUserAssignedEncryptionIdentityWithCmk.ts @@ -0,0 +1,65 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateUserAssignedEncryptionIdentityWithCmk() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9101"; + const accountName = "sto4445"; + const parameters: StorageAccountUpdateParameters = { + encryption: { + encryptionIdentity: { + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}" + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": {} + } + }, + kind: "Storage", + sku: { name: "Standard_LRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateUserAssignedEncryptionIdentityWithCmk().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.ts new file mode 100644 index 000000000000..9fc5a12de9b4 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.ts @@ -0,0 +1,67 @@ +/* + * 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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res131918"; + const accountName = "sto131918"; + const parameters: StorageAccountUpdateParameters = { + encryption: { + encryptionIdentity: { + encryptionFederatedIdentityClientId: + "3109d1c4-a5de-4d84-8832-feabb916a4b6", + encryptionUserAssignedIdentity: + "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}" + }, + keySource: "Microsoft.Keyvault", + keyVaultProperties: { + keyName: "wrappingKey", + keyVaultUri: "https://myvault8569.vault.azure.net", + keyVersion: "" + }, + services: { + blob: { enabled: true, keyType: "Account" }, + file: { enabled: true, keyType: "Account" } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/{subscriptionId}/resourceGroups/res9101/providers/MicrosoftManagedIdentity/userAssignedIdentities/{managedIdentityName}": {} + } + }, + kind: "Storage", + sku: { name: "Standard_LRS" } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateUserAssignedIdentityWithFederatedIdentityClientId().catch( + console.error +); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateWithImmutabilityPolicy.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateWithImmutabilityPolicy.ts new file mode 100644 index 000000000000..0c07e5103463 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/storageAccountUpdateWithImmutabilityPolicy.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. +/** + * This sample demonstrates how to The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * + * @summary The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountUpdateWithImmutabilityPolicy.json + */ +import { + StorageAccountUpdateParameters, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageAccountUpdateWithImmutabilityPolicy() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9407"; + const accountName = "sto8596"; + const parameters: StorageAccountUpdateParameters = { + immutableStorageWithVersioning: { + enabled: true, + immutabilityPolicy: { + allowProtectedAppendWrites: true, + immutabilityPeriodSinceCreationInDays: 15, + state: "Locked" + } + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.storageAccounts.update( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +storageAccountUpdateWithImmutabilityPolicy().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationDelete.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationDelete.ts new file mode 100644 index 000000000000..5629481a1982 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationDelete.ts @@ -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. +/** + * This sample demonstrates how to Deletes the table with the specified table name, under the specified account if it exists. + * + * @summary Deletes the table with the specified table name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationDelete.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.delete( + resourceGroupName, + accountName, + tableName + ); + console.log(result); +} + +tableOperationDelete().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationGet.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationGet.ts new file mode 100644 index 000000000000..659ede877889 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationGet.ts @@ -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. +/** + * This sample demonstrates how to Gets the table with the specified table name, under the specified account if it exists. + * + * @summary Gets the table with the specified table name, under the specified account if it exists. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.get( + resourceGroupName, + accountName, + tableName + ); + console.log(result); +} + +tableOperationGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationList.ts new file mode 100644 index 000000000000..0deb0cb9c435 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationList.ts @@ -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. +/** + * This sample demonstrates how to Gets a list of all the tables under the specified storage account + * + * @summary Gets a list of all the tables under the specified storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto328"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.tableOperations.list( + resourceGroupName, + accountName + )) { + resArray.push(item); + } + console.log(resArray); +} + +tableOperationList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationPatch.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationPatch.ts new file mode 100644 index 000000000000..7fcef4e91bd1 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationPatch.ts @@ -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. +/** + * This sample demonstrates how to Creates a new table with the specified table name, under the specified account. + * + * @summary Creates a new table with the specified table name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPatch.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationPatch() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.update( + resourceGroupName, + accountName, + tableName + ); + console.log(result); +} + +tableOperationPatch().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationPut.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationPut.ts new file mode 100644 index 000000000000..7ba3555c5934 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/tableOperationPut.ts @@ -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. +/** + * This sample demonstrates how to Creates a new table with the specified table name, under the specified account. + * + * @summary Creates a new table with the specified table name, under the specified account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableOperationPut.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableOperationPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const tableName = "table6185"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableOperations.create( + resourceGroupName, + accountName, + tableName + ); + console.log(result); +} + +tableOperationPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesGet.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesGet.ts new file mode 100644 index 000000000000..b5dd1517e1c7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesGet.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesGet.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableServicesGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.getServiceProperties( + resourceGroupName, + accountName + ); + console.log(result); +} + +tableServicesGet().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesList.ts new file mode 100644 index 000000000000..02dcabebebda --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesList.ts @@ -0,0 +1,33 @@ +/* + * 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. +/** + * This sample demonstrates how to List all table services for the storage account. + * + * @summary List all table services for the storage account. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesList.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableServicesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res9290"; + const accountName = "sto1590"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.list( + resourceGroupName, + accountName + ); + console.log(result); +} + +tableServicesList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesPut.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesPut.ts new file mode 100644 index 000000000000..3b64d590d779 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/tableServicesPut.ts @@ -0,0 +1,75 @@ +/* + * 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. +/** + * This sample demonstrates how to Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * + * @summary Sets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/TableServicesPut.json + */ +import { + TableServiceProperties, + StorageManagementClient +} from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function tableServicesPut() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res4410"; + const accountName = "sto8607"; + const parameters: TableServiceProperties = { + cors: { + corsRules: [ + { + allowedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + allowedMethods: ["GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT"], + allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"], + exposedHeaders: ["x-ms-meta-*"], + maxAgeInSeconds: 100 + }, + { + allowedHeaders: ["*"], + allowedMethods: ["GET"], + allowedOrigins: ["*"], + exposedHeaders: ["*"], + maxAgeInSeconds: 2 + }, + { + allowedHeaders: ["x-ms-meta-12345675754564*"], + allowedMethods: ["GET", "PUT"], + allowedOrigins: [ + "http://www.abc23.com", + "https://www.fabrikam.com/*" + ], + exposedHeaders: [ + "x-ms-meta-abc", + "x-ms-meta-data*", + "x-ms-meta-target*" + ], + maxAgeInSeconds: 2000 + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.tableServices.setServiceProperties( + resourceGroupName, + accountName, + parameters + ); + console.log(result); +} + +tableServicesPut().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/updateContainers.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/updateContainers.ts new file mode 100644 index 000000000000..e104e536d480 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/updateContainers.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. +/** + * This sample demonstrates how to Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * + * @summary Updates container properties as specified in request body. Properties not mentioned in the request will be unchanged. Update fails if the specified container doesn't already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/BlobContainersPatch.json + */ +import { BlobContainer, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateContainers() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const containerName = "container6185"; + const blobContainer: BlobContainer = { + metadata: { metadata: "true" }, + publicAccess: "Container" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.update( + resourceGroupName, + accountName, + containerName, + blobContainer + ); + console.log(result); +} + +updateContainers().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/updateLocalUser.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/updateLocalUser.ts new file mode 100644 index 000000000000..691f42d1eac8 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/updateLocalUser.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. +/** + * This sample demonstrates how to Create or update the properties of a local user associated with the storage account + * + * @summary Create or update the properties of a local user associated with the storage account + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/LocalUserUpdate.json + */ +import { LocalUser, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateLocalUser() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const accountName = "sto2527"; + const username = "user1"; + const properties: LocalUser = { + hasSharedKey: false, + hasSshKey: false, + hasSshPassword: false, + homeDirectory: "homedirectory2" + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.localUsersOperations.createOrUpdate( + resourceGroupName, + accountName, + username, + properties + ); + console.log(result); +} + +updateLocalUser().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/updateShareAcls.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/updateShareAcls.ts new file mode 100644 index 000000000000..a227af5cd77b --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/updateShareAcls.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. +/** + * This sample demonstrates how to Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * + * @summary Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileShareAclsPatch.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateShareAcls() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare: FileShare = { + signedIdentifiers: [ + { + accessPolicy: { + expiryTime: new Date("2021-05-01T08:49:37.0000000Z"), + permission: "rwd", + startTime: new Date("2021-04-01T08:49:37.0000000Z") + }, + id: "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTI" + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.update( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +updateShareAcls().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/updateShares.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/updateShares.ts new file mode 100644 index 000000000000..0dff5cefc37f --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/updateShares.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. +/** + * This sample demonstrates how to Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * + * @summary Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/FileSharesPatch.json + */ +import { FileShare, StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function updateShares() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res3376"; + const accountName = "sto328"; + const shareName = "share6185"; + const fileShare: FileShare = { metadata: { type: "image" } }; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.fileShares.update( + resourceGroupName, + accountName, + shareName, + fileShare + ); + console.log(result); +} + +updateShares().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/usageList.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/usageList.ts new file mode 100644 index 000000000000..d66e806f3fbf --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/usageList.ts @@ -0,0 +1,32 @@ +/* + * 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. +/** + * This sample demonstrates how to Gets the current usage count and the limit for the resources of the location under the subscription. + * + * @summary Gets the current usage count and the limit for the resources of the location under the subscription. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/StorageAccountListLocationUsage.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function usageList() { + const subscriptionId = "{subscription-id}"; + const location = "eastus2(stage)"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.listByLocation(location)) { + resArray.push(item); + } + console.log(resArray); +} + +usageList().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/src/versionLevelWormContainerMigration.ts b/sdk/storage/arm-storage/samples/v17/typescript/src/versionLevelWormContainerMigration.ts new file mode 100644 index 000000000000..6835e37833f7 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/src/versionLevelWormContainerMigration.ts @@ -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. +/** + * This sample demonstrates how to This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. + * + * @summary This operation migrates a blob container from container level WORM to object level immutability enabled container. Prerequisites require a container level immutability policy either in locked or unlocked state, Account level versioning must be enabled and there should be no Legal hold on the container. + * x-ms-original-file: specification/storage/resource-manager/Microsoft.Storage/stable/2021-08-01/examples/ObjectLevelWormContainerMigration.json + */ +import { StorageManagementClient } from "@azure/arm-storage"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function versionLevelWormContainerMigration() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res1782"; + const accountName = "sto7069"; + const containerName = "container6397"; + const credential = new DefaultAzureCredential(); + const client = new StorageManagementClient(credential, subscriptionId); + const result = await client.blobContainers.beginObjectLevelWormAndWait( + resourceGroupName, + accountName, + containerName + ); + console.log(result); +} + +versionLevelWormContainerMigration().catch(console.error); diff --git a/sdk/storage/arm-storage/samples/v17/typescript/tsconfig.json b/sdk/storage/arm-storage/samples/v17/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/storage/arm-storage/samples/v17/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "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/storage/arm-storage/src/models/index.ts b/sdk/storage/arm-storage/src/models/index.ts index dc8519669b5e..496a28da070d 100644 --- a/sdk/storage/arm-storage/src/models/index.ts +++ b/sdk/storage/arm-storage/src/models/index.ts @@ -187,6 +187,8 @@ export interface StorageAccountCreateParameters { tags?: { [propertyName: string]: string }; /** The identity of the resource. */ identity?: Identity; + /** Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. */ + allowedCopyScope?: AllowedCopyScope; /** Allow or disallow public network access to Storage Account. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. */ publicNetworkAccess?: PublicNetworkAccess; /** SasPolicy assigned to the storage account. */ @@ -195,7 +197,7 @@ export interface StorageAccountCreateParameters { keyPolicy?: KeyPolicy; /** User domain assigned to the storage account. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. */ customDomain?: CustomDomain; - /** Not applicable. Azure Storage encryption is enabled for all storage accounts and cannot be disabled. */ + /** Encryption settings to be used for server-side encryption for the storage account. */ encryption?: Encryption; /** Network rule set */ networkRuleSet?: NetworkRuleSet; @@ -205,6 +207,10 @@ export interface StorageAccountCreateParameters { azureFilesIdentityBasedAuthentication?: AzureFilesIdentityBasedAuthentication; /** Allows https traffic only to storage service if sets to true. The default value is true since API version 2019-04-01. */ enableHttpsTrafficOnly?: boolean; + /** Enables Secure File Transfer Protocol, if set to true */ + isSftpEnabled?: boolean; + /** Enables local users feature, if set to true */ + isLocalUserEnabled?: boolean; /** Account HierarchicalNamespace enabled if sets to true. */ isHnsEnabled?: boolean; /** Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. */ @@ -328,10 +334,10 @@ export interface EncryptionServices { /** A service that allows server-side encryption to be used. */ export interface EncryptionService { - /** A boolean indicating whether or not the service encrypts the data as it is stored. */ + /** A boolean indicating whether or not the service encrypts the data as it is stored. Encryption at rest is enabled by default today and cannot be disabled. */ enabled?: boolean; /** - * Gets a rough estimate of the date/time when the encryption was last enabled by the user. Only returned when encryption is enabled. There might be some unencrypted blobs which were written after this time, as it is just a rough estimate. + * Gets a rough estimate of the date/time when the encryption was last enabled by the user. Data is encrypted at rest by default today and cannot be disabled. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly lastEnabledTime?: Date; @@ -363,6 +369,8 @@ export interface KeyVaultProperties { export interface EncryptionIdentity { /** Resource identifier of the UserAssigned identity to be associated with server-side encryption on the storage account. */ encryptionUserAssignedIdentity?: string; + /** ClientId of the multi-tenant application to be used in conjunction with the user-assigned identity for cross-tenant customer-managed-keys server-side encryption on the storage account. */ + encryptionFederatedIdentityClientId?: string; } /** Network rule set */ @@ -429,6 +437,10 @@ export interface ActiveDirectoryProperties { domainSid: string; /** Specifies the security identifier (SID) for Azure Storage. */ azureStorageSid: string; + /** Specifies the Active Directory SAMAccountName for Azure Storage. */ + samAccountName?: string; + /** Specifies the Active Directory account type for Azure Storage. */ + accountType?: ActiveDirectoryPropertiesAccountType; } /** Routing preference defines the type of network, either microsoft or internet routing to be used to deliver the user data, the default option is microsoft routing */ @@ -670,7 +682,7 @@ export interface StorageAccountUpdateParameters { kind?: Kind; /** Custom domain assigned to the storage account by the user. Name is the CNAME source. Only one custom domain is supported per storage account at this time. To clear the existing custom domain, use an empty string for the custom domain name property. */ customDomain?: CustomDomain; - /** Provides the encryption settings on the account. The default setting is unencrypted. */ + /** Not applicable. Azure Storage encryption at rest is enabled by default for all storage accounts and cannot be disabled. */ encryption?: Encryption; /** SasPolicy assigned to the storage account. */ sasPolicy?: SasPolicy; @@ -682,6 +694,10 @@ export interface StorageAccountUpdateParameters { azureFilesIdentityBasedAuthentication?: AzureFilesIdentityBasedAuthentication; /** Allows https traffic only to storage service if sets to true. */ enableHttpsTrafficOnly?: boolean; + /** Enables Secure File Transfer Protocol, if set to true */ + isSftpEnabled?: boolean; + /** Enables local users feature, if set to true */ + isLocalUserEnabled?: boolean; /** Network rule set */ networkRuleSet?: NetworkRuleSet; /** Allow large file shares if sets to Enabled. It cannot be disabled once it is enabled. */ @@ -702,6 +718,8 @@ export interface StorageAccountUpdateParameters { publicNetworkAccess?: PublicNetworkAccess; /** The property is immutable and can only be set to true at the account creation time. When set to true, it enables object level immutability for all the containers in the account by default. */ immutableStorageWithVersioning?: ImmutableStorageAccount; + /** Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. */ + allowedCopyScope?: AllowedCopyScope; } /** The response from the List Deleted Accounts operation. */ @@ -1120,6 +1138,48 @@ export interface ObjectReplicationPolicyFilter { minCreationTime?: string; } +/** List storage account local users. */ +export interface LocalUsers { + /** The local users associated with the storage account. */ + value?: LocalUser[]; +} + +export interface PermissionScope { + /** The permissions for the local user. Possible values include: Read (r), Write (w), Delete (d), List (l), and Create (c). */ + permissions: string; + /** The service used by the local user, e.g. blob, file. */ + service: string; + /** The name of resource, normally the container name or the file share name, used by the local user. */ + resourceName: string; +} + +export interface SshPublicKey { + /** Optional. It is used to store the function/usage of the key */ + description?: string; + /** Ssh public key base64 encoded. The format should be: ' ', e.g. ssh-rsa AAAABBBB */ + key?: string; +} + +/** The Storage Account Local User keys. */ +export interface LocalUserKeys { + /** Optional, local user ssh authorized keys for SFTP. */ + sshAuthorizedKeys?: SshPublicKey[]; + /** + * Auto generated by the server for SMB authentication. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sharedKey?: string; +} + +/** The secrets of Storage Account Local User. */ +export interface LocalUserRegeneratePasswordResult { + /** + * Auto generated password by the server for SSH authentication if hasSshPassword is set to true on the creation of local user. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sshPassword?: string; +} + /** The key vault properties for the encryption scope. This is a required field if encryption scope 'source' attribute is set to 'Microsoft.KeyVault'. */ export interface EncryptionScopeKeyVaultProperties { /** The object identifier for a key vault key object. When applied, the encryption scope will use the key referenced by the identifier to enable customer-managed key support on this encryption scope. */ @@ -1457,24 +1517,6 @@ export interface Multichannel { enabled?: boolean; } -/** An error response from the Storage service. */ -export interface CloudErrorAutoGenerated { - /** An error response from the Storage service. */ - error?: CloudErrorBodyAutoGenerated; -} - -/** An error response from the Storage service. */ -export interface CloudErrorBodyAutoGenerated { - /** An identifier for the error. Codes are invariant and are intended to be consumed programmatically. */ - code?: string; - /** A message describing the error, intended to be suitable for display in a user interface. */ - message?: string; - /** The target of the particular error. For example, the name of the property in error. */ - target?: string; - /** A list of additional details about the error. */ - details?: CloudErrorBodyAutoGenerated[]; -} - /** Response schema. Contains list of shares returned, and if paging is requested or required, a URL to next page of shares. */ export interface FileShareItems { /** @@ -1666,6 +1708,32 @@ export type ObjectReplicationPolicy = Resource & { rules?: ObjectReplicationPolicyRule[]; }; +/** The local user associated with the storage accounts. */ +export type LocalUser = Resource & { + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** The permission scopes of the local user. */ + permissionScopes?: PermissionScope[]; + /** Optional, local user home directory. */ + homeDirectory?: string; + /** Optional, local user ssh authorized keys for SFTP. */ + sshAuthorizedKeys?: SshPublicKey[]; + /** + * A unique Security Identifier that is generated by the server. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sid?: string; + /** Indicates whether shared key exists. Set it to false to remove existing shared key. */ + hasSharedKey?: boolean; + /** Indicates whether ssh key exists. Set it to false to remove existing SSH key. */ + hasSshKey?: boolean; + /** Indicates whether ssh password exists. Set it to false to remove existing SSH password. */ + hasSshPassword?: boolean; +}; + /** The Encryption Scope resource. */ export type EncryptionScope = Resource & { /** The provider for the encryption scope. Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault. */ @@ -1857,7 +1925,7 @@ export type StorageAccount = TrackedResource & { */ readonly secondaryEndpoints?: Endpoints; /** - * Gets the encryption settings on the account. If unspecified, the account is unencrypted. + * Encryption settings to be used for server-side encryption for the storage account. * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly encryption?: Encryption; @@ -1875,6 +1943,10 @@ export type StorageAccount = TrackedResource & { * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly networkRuleSet?: NetworkRuleSet; + /** Enables Secure File Transfer Protocol, if set to true */ + isSftpEnabled?: boolean; + /** Enables local users feature, if set to true */ + isLocalUserEnabled?: boolean; /** Account HierarchicalNamespace enabled if sets to true. */ isHnsEnabled?: boolean; /** @@ -1917,6 +1989,8 @@ export type StorageAccount = TrackedResource & { publicNetworkAccess?: PublicNetworkAccess; /** The property is immutable and can only be set to true at the account creation time. When set to true, it enables object level immutability for all the containers in the account by default. */ immutableStorageWithVersioning?: ImmutableStorageAccount; + /** Restrict copy to and from Storage Accounts within an AAD tenant or with Private Links to the same VNet. */ + allowedCopyScope?: AllowedCopyScope; }; /** Deleted storage account */ @@ -2407,6 +2481,22 @@ export enum KnownIdentityType { */ export type IdentityType = string; +/** Known values of {@link AllowedCopyScope} that the service accepts. */ +export enum KnownAllowedCopyScope { + PrivateLink = "PrivateLink", + AAD = "AAD" +} + +/** + * Defines values for AllowedCopyScope. \ + * {@link KnownAllowedCopyScope} can be used interchangeably with AllowedCopyScope, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **PrivateLink** \ + * **AAD** + */ +export type AllowedCopyScope = string; + /** Known values of {@link PublicNetworkAccess} that the service accepts. */ export enum KnownPublicNetworkAccess { Enabled = "Enabled", @@ -2529,6 +2619,22 @@ export enum KnownDirectoryServiceOptions { */ export type DirectoryServiceOptions = string; +/** Known values of {@link ActiveDirectoryPropertiesAccountType} that the service accepts. */ +export enum KnownActiveDirectoryPropertiesAccountType { + User = "User", + Computer = "Computer" +} + +/** + * Defines values for ActiveDirectoryPropertiesAccountType. \ + * {@link KnownActiveDirectoryPropertiesAccountType} can be used interchangeably with ActiveDirectoryPropertiesAccountType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Computer** + */ +export type ActiveDirectoryPropertiesAccountType = string; + /** Known values of {@link DefaultSharePermission} that the service accepts. */ export enum KnownDefaultSharePermission { None = "None", @@ -3497,6 +3603,45 @@ export type ObjectReplicationPoliciesCreateOrUpdateResponse = ObjectReplicationP export interface ObjectReplicationPoliciesDeleteOptionalParams extends coreClient.OperationOptions {} +/** Optional parameters. */ +export interface LocalUsersListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type LocalUsersListResponse = LocalUsers; + +/** Optional parameters. */ +export interface LocalUsersGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type LocalUsersGetResponse = LocalUser; + +/** Optional parameters. */ +export interface LocalUsersCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type LocalUsersCreateOrUpdateResponse = LocalUser; + +/** Optional parameters. */ +export interface LocalUsersDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface LocalUsersListKeysOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listKeys operation. */ +export type LocalUsersListKeysResponse = LocalUserKeys; + +/** Optional parameters. */ +export interface LocalUsersRegeneratePasswordOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the regeneratePassword operation. */ +export type LocalUsersRegeneratePasswordResponse = LocalUserRegeneratePasswordResult; + /** Optional parameters. */ export interface EncryptionScopesPutOptionalParams extends coreClient.OperationOptions {} diff --git a/sdk/storage/arm-storage/src/models/mappers.ts b/sdk/storage/arm-storage/src/models/mappers.ts index 42ca740f6505..85d1598cb67d 100644 --- a/sdk/storage/arm-storage/src/models/mappers.ts +++ b/sdk/storage/arm-storage/src/models/mappers.ts @@ -464,6 +464,12 @@ export const StorageAccountCreateParameters: coreClient.CompositeMapper = { className: "Identity" } }, + allowedCopyScope: { + serializedName: "properties.allowedCopyScope", + type: { + name: "String" + } + }, publicNetworkAccess: { serializedName: "properties.publicNetworkAccess", type: { @@ -525,6 +531,18 @@ export const StorageAccountCreateParameters: coreClient.CompositeMapper = { name: "Boolean" } }, + isSftpEnabled: { + serializedName: "properties.isSftpEnabled", + type: { + name: "Boolean" + } + }, + isLocalUserEnabled: { + serializedName: "properties.isLocalUserEnabled", + type: { + name: "Boolean" + } + }, isHnsEnabled: { serializedName: "properties.isHnsEnabled", type: { @@ -920,6 +938,12 @@ export const EncryptionIdentity: coreClient.CompositeMapper = { type: { name: "String" } + }, + encryptionFederatedIdentityClientId: { + serializedName: "federatedIdentityClientId", + type: { + name: "String" + } } } } @@ -1136,6 +1160,18 @@ export const ActiveDirectoryProperties: coreClient.CompositeMapper = { type: { name: "String" } + }, + samAccountName: { + serializedName: "samAccountName", + type: { + name: "String" + } + }, + accountType: { + serializedName: "accountType", + type: { + name: "String" + } } } } @@ -1667,6 +1703,18 @@ export const StorageAccountUpdateParameters: coreClient.CompositeMapper = { name: "Boolean" } }, + isSftpEnabled: { + serializedName: "properties.isSftpEnabled", + type: { + name: "Boolean" + } + }, + isLocalUserEnabled: { + serializedName: "properties.isLocalUserEnabled", + type: { + name: "Boolean" + } + }, networkRuleSet: { serializedName: "properties.networkAcls", type: { @@ -1729,6 +1777,12 @@ export const StorageAccountUpdateParameters: coreClient.CompositeMapper = { name: "Composite", className: "ImmutableStorageAccount" } + }, + allowedCopyScope: { + serializedName: "properties.allowedCopyScope", + type: { + name: "String" + } } } } @@ -2904,6 +2958,122 @@ export const ObjectReplicationPolicyFilter: coreClient.CompositeMapper = { } }; +export const LocalUsers: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LocalUsers", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LocalUser" + } + } + } + } + } + } +}; + +export const PermissionScope: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PermissionScope", + modelProperties: { + permissions: { + serializedName: "permissions", + required: true, + type: { + name: "String" + } + }, + service: { + serializedName: "service", + required: true, + type: { + name: "String" + } + }, + resourceName: { + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const SshPublicKey: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SshPublicKey", + modelProperties: { + description: { + serializedName: "description", + type: { + name: "String" + } + }, + key: { + serializedName: "key", + type: { + name: "String" + } + } + } + } +}; + +export const LocalUserKeys: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LocalUserKeys", + modelProperties: { + sshAuthorizedKeys: { + serializedName: "sshAuthorizedKeys", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SshPublicKey" + } + } + } + }, + sharedKey: { + serializedName: "sharedKey", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const LocalUserRegeneratePasswordResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LocalUserRegeneratePasswordResult", + modelProperties: { + sshPassword: { + serializedName: "sshPassword", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + export const EncryptionScopeKeyVaultProperties: coreClient.CompositeMapper = { type: { name: "Composite", @@ -3721,61 +3891,6 @@ export const Multichannel: coreClient.CompositeMapper = { } }; -export const CloudErrorAutoGenerated: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CloudErrorAutoGenerated", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "CloudErrorBodyAutoGenerated" - } - } - } - } -}; - -export const CloudErrorBodyAutoGenerated: coreClient.CompositeMapper = { - type: { - name: "Composite", - className: "CloudErrorBodyAutoGenerated", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - }, - target: { - serializedName: "target", - type: { - name: "String" - } - }, - details: { - serializedName: "details", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CloudErrorBodyAutoGenerated" - } - } - } - } - } - } -}; - export const FileShareItems: coreClient.CompositeMapper = { type: { name: "Composite", @@ -4248,6 +4363,78 @@ export const ObjectReplicationPolicy: coreClient.CompositeMapper = { } }; +export const LocalUser: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LocalUser", + modelProperties: { + ...Resource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + permissionScopes: { + serializedName: "properties.permissionScopes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PermissionScope" + } + } + } + }, + homeDirectory: { + serializedName: "properties.homeDirectory", + type: { + name: "String" + } + }, + sshAuthorizedKeys: { + serializedName: "properties.sshAuthorizedKeys", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SshPublicKey" + } + } + } + }, + sid: { + serializedName: "properties.sid", + readOnly: true, + type: { + name: "String" + } + }, + hasSharedKey: { + serializedName: "properties.hasSharedKey", + type: { + name: "Boolean" + } + }, + hasSshKey: { + serializedName: "properties.hasSshKey", + type: { + name: "Boolean" + } + }, + hasSshPassword: { + serializedName: "properties.hasSshPassword", + type: { + name: "Boolean" + } + } + } + } +}; + export const EncryptionScope: coreClient.CompositeMapper = { type: { name: "Composite", @@ -4684,6 +4871,18 @@ export const StorageAccount: coreClient.CompositeMapper = { className: "NetworkRuleSet" } }, + isSftpEnabled: { + serializedName: "properties.isSftpEnabled", + type: { + name: "Boolean" + } + }, + isLocalUserEnabled: { + serializedName: "properties.isLocalUserEnabled", + type: { + name: "Boolean" + } + }, isHnsEnabled: { serializedName: "properties.isHnsEnabled", type: { @@ -4785,6 +4984,12 @@ export const StorageAccount: coreClient.CompositeMapper = { name: "Composite", className: "ImmutableStorageAccount" } + }, + allowedCopyScope: { + serializedName: "properties.allowedCopyScope", + type: { + name: "String" + } } } } diff --git a/sdk/storage/arm-storage/src/models/parameters.ts b/sdk/storage/arm-storage/src/models/parameters.ts index a2a6522fb7fd..24d14a565cad 100644 --- a/sdk/storage/arm-storage/src/models/parameters.ts +++ b/sdk/storage/arm-storage/src/models/parameters.ts @@ -23,6 +23,7 @@ import { BlobInventoryPolicy as BlobInventoryPolicyMapper, PrivateEndpointConnection as PrivateEndpointConnectionMapper, ObjectReplicationPolicy as ObjectReplicationPolicyMapper, + LocalUser as LocalUserMapper, EncryptionScope as EncryptionScopeMapper, BlobServiceProperties as BlobServicePropertiesMapper, BlobContainer as BlobContainerMapper, @@ -65,7 +66,7 @@ export const $host: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2021-06-01", + defaultValue: "2021-08-01", isConstant: true, serializedName: "api-version", type: { @@ -305,6 +306,26 @@ export const properties3: OperationParameter = { mapper: ObjectReplicationPolicyMapper }; +export const username: OperationURLParameter = { + parameterPath: "username", + mapper: { + constraints: { + MaxLength: 64, + MinLength: 3 + }, + serializedName: "username", + required: true, + type: { + name: "String" + } + } +}; + +export const properties4: OperationParameter = { + parameterPath: "properties", + mapper: LocalUserMapper +}; + export const encryptionScope: OperationParameter = { parameterPath: "encryptionScope", mapper: EncryptionScopeMapper diff --git a/sdk/storage/arm-storage/src/operations/fileServices.ts b/sdk/storage/arm-storage/src/operations/fileServices.ts index 39cc03a0af8e..433b6962190f 100644 --- a/sdk/storage/arm-storage/src/operations/fileServices.ts +++ b/sdk/storage/arm-storage/src/operations/fileServices.ts @@ -110,7 +110,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.FileServiceItems }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -132,7 +132,7 @@ const setServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.FileServiceProperties }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.parameters8, @@ -157,7 +157,7 @@ const getServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.FileServiceProperties }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], diff --git a/sdk/storage/arm-storage/src/operations/fileShares.ts b/sdk/storage/arm-storage/src/operations/fileShares.ts index 9e82ad3e5298..e8623c585d23 100644 --- a/sdk/storage/arm-storage/src/operations/fileShares.ts +++ b/sdk/storage/arm-storage/src/operations/fileShares.ts @@ -315,7 +315,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.FileShareItems }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [ @@ -345,7 +345,7 @@ const createOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.FileShare }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.fileShare, @@ -370,7 +370,7 @@ const updateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.FileShare }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.fileShare, @@ -395,7 +395,7 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.FileShare }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion, Parameters.expand2], @@ -417,7 +417,7 @@ const deleteOperationSpec: coreClient.OperationSpec = { 200: {}, 204: {}, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion, Parameters.include1], @@ -438,7 +438,7 @@ const restoreOperationSpec: coreClient.OperationSpec = { responses: { 200: {}, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.deletedShare, @@ -464,7 +464,7 @@ const leaseOperationSpec: coreClient.OperationSpec = { headersMapper: Mappers.FileSharesLeaseHeaders }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.parameters9, @@ -492,7 +492,7 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.FileShareItems }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [ diff --git a/sdk/storage/arm-storage/src/operations/index.ts b/sdk/storage/arm-storage/src/operations/index.ts index 49920f67864c..57ae999393b5 100644 --- a/sdk/storage/arm-storage/src/operations/index.ts +++ b/sdk/storage/arm-storage/src/operations/index.ts @@ -16,6 +16,7 @@ export * from "./blobInventoryPolicies"; export * from "./privateEndpointConnections"; export * from "./privateLinkResources"; export * from "./objectReplicationPoliciesOperations"; +export * from "./localUsersOperations"; export * from "./encryptionScopes"; export * from "./blobServices"; export * from "./blobContainers"; diff --git a/sdk/storage/arm-storage/src/operations/localUsersOperations.ts b/sdk/storage/arm-storage/src/operations/localUsersOperations.ts new file mode 100644 index 000000000000..a0463780acb0 --- /dev/null +++ b/sdk/storage/arm-storage/src/operations/localUsersOperations.ts @@ -0,0 +1,371 @@ +/* + * 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 { LocalUsersOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageManagementClient } from "../storageManagementClient"; +import { + LocalUser, + LocalUsersListOptionalParams, + LocalUsersListResponse, + LocalUsersGetOptionalParams, + LocalUsersGetResponse, + LocalUsersCreateOrUpdateOptionalParams, + LocalUsersCreateOrUpdateResponse, + LocalUsersDeleteOptionalParams, + LocalUsersListKeysOptionalParams, + LocalUsersListKeysResponse, + LocalUsersRegeneratePasswordOptionalParams, + LocalUsersRegeneratePasswordResponse +} from "../models"; + +/// +/** Class containing LocalUsersOperations operations. */ +export class LocalUsersOperationsImpl implements LocalUsersOperations { + private readonly client: StorageManagementClient; + + /** + * Initialize a new instance of the class LocalUsersOperations class. + * @param client Reference to the service client + */ + constructor(client: StorageManagementClient) { + this.client = client; + } + + /** + * List the local users associated with the storage account. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + accountName: string, + options?: LocalUsersListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, accountName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, accountName, options); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + accountName: string, + options?: LocalUsersListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, accountName, options); + yield result.value || []; + } + + private async *listPagingAll( + resourceGroupName: string, + accountName: string, + options?: LocalUsersListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + accountName, + options + )) { + yield* page; + } + } + + /** + * List the local users associated with the storage account. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + accountName: string, + options?: LocalUsersListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options }, + listOperationSpec + ); + } + + /** + * Get the local user of the storage account by username. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + accountName: string, + username: string, + options?: LocalUsersGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, username, options }, + getOperationSpec + ); + } + + /** + * Create or update the properties of a local user associated with the storage account + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param properties The local user associated with a storage account. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + accountName: string, + username: string, + properties: LocalUser, + options?: LocalUsersCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, username, properties, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Deletes the local user associated with the specified storage account. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + accountName: string, + username: string, + options?: LocalUsersDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, username, options }, + deleteOperationSpec + ); + } + + /** + * List SSH authorized keys and shared key of the local user. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param options The options parameters. + */ + listKeys( + resourceGroupName: string, + accountName: string, + username: string, + options?: LocalUsersListKeysOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, username, options }, + listKeysOperationSpec + ); + } + + /** + * Regenerate the local user SSH password. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param options The options parameters. + */ + regeneratePassword( + resourceGroupName: string, + accountName: string, + username: string, + options?: LocalUsersRegeneratePasswordOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, username, options }, + regeneratePasswordOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LocalUsers + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName1 + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LocalUser + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName1, + Parameters.username + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.LocalUser + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.properties4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName1, + Parameters.username + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName1, + Parameters.username + ], + headerParameters: [Parameters.accept], + serializer +}; +const listKeysOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/listKeys", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.LocalUserKeys + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName1, + Parameters.username + ], + headerParameters: [Parameters.accept], + serializer +}; +const regeneratePasswordOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/localUsers/{username}/regeneratePassword", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.LocalUserRegeneratePasswordResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName1, + Parameters.username + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storage/arm-storage/src/operations/queue.ts b/sdk/storage/arm-storage/src/operations/queue.ts index ece30cd378a5..2996dabcd38f 100644 --- a/sdk/storage/arm-storage/src/operations/queue.ts +++ b/sdk/storage/arm-storage/src/operations/queue.ts @@ -257,7 +257,7 @@ const createOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.StorageQueue }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.queue, @@ -282,7 +282,7 @@ const updateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.StorageQueue }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.queue, @@ -307,7 +307,7 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.StorageQueue }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -328,7 +328,7 @@ const deleteOperationSpec: coreClient.OperationSpec = { responses: { 204: {}, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -351,7 +351,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ListQueueResource }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [ @@ -376,7 +376,7 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ListQueueResource }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [ diff --git a/sdk/storage/arm-storage/src/operations/queueServices.ts b/sdk/storage/arm-storage/src/operations/queueServices.ts index af477f1915b9..21fad00fbc79 100644 --- a/sdk/storage/arm-storage/src/operations/queueServices.ts +++ b/sdk/storage/arm-storage/src/operations/queueServices.ts @@ -110,7 +110,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ListQueueServices }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -132,7 +132,7 @@ const setServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.QueueServiceProperties }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.parameters10, @@ -157,7 +157,7 @@ const getServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.QueueServiceProperties }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], diff --git a/sdk/storage/arm-storage/src/operations/tableOperations.ts b/sdk/storage/arm-storage/src/operations/tableOperations.ts index 66edc7a88233..5dbe7e45f3fa 100644 --- a/sdk/storage/arm-storage/src/operations/tableOperations.ts +++ b/sdk/storage/arm-storage/src/operations/tableOperations.ts @@ -252,7 +252,7 @@ const createOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.Table }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -275,7 +275,7 @@ const updateOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.Table }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -298,7 +298,7 @@ const getOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.Table }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -319,7 +319,7 @@ const deleteOperationSpec: coreClient.OperationSpec = { responses: { 204: {}, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -342,7 +342,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ListTableResource }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -363,7 +363,7 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ListTableResource }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], diff --git a/sdk/storage/arm-storage/src/operations/tableServices.ts b/sdk/storage/arm-storage/src/operations/tableServices.ts index 9173e68de7ad..3e78fb7ff246 100644 --- a/sdk/storage/arm-storage/src/operations/tableServices.ts +++ b/sdk/storage/arm-storage/src/operations/tableServices.ts @@ -110,7 +110,7 @@ const listOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.ListTableServices }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], @@ -132,7 +132,7 @@ const setServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.TableServiceProperties }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, requestBody: Parameters.parameters11, @@ -157,7 +157,7 @@ const getServicePropertiesOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.TableServiceProperties }, default: { - bodyMapper: Mappers.CloudErrorAutoGenerated + bodyMapper: Mappers.CloudError } }, queryParameters: [Parameters.apiVersion], diff --git a/sdk/storage/arm-storage/src/operationsInterfaces/index.ts b/sdk/storage/arm-storage/src/operationsInterfaces/index.ts index 49920f67864c..57ae999393b5 100644 --- a/sdk/storage/arm-storage/src/operationsInterfaces/index.ts +++ b/sdk/storage/arm-storage/src/operationsInterfaces/index.ts @@ -16,6 +16,7 @@ export * from "./blobInventoryPolicies"; export * from "./privateEndpointConnections"; export * from "./privateLinkResources"; export * from "./objectReplicationPoliciesOperations"; +export * from "./localUsersOperations"; export * from "./encryptionScopes"; export * from "./blobServices"; export * from "./blobContainers"; diff --git a/sdk/storage/arm-storage/src/operationsInterfaces/localUsersOperations.ts b/sdk/storage/arm-storage/src/operationsInterfaces/localUsersOperations.ts new file mode 100644 index 000000000000..3f09f0c0deb3 --- /dev/null +++ b/sdk/storage/arm-storage/src/operationsInterfaces/localUsersOperations.ts @@ -0,0 +1,128 @@ +/* + * 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 { + LocalUser, + LocalUsersListOptionalParams, + LocalUsersGetOptionalParams, + LocalUsersGetResponse, + LocalUsersCreateOrUpdateOptionalParams, + LocalUsersCreateOrUpdateResponse, + LocalUsersDeleteOptionalParams, + LocalUsersListKeysOptionalParams, + LocalUsersListKeysResponse, + LocalUsersRegeneratePasswordOptionalParams, + LocalUsersRegeneratePasswordResponse +} from "../models"; + +/// +/** Interface representing a LocalUsersOperations. */ +export interface LocalUsersOperations { + /** + * List the local users associated with the storage account. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + accountName: string, + options?: LocalUsersListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the local user of the storage account by username. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + accountName: string, + username: string, + options?: LocalUsersGetOptionalParams + ): Promise; + /** + * Create or update the properties of a local user associated with the storage account + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param properties The local user associated with a storage account. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + accountName: string, + username: string, + properties: LocalUser, + options?: LocalUsersCreateOrUpdateOptionalParams + ): Promise; + /** + * Deletes the local user associated with the specified storage account. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + accountName: string, + username: string, + options?: LocalUsersDeleteOptionalParams + ): Promise; + /** + * List SSH authorized keys and shared key of the local user. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param options The options parameters. + */ + listKeys( + resourceGroupName: string, + accountName: string, + username: string, + options?: LocalUsersListKeysOptionalParams + ): Promise; + /** + * Regenerate the local user SSH password. + * @param resourceGroupName The name of the resource group within the user's subscription. The name is + * case insensitive. + * @param accountName The name of the storage account within the specified resource group. Storage + * account names must be between 3 and 24 characters in length and use numbers and lower-case letters + * only. + * @param username The name of local user. The username must contain lowercase letters and numbers + * only. It must be unique only within the storage account. + * @param options The options parameters. + */ + regeneratePassword( + resourceGroupName: string, + accountName: string, + username: string, + options?: LocalUsersRegeneratePasswordOptionalParams + ): Promise; +} diff --git a/sdk/storage/arm-storage/src/storageManagementClient.ts b/sdk/storage/arm-storage/src/storageManagementClient.ts index e90467746f6a..8634cc7a451e 100644 --- a/sdk/storage/arm-storage/src/storageManagementClient.ts +++ b/sdk/storage/arm-storage/src/storageManagementClient.ts @@ -19,6 +19,7 @@ import { PrivateEndpointConnectionsImpl, PrivateLinkResourcesImpl, ObjectReplicationPoliciesOperationsImpl, + LocalUsersOperationsImpl, EncryptionScopesImpl, BlobServicesImpl, BlobContainersImpl, @@ -40,6 +41,7 @@ import { PrivateEndpointConnections, PrivateLinkResources, ObjectReplicationPoliciesOperations, + LocalUsersOperations, EncryptionScopes, BlobServices, BlobContainers, @@ -84,7 +86,7 @@ export class StorageManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-storage/17.0.0`; + const packageDetails = `azsdk-js-arm-storage/17.1.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -107,7 +109,7 @@ export class StorageManagementClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2021-06-01"; + this.apiVersion = options.apiVersion || "2021-08-01"; this.operations = new OperationsImpl(this); this.skus = new SkusImpl(this); this.storageAccounts = new StorageAccountsImpl(this); @@ -120,6 +122,7 @@ export class StorageManagementClient extends coreClient.ServiceClient { this.objectReplicationPoliciesOperations = new ObjectReplicationPoliciesOperationsImpl( this ); + this.localUsersOperations = new LocalUsersOperationsImpl(this); this.encryptionScopes = new EncryptionScopesImpl(this); this.blobServices = new BlobServicesImpl(this); this.blobContainers = new BlobContainersImpl(this); @@ -141,6 +144,7 @@ export class StorageManagementClient extends coreClient.ServiceClient { privateEndpointConnections: PrivateEndpointConnections; privateLinkResources: PrivateLinkResources; objectReplicationPoliciesOperations: ObjectReplicationPoliciesOperations; + localUsersOperations: LocalUsersOperations; encryptionScopes: EncryptionScopes; blobServices: BlobServices; blobContainers: BlobContainers; diff --git a/sdk/storage/arm-storage/test/storage_examples.ts b/sdk/storage/arm-storage/test/storage_examples.ts index adadd5cf6842..94880b063942 100644 --- a/sdk/storage/arm-storage/test/storage_examples.ts +++ b/sdk/storage/arm-storage/test/storage_examples.ts @@ -14,8 +14,8 @@ import { delay, isPlaybackMode } from "@azure-tools/test-recorder"; -import { assert } from "chai"; import { ClientSecretCredential } from "@azure/identity"; +import * as assert from "assert"; import { StorageManagementClient } from "../src/storageManagementClient"; const recorderEnvSetup: RecorderEnvironmentSetup = { @@ -93,7 +93,7 @@ describe("Storage test", () => { key2: "value2", } }, testPollingOptions) - assert.equal(res.name, storageAccountName); + assert.equal(res.name,storageAccountName) }); it("blobContainers create test", async function () { diff --git a/sdk/storage/arm-storage/tsconfig.json b/sdk/storage/arm-storage/tsconfig.json index 6e3251194117..ce4dc5750e7e 100644 --- a/sdk/storage/arm-storage/tsconfig.json +++ b/sdk/storage/arm-storage/tsconfig.json @@ -9,11 +9,24 @@ "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true + "importHelpers": true, + "paths": { + "@azure/arm-storage": [ + "./src/index" + ] + } }, - "include": ["./src/**/*.ts", "./test/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file