From b8a33c627ce9b5fdc06e2ad45ff9056a7b8ad955 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 20 Sep 2023 21:47:04 +0000 Subject: [PATCH] CodeGen from PR 25847 in Azure/azure-rest-api-specs Rename Microsoft.StorageTasks to Microsoft.StorageActions (#25847) * Replace Microsoft.StorageTasks to Microsoft.StorageActions * Updating readme.md file and OperationsList Example --- common/config/rush/pnpm-lock.yaml | 96 +- rush.json | 9 +- .../arm-storageactions/CHANGELOG.md | 5 + sdk/storageactions/arm-storageactions/LICENSE | 21 + .../arm-storageactions/README.md | 109 ++ .../arm-storageactions/_meta.json | 8 + .../arm-storageactions/api-extractor.json | 31 + .../arm-storageactions/package.json | 116 ++ .../review/arm-storageactions.api.md | 516 ++++++++ .../arm-storageactions/rollup.config.js | 122 ++ .../arm-storageactions/sample.env | 4 + .../arm-storageactions/src/index.ts | 13 + .../arm-storageactions/src/lroImpl.ts | 42 + .../arm-storageactions/src/models/index.ts | 822 ++++++++++++ .../arm-storageactions/src/models/mappers.ts | 1104 +++++++++++++++++ .../src/models/parameters.ts | 166 +++ .../src/operations/index.ts | 12 + .../src/operations/operations.ts | 149 +++ .../storageTaskAssignmentOperations.ts | 205 +++ .../src/operations/storageTasks.ts | 801 ++++++++++++ .../src/operations/storageTasksReport.ts | 208 ++++ .../src/operationsInterfaces/index.ts | 12 + .../src/operationsInterfaces/operations.ts | 22 + .../storageTaskAssignmentOperations.ts | 31 + .../src/operationsInterfaces/storageTasks.ts | 180 +++ .../storageTasksReport.ts | 31 + .../arm-storageactions/src/pagingHelper.ts | 39 + .../src/storageActionsManagementClient.ts | 158 +++ .../arm-storageactions/test/sampleTest.ts | 43 + .../arm-storageactions/tsconfig.json | 27 + sdk/storageactions/ci.mgmt.yml | 38 + 31 files changed, 5107 insertions(+), 33 deletions(-) create mode 100644 sdk/storageactions/arm-storageactions/CHANGELOG.md create mode 100644 sdk/storageactions/arm-storageactions/LICENSE create mode 100644 sdk/storageactions/arm-storageactions/README.md create mode 100644 sdk/storageactions/arm-storageactions/_meta.json create mode 100644 sdk/storageactions/arm-storageactions/api-extractor.json create mode 100644 sdk/storageactions/arm-storageactions/package.json create mode 100644 sdk/storageactions/arm-storageactions/review/arm-storageactions.api.md create mode 100644 sdk/storageactions/arm-storageactions/rollup.config.js create mode 100644 sdk/storageactions/arm-storageactions/sample.env create mode 100644 sdk/storageactions/arm-storageactions/src/index.ts create mode 100644 sdk/storageactions/arm-storageactions/src/lroImpl.ts create mode 100644 sdk/storageactions/arm-storageactions/src/models/index.ts create mode 100644 sdk/storageactions/arm-storageactions/src/models/mappers.ts create mode 100644 sdk/storageactions/arm-storageactions/src/models/parameters.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operations/index.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operations/operations.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operations/storageTaskAssignmentOperations.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operations/storageTasks.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operations/storageTasksReport.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operationsInterfaces/index.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operationsInterfaces/operations.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTaskAssignmentOperations.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTasks.ts create mode 100644 sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTasksReport.ts create mode 100644 sdk/storageactions/arm-storageactions/src/pagingHelper.ts create mode 100644 sdk/storageactions/arm-storageactions/src/storageActionsManagementClient.ts create mode 100644 sdk/storageactions/arm-storageactions/test/sampleTest.ts create mode 100644 sdk/storageactions/arm-storageactions/tsconfig.json create mode 100644 sdk/storageactions/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c14a74d2962f..a4be576eb9e9 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -14,7 +14,7 @@ dependencies: '@rush-temp/ai-anomaly-detector': specifier: file:./projects/ai-anomaly-detector.tgz version: file:projects/ai-anomaly-detector.tgz - '@rush-temp/ai-content-safety': + '@rush-temp/ai-content-safety': specifier: file:./projects/ai-content-safety.tgz version: file:projects/ai-content-safety.tgz '@rush-temp/ai-document-translator': @@ -644,6 +644,9 @@ dependencies: '@rush-temp/arm-storage-profile-2020-09-01-hybrid': specifier: file:./projects/arm-storage-profile-2020-09-01-hybrid.tgz version: file:projects/arm-storage-profile-2020-09-01-hybrid.tgz + '@rush-temp/arm-storageactions': + specifier: file:./projects/arm-storageactions.tgz + version: file:projects/arm-storageactions.tgz '@rush-temp/arm-storagecache': specifier: file:./projects/arm-storagecache.tgz version: file:projects/arm-storagecache.tgz @@ -4480,7 +4483,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.3.0-dev.20230919 + typescript: 5.3.0-dev.20230920 dev: false /eastasianwidth@0.2.0: @@ -9200,8 +9203,8 @@ packages: hasBin: true dev: false - /typescript@5.3.0-dev.20230919: - resolution: {integrity: sha512-FU6DZhzId38aY/dX2gHp7phaYkbNJkCx8G//VVs0nVzZv0qjWGggLkMXoMipphO8Hv0TvZu30Zwdt6nzFIbcBQ==} + /typescript@5.3.0-dev.20230920: + resolution: {integrity: sha512-XaiYm7T6bGo+5mbRsmFqujMbNz0BLRCTKXiG7Nuodxz/aB5XJhJ01s/9GOJ/BS2XcxBqMoTbrGf61OdqzYhpxg==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -9884,38 +9887,38 @@ packages: dev: false file:projects/ai-content-safety.tgz: - resolution: {integrity: sha512-ghhD0hitSl1yehkXY8937HiI0GIesBzqf10RHxOM3KYXo60elnspeGRfCd/ODPfDFrYwSROqNrKbSssvQ+ioPQ==, tarball: file:projects/ai-content-safety.tgz} + resolution: {integrity: sha512-QBksCV9a0Fubtputd3KItzBP+jvWLJnvakaBZi8POqhCB30y7Hkf44py1lsE0IuMJCkJOjplsAw1Ulns3C5Bbg==, tarball: file:projects/ai-content-safety.tgz} name: '@rush-temp/ai-content-safety' version: 0.0.0 dependencies: '@azure/identity': 2.1.0 - '@microsoft/api-extractor': 7.36.2_@types+node@14.18.53 - '@types/chai': 4.3.5 + '@microsoft/api-extractor': 7.36.4(@types/node@14.18.56) + '@types/chai': 4.3.6 '@types/mocha': 7.0.2 - '@types/node': 14.18.53 + '@types/node': 14.18.56 autorest: 3.6.3 - chai: 4.3.7 + chai: 4.3.8 cross-env: 7.0.3 dotenv: 16.3.1 - eslint: 8.45.0 - karma: 6.4.2 + eslint: 8.48.0 + karma: 6.4.2(debug@4.3.4) karma-chrome-launcher: 3.2.0 karma-coverage: 2.2.1 karma-env-preprocessor: 0.1.1 karma-firefox-launcher: 1.3.0 - karma-junit-reporter: 2.0.1_karma@6.4.2 + karma-junit-reporter: 2.0.1(karma@6.4.2) karma-mocha: 2.0.1 - karma-mocha-reporter: 2.2.5_karma@6.4.2 + karma-mocha-reporter: 2.2.5(karma@6.4.2) karma-source-map-support: 1.4.0 karma-sourcemap-loader: 0.3.8 mkdirp: 2.1.6 mocha: 7.2.0 - mocha-junit-reporter: 1.23.3_mocha@7.2.0 + mocha-junit-reporter: 1.23.3(mocha@7.2.0) nyc: 15.1.0 prettier: 2.8.8 rimraf: 3.0.2 source-map-support: 0.5.21 - tslib: 2.6.0 + tslib: 2.6.2 typescript: 5.0.4 transitivePeerDependencies: - bufferutil @@ -12001,7 +12004,7 @@ packages: dev: false file:projects/arm-cosmosdbforpostgresql.tgz: - resolution: {integrity: sha512-aTZZunMkiPA6kuNjfLPPJm7Uhk47BQ+fpMra7raCedYUrnRfPVw1ehndznjELIbuaPaybiBzB9Ti09MSDysHbQ==, tarball: file:projects/arm-cosmosdbforpostgresql.tgz} + resolution: {integrity: sha512-GhkzcQ7p1/1B503z9URCbi60a95oDT+sJpK98TgsCpeoTBJ4WUN24EAfpdLhMTAwyhs3P7BpxS2Iqo53vo+s0A==, tarball: file:projects/arm-cosmosdbforpostgresql.tgz} name: '@rush-temp/arm-cosmosdbforpostgresql' version: 0.0.0 dependencies: @@ -15576,7 +15579,7 @@ packages: dev: false file:projects/arm-rediscache.tgz: - resolution: {integrity: sha512-JDTsZOuYhef+ouTE3gpTZ6HfGpWoq4Q9NoKyE0OYCHoY6CeiGUqYivKUwEYzmiKIjAyDW9LBLQjjexvhG/xNEg==, tarball: file:projects/arm-rediscache.tgz} + resolution: {integrity: sha512-yRoTaH0f5+DBBUidse7sz5UDIn1TTltX///zwO0gjQUvCnte4Mu6zA14Cdg36oRZ60iljQsEIR4tsFx4zhcGBw==, tarball: file:projects/arm-rediscache.tgz} name: '@rush-temp/arm-rediscache' version: 0.0.0 dependencies: @@ -16576,6 +16579,37 @@ packages: - supports-color dev: false + file:projects/arm-storageactions.tgz: + resolution: {integrity: sha512-Q8zxXzW6NVazQ0NdXUB6lvShu5tMeBValWFitzSW0IcXJqILyRMlPbsIAWsEG/wigN0RoPo+ES6DnKFfy1kT6A==, tarball: file:projects/arm-storageactions.tgz} + name: '@rush-temp/arm-storageactions' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.36.4(@types/node@14.18.56) + '@rollup/plugin-commonjs': 24.1.0(rollup@2.79.1) + '@rollup/plugin-json': 6.0.0(rollup@2.79.1) + '@rollup/plugin-multi-entry': 6.0.0(rollup@2.79.1) + '@rollup/plugin-node-resolve': 13.3.0(rollup@2.79.1) + '@types/chai': 4.3.6 + '@types/node': 14.18.56 + chai: 4.3.8 + cross-env: 7.0.3 + dotenv: 16.3.1 + mkdirp: 2.1.6 + mocha: 7.2.0 + rimraf: 5.0.1 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3(@types/node@14.18.56)(rollup@2.79.1) + ts-node: 10.9.1(@types/node@14.18.56)(typescript@5.0.4) + tslib: 2.6.2 + typescript: 5.0.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-storagecache.tgz: resolution: {integrity: sha512-wHTNJ33M/BYFZQeTCqT69+Xy5hzxC0OW31W5UBEkJGRT/r7H7JaYB8agrLtawdxe2Ql08akcoNqXZpF2TKRSmw==, tarball: file:projects/arm-storagecache.tgz} name: '@rush-temp/arm-storagecache' @@ -17272,7 +17306,7 @@ packages: dev: false file:projects/communication-alpha-ids.tgz: - resolution: {integrity: sha512-T+0Vz2bQ6lOhzAVSeERChaJQTc7I1Va7iMGrI+9dXRwe18vjOWKDJA844KrhJtW1IOJZJPKa5P19S9Gsl99kJA==, tarball: file:projects/communication-alpha-ids.tgz} + resolution: {integrity: sha512-Ar4gZmdIoE81kqpPnkjSrJWRXsv4vhrQykjEkYixd7MRmcFINfKv99B4cScmTCzuSebNTBsyyVnZls2DLVIoRA==, tarball: file:projects/communication-alpha-ids.tgz} name: '@rush-temp/communication-alpha-ids' version: 0.0.0 dependencies: @@ -17316,7 +17350,7 @@ packages: dev: false file:projects/communication-call-automation.tgz: - resolution: {integrity: sha512-I95R4LweEY6DulekdZyHFBDc5gYAZ7Dq8xDpF8nMZh6twr85oOWFiOgFBB3L13A+3O2YE1xcCUUaen/4YR1zgg==, tarball: file:projects/communication-call-automation.tgz} + resolution: {integrity: sha512-Lr9F5MxDq9pYPblmhTKJR7vTWluHaZ1RDeZnYRn8AHXcJoqSzXvGjHLlkvrwbCUMTRUFgiTuxSy46KumKRsEQA==, tarball: file:projects/communication-call-automation.tgz} name: '@rush-temp/communication-call-automation' version: 0.0.0 dependencies: @@ -17365,7 +17399,7 @@ packages: dev: false file:projects/communication-chat.tgz: - resolution: {integrity: sha512-2lbV09MTvQOFhBj4wbaTLnBdu8R29yfzrZBFdGdk+DPG5SMG/nu3fl2CC3+rQp7sy+s8tGpjsPpcsAhnb1gRqw==, tarball: file:projects/communication-chat.tgz} + resolution: {integrity: sha512-BZQ8JcRQ6AYZIh3x0TZF4ofzkzvj8yeokPWwzLUoJoGdS/Bd2Vd5rAfVZwH6OL/AvqmI7GVNY6KK8K/vfghmmw==, tarball: file:projects/communication-chat.tgz} name: '@rush-temp/communication-chat' version: 0.0.0 dependencies: @@ -17463,7 +17497,7 @@ packages: dev: false file:projects/communication-email.tgz: - resolution: {integrity: sha512-GOyJNqPuvzmz77q4iSanoi9igNxVqVyvTUi+xh5XRcbfLPKQJSbvjpV3DZuZeL9WHxW35Z0hZeFthhEEhzScgA==, tarball: file:projects/communication-email.tgz} + resolution: {integrity: sha512-afDSmfDusmfsXok4Ws6htYLFJFqzaQQJdv5cGIbO+II8FV/3fWGCXd566PKT/lt7qDTGZzVDObWFPg5wJTqfpQ==, tarball: file:projects/communication-email.tgz} name: '@rush-temp/communication-email' version: 0.0.0 dependencies: @@ -17507,7 +17541,7 @@ packages: dev: false file:projects/communication-identity.tgz: - resolution: {integrity: sha512-JG9T9VS1aWHfOQeT0jkuqWA8FaoOoFWn2T87HVTCl5Ryo+c+TId7mKGFFdLS20mPlam1lmBkF/t56dbZHmJ1Ww==, tarball: file:projects/communication-identity.tgz} + resolution: {integrity: sha512-txAjUJm6MTseZ/+YZP0NGBS26dkQyWv33TGllxjjLu0uSS3OWZmZQU3rpQlcCLdxVWe27VHxgVNciM+KwONTxg==, tarball: file:projects/communication-identity.tgz} name: '@rush-temp/communication-identity' version: 0.0.0 dependencies: @@ -17557,7 +17591,7 @@ packages: dev: false file:projects/communication-job-router.tgz: - resolution: {integrity: sha512-qypc/gsoj0jLDj+V3UVqyZ+ajM0AL3mZR44NSqyCY5MZmU+BQ10o2n3jW2oGShmhVjeb//cvUNkTvJZzluKUsA==, tarball: file:projects/communication-job-router.tgz} + resolution: {integrity: sha512-7W7ojlceOXwLiKrJgyUDy0Hi15zVsWYz7YxKufsgU+xbDrysQaoydBkpdnM+FX0sshMIZ258o3DUywLE68ysQA==, tarball: file:projects/communication-job-router.tgz} name: '@rush-temp/communication-job-router' version: 0.0.0 dependencies: @@ -17606,7 +17640,7 @@ packages: dev: false file:projects/communication-network-traversal.tgz: - resolution: {integrity: sha512-BXacXKJAkKRQZ7UsCbRZbS2izmaiKVK7w7iNDJWmJ5oSbwThzyaWNpjpKyLyszzxvWBUupXrzKOeoiAWRTPucA==, tarball: file:projects/communication-network-traversal.tgz} + resolution: {integrity: sha512-S8Nt5zhyRiBCVY2dof2f7oyTthSatuS9IZZdDvg8lFlcti7XqBu4WwS2GdhxoKUbsZcpQyW3JYQG632pWSsg0Q==, tarball: file:projects/communication-network-traversal.tgz} name: '@rush-temp/communication-network-traversal' version: 0.0.0 dependencies: @@ -17653,7 +17687,7 @@ packages: dev: false file:projects/communication-phone-numbers.tgz: - resolution: {integrity: sha512-pOCQO9HL24abJ9gVn3hTaGfeK5xyI6+Z0WvJJJMENZFe5edUeK7TrKhqE7AkC2AgOuXr6mT60QgnIPlBXIbS1Q==, tarball: file:projects/communication-phone-numbers.tgz} + resolution: {integrity: sha512-qjBy6YQQnGMH9FvYgoy1owQcXY/i8IV6Q1WBxd687yKmQ+LgjH6sPcIOYWmAVOwIBgdvMRCymhJMxdCU6BHm3Q==, tarball: file:projects/communication-phone-numbers.tgz} name: '@rush-temp/communication-phone-numbers' version: 0.0.0 dependencies: @@ -17700,7 +17734,7 @@ packages: dev: false file:projects/communication-recipient-verification.tgz: - resolution: {integrity: sha512-EUHxa+KcpREhYTxft9Z74xzVamJrF91CRee+uRKJ5PX0KEP4by3SbXWWMN18PFn0e4Dq8od3kOy5C+F10nf96Q==, tarball: file:projects/communication-recipient-verification.tgz} + resolution: {integrity: sha512-XnvfVkkbxr/Zlng73VcTQ7y69UtgtFJsO2uY6uLkTLNZtCGGBAIoi5OOT1lkGZqIrCZNASKwhPVwBQFAkEwGiw==, tarball: file:projects/communication-recipient-verification.tgz} name: '@rush-temp/communication-recipient-verification' version: 0.0.0 dependencies: @@ -17747,7 +17781,7 @@ packages: dev: false file:projects/communication-rooms.tgz: - resolution: {integrity: sha512-Ediq03xRYY5TTg2YJcwm+4bDaNoyHF1iN5Hz7i6AbfY4a7Wn9XrapjXYlhRHNDSnDqWhT6/8C45EcDeRcqHEgw==, tarball: file:projects/communication-rooms.tgz} + resolution: {integrity: sha512-VOaYHR5r7unCyiKROE7O9hACRQa05pRXh/6scZzJEGHNIBbQCeWRfZE74usf0lGDPioU6vt8t81/i+Rv7t1NhA==, tarball: file:projects/communication-rooms.tgz} name: '@rush-temp/communication-rooms' version: 0.0.0 dependencies: @@ -17784,7 +17818,7 @@ packages: dev: false file:projects/communication-short-codes.tgz: - resolution: {integrity: sha512-ZVSS7zUEO+jzNK9j3puY5elfldkHPwfiZXkrJnwSlAeckEgF5IVtbxFUiEnvYdKYovqvApoKF28LrkPhFQyThg==, tarball: file:projects/communication-short-codes.tgz} + resolution: {integrity: sha512-6ojiKk0CZStYwojQTvccaRKwgZMenNQHJ5Qr59clzMYNlBviW66D0qrL3QeenP6ZTsET8/2H9aqTVBCzd3mihw==, tarball: file:projects/communication-short-codes.tgz} name: '@rush-temp/communication-short-codes' version: 0.0.0 dependencies: @@ -17831,7 +17865,7 @@ packages: dev: false file:projects/communication-sms.tgz: - resolution: {integrity: sha512-NZmHYycCztveawVX5v3SeQEFexWIGahxtmQz+mM9V31YbZKtvCIoxt0D0SzQqdlU4/TyK11TVlpjQ9yR1eU/qA==, tarball: file:projects/communication-sms.tgz} + resolution: {integrity: sha512-rhpQi+HoB1XGHOAHPoV8M8jvsQhjL8Aoe2EayIBrYXUyWfanYLd24Z0xWIn6UjF2COVRHAD5xADJ1m2D/784EQ==, tarball: file:projects/communication-sms.tgz} name: '@rush-temp/communication-sms' version: 0.0.0 dependencies: @@ -17879,7 +17913,7 @@ packages: dev: false file:projects/communication-tiering.tgz: - resolution: {integrity: sha512-KNOwdeTgbB90YxXyrUOfwKyv0yjL4tT1E7o5hIpPLmtBxT6EoP2pe3kI0Mjrv4wNpGntTZxLYx7uo29jRK0Ogg==, tarball: file:projects/communication-tiering.tgz} + resolution: {integrity: sha512-LeoaA4BZzguvQCFmqrAqvIuGKsKGoDpzeZEdFuqYc0ZxuoENpw/bgW9aTHko8lYf7G4Q7useh6G4cCNjH+ebsQ==, tarball: file:projects/communication-tiering.tgz} name: '@rush-temp/communication-tiering' version: 0.0.0 dependencies: @@ -17926,7 +17960,7 @@ packages: dev: false file:projects/communication-toll-free-verification.tgz: - resolution: {integrity: sha512-EKP8pP5kbaw0LW3OABeUBM4h/4Wnd2glSRop0C9yjaJoEn2Z8dJbNfu0wQpmVOlxM8kaP5ZbgJ627gJbjBvpcw==, tarball: file:projects/communication-toll-free-verification.tgz} + resolution: {integrity: sha512-+Q2QeSp/lvXt0TZorV6YiNHg32cUtCGQOdgIf+QWZbMbcRM2lSWUscAk7ZUElLzslKrSrRHLuEqs50juBvIHuA==, tarball: file:projects/communication-toll-free-verification.tgz} name: '@rush-temp/communication-toll-free-verification' version: 0.0.0 dependencies: diff --git a/rush.json b/rush.json index 7d0478a6f65a..c7dccb36aad5 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -2109,6 +2109,11 @@ "packageName": "@azure-tests/perf-monitor-opentelemetry", "projectFolder": "sdk/monitor/perf-tests/monitor-opentelemetry", "versionPolicyName": "test" + }, + { + "packageName": "@azure/arm-storageactions", + "projectFolder": "sdk/storageactions/arm-storageactions", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/storageactions/arm-storageactions/CHANGELOG.md b/sdk/storageactions/arm-storageactions/CHANGELOG.md new file mode 100644 index 000000000000..4b1e4909ce05 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2023-09-20) + +The package of @azure/arm-storageactions is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/storageactions/arm-storageactions/LICENSE b/sdk/storageactions/arm-storageactions/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/storageactions/arm-storageactions/README.md b/sdk/storageactions/arm-storageactions/README.md new file mode 100644 index 000000000000..a7ea655e276b --- /dev/null +++ b/sdk/storageactions/arm-storageactions/README.md @@ -0,0 +1,109 @@ +# Azure StorageActionsManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure StorageActionsManagement client. + +The Azure Storage Actions Management API. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storageactions/arm-storageactions) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-storageactions) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-storageactions) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-storageactions` package + +Install the Azure StorageActionsManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-storageactions +``` + +### Create and authenticate a `StorageActionsManagementClient` + +To create a client object to access the Azure StorageActionsManagement API, you will need the `endpoint` of your Azure StorageActionsManagement resource and a `credential`. The Azure StorageActionsManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure StorageActionsManagement resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure StorageActionsManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { StorageActionsManagementClient } = require("@azure/arm-storageactions"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new StorageActionsManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new StorageActionsManagementClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### StorageActionsManagementClient + +`StorageActionsManagementClient` is the primary interface for developers using the Azure StorageActionsManagement client library. Explore the methods on this client object to understand the different features of the Azure StorageActionsManagement service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fstorageactions%2Farm-storageactions%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/storageactions/arm-storageactions/_meta.json b/sdk/storageactions/arm-storageactions/_meta.json new file mode 100644 index 000000000000..cef6da27a97a --- /dev/null +++ b/sdk/storageactions/arm-storageactions/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "13f09225c7d1cf42c55536e41c090bb8438cebd7", + "readme": "specification/storageactions/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/storageactions/resource-manager/readme.md --use=@autorest/typescript@^6.0.4", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.2", + "use": "@autorest/typescript@^6.0.4" +} \ No newline at end of file diff --git a/sdk/storageactions/arm-storageactions/api-extractor.json b/sdk/storageactions/arm-storageactions/api-extractor.json new file mode 100644 index 000000000000..a9da5b009f94 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/api-extractor.json @@ -0,0 +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" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-storageactions.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/storageactions/arm-storageactions/package.json b/sdk/storageactions/arm-storageactions/package.json new file mode 100644 index 000000000000..8e2e6b84bf3c --- /dev/null +++ b/sdk/storageactions/arm-storageactions/package.json @@ -0,0 +1,116 @@ +{ + "name": "@azure/arm-storageactions", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for StorageActionsManagementClient.", + "version": "1.0.0", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.12.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-storageactions.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-multi-entry": "^6.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^2.1.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~5.0.0", + "uglify-js": "^3.4.9", + "rimraf": "^5.0.0", + "dotenv": "^16.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^14.0.0", + "ts-node": "^10.0.0", + "@azure/dev-tool": "^1.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/storageActionsManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storageactions/arm-storageactions" +} \ No newline at end of file diff --git a/sdk/storageactions/arm-storageactions/review/arm-storageactions.api.md b/sdk/storageactions/arm-storageactions/review/arm-storageactions.api.md new file mode 100644 index 000000000000..94f7055c3ea3 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/review/arm-storageactions.api.md @@ -0,0 +1,516 @@ +## API Report File for "@azure/arm-storageactions" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export type ActionType = string; + +// @public +export type CreatedByType = string; + +// @public +export interface ElseCondition { + operations: StorageTaskOperation[]; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface IfCondition { + condition: string; + operations: StorageTaskOperation[]; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownManagedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownMatchedBlockName { + Else = "Else", + If = "If", + None = "None" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownRunResult { + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownRunStatusEnum { + Finished = "Finished", + InProgress = "InProgress" +} + +// @public +export enum KnownStorageTaskOperationName { + DeleteBlob = "DeleteBlob", + SetBlobExpiry = "SetBlobExpiry", + SetBlobImmutabilityPolicy = "SetBlobImmutabilityPolicy", + SetBlobLegalHold = "SetBlobLegalHold", + SetBlobTags = "SetBlobTags", + SetBlobTier = "SetBlobTier", + UndeleteBlob = "UndeleteBlob" +} + +// @public +export interface ManagedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: ManagedServiceIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentity | null; + }; +} + +// @public +export type ManagedServiceIdentityType = string; + +// @public +export type MatchedBlockName = string; + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationListResult { + readonly nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export type Origin = string; + +// @public +export type ProvisioningState = "ValidateSubscriptionQuotaBegin" | "ValidateSubscriptionQuotaEnd" | "Creating" | "Succeeded" | "Deleting" | "Canceled" | "Failed"; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type RunResult = string; + +// @public +export type RunStatusEnum = string; + +// @public (undocumented) +export class StorageActionsManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: StorageActionsManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + operations: Operations; + // (undocumented) + storageTaskAssignmentOperations: StorageTaskAssignmentOperations; + // (undocumented) + storageTasks: StorageTasks; + // (undocumented) + storageTasksReport: StorageTasksReport; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface StorageActionsManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface StorageTask extends TrackedResource { + action?: StorageTaskAction; + readonly creationTimeInUtc?: Date; + description?: string; + enabled?: boolean; + identity?: ManagedServiceIdentity; + readonly provisioningState?: ProvisioningState; + readonly taskVersion?: number; +} + +// @public +export interface StorageTaskAction { + else?: ElseCondition; + if: IfCondition; +} + +// @public +export interface StorageTaskAssignment { + readonly id?: string; +} + +// @public +export interface StorageTaskAssignmentListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTaskAssignmentListNextResponse = StorageTaskAssignmentsListResult; + +// @public +export interface StorageTaskAssignmentListOptionalParams extends coreClient.OperationOptions { + maxpagesize?: string; +} + +// @public +export type StorageTaskAssignmentListResponse = StorageTaskAssignmentsListResult; + +// @public +export interface StorageTaskAssignmentOperations { + list(resourceGroupName: string, storageTaskName: string, options?: StorageTaskAssignmentListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface StorageTaskAssignmentsListResult { + readonly nextLink?: string; + readonly value?: StorageTaskAssignment[]; +} + +// @public +export interface StorageTaskOperation { + name: StorageTaskOperationName; + onFailure?: "break"; + onSuccess?: "continue"; + parameters?: { + [propertyName: string]: string; + }; +} + +// @public +export type StorageTaskOperationName = string; + +// @public +export interface StorageTaskPreviewAction { + action: StorageTaskPreviewActionCondition; + blobs: StorageTaskPreviewBlobProperties[]; + container: StorageTaskPreviewContainerProperties; +} + +// @public +export interface StorageTaskPreviewActionCondition { + elseBlockExists: boolean; + if: StorageTaskPreviewActionIfCondition; +} + +// @public +export interface StorageTaskPreviewActionIfCondition { + condition?: string; +} + +// @public +export interface StorageTaskPreviewBlobProperties { + readonly matchedBlock?: MatchedBlockName; + metadata?: StorageTaskPreviewKeyValueProperties[]; + name?: string; + properties?: StorageTaskPreviewKeyValueProperties[]; + tags?: StorageTaskPreviewKeyValueProperties[]; +} + +// @public +export interface StorageTaskPreviewContainerProperties { + metadata?: StorageTaskPreviewKeyValueProperties[]; + name?: string; +} + +// @public +export interface StorageTaskPreviewKeyValueProperties { + key?: string; + value?: string; +} + +// @public +export interface StorageTaskReportInstance extends ProxyResource { + properties?: StorageTaskReportProperties; +} + +// @public +export interface StorageTaskReportProperties { + readonly finishTime?: string; + readonly objectFailedCount?: string; + readonly objectsOperatedOnCount?: string; + readonly objectsSucceededCount?: string; + readonly objectsTargetedCount?: string; + readonly runResult?: RunResult; + readonly runStatusEnum?: RunStatusEnum; + readonly runStatusError?: string; + readonly startTime?: string; + readonly storageAccountId?: string; + readonly summaryReportPath?: string; + readonly taskAssignmentId?: string; + readonly taskId?: string; + readonly taskVersion?: string; +} + +// @public +export interface StorageTaskReportSummary { + readonly nextLink?: string; + readonly value?: StorageTaskReportInstance[]; +} + +// @public +export interface StorageTasks { + beginCreate(resourceGroupName: string, storageTaskName: string, parameters: StorageTask, options?: StorageTasksCreateOptionalParams): Promise, StorageTasksCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, storageTaskName: string, parameters: StorageTask, options?: StorageTasksCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, storageTaskName: string, options?: StorageTasksDeleteOptionalParams): Promise, StorageTasksDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, storageTaskName: string, options?: StorageTasksDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, storageTaskName: string, parameters: StorageTaskUpdateParameters, options?: StorageTasksUpdateOptionalParams): Promise, StorageTasksUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, storageTaskName: string, parameters: StorageTaskUpdateParameters, options?: StorageTasksUpdateOptionalParams): Promise; + get(resourceGroupName: string, storageTaskName: string, options?: StorageTasksGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: StorageTasksListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: StorageTasksListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + previewActions(location: string, parameters: StorageTaskPreviewAction, options?: StorageTasksPreviewActionsOptionalParams): Promise; +} + +// @public +export interface StorageTasksCreateHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface StorageTasksCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type StorageTasksCreateResponse = StorageTask; + +// @public +export interface StorageTasksDeleteHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface StorageTasksDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type StorageTasksDeleteResponse = StorageTasksDeleteHeaders; + +// @public +export interface StorageTasksGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTasksGetResponse = StorageTask; + +// @public +export interface StorageTasksListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTasksListByResourceGroupNextResponse = StorageTasksListResult; + +// @public +export interface StorageTasksListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTasksListByResourceGroupResponse = StorageTasksListResult; + +// @public +export interface StorageTasksListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTasksListBySubscriptionNextResponse = StorageTasksListResult; + +// @public +export interface StorageTasksListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTasksListBySubscriptionResponse = StorageTasksListResult; + +// @public +export interface StorageTasksListResult { + readonly nextLink?: string; + readonly value?: StorageTask[]; +} + +// @public +export interface StorageTasksPreviewActionsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTasksPreviewActionsResponse = StorageTaskPreviewAction; + +// @public +export interface StorageTasksReport { + list(resourceGroupName: string, storageTaskName: string, options?: StorageTasksReportListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface StorageTasksReportListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTasksReportListNextResponse = StorageTaskReportSummary; + +// @public +export interface StorageTasksReportListOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: string; +} + +// @public +export type StorageTasksReportListResponse = StorageTaskReportSummary; + +// @public +export interface StorageTasksUpdateHeaders { + // (undocumented) + location?: string; +} + +// @public +export interface StorageTasksUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type StorageTasksUpdateResponse = StorageTask; + +// @public +export interface StorageTaskUpdateParameters { + action?: StorageTaskAction; + readonly creationTimeInUtc?: Date; + description?: string; + enabled?: boolean; + identity?: ManagedServiceIdentity; + readonly provisioningState?: ProvisioningState; + tags?: { + [propertyName: string]: string; + }; + readonly taskVersion?: number; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface UserAssignedIdentity { + readonly clientId?: string; + readonly principalId?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/storageactions/arm-storageactions/rollup.config.js b/sdk/storageactions/arm-storageactions/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/rollup.config.js @@ -0,0 +1,122 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/storageactions/arm-storageactions/sample.env b/sdk/storageactions/arm-storageactions/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/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/storageactions/arm-storageactions/src/index.ts b/sdk/storageactions/arm-storageactions/src/index.ts new file mode 100644 index 000000000000..def6416ae2ae --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { StorageActionsManagementClient } from "./storageActionsManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/storageactions/arm-storageactions/src/lroImpl.ts b/sdk/storageactions/arm-storageactions/src/lroImpl.ts new file mode 100644 index 000000000000..dd803cd5e28c --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/lroImpl.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; +} diff --git a/sdk/storageactions/arm-storageactions/src/models/index.ts b/sdk/storageactions/arm-storageactions/src/models/index.ts new file mode 100644 index 000000000000..b9951fc96f28 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/models/index.ts @@ -0,0 +1,822 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 * as coreClient from "@azure/core-client"; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** + * List of operations supported by the resource provider + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Operation[]; + /** + * URL to get the next set of operation list results (if there are any). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: Origin; + /** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionType?: ActionType; +} + +/** Localized display information for this particular operation. */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** Managed service identity (system assigned and/or user assigned identities) */ +export interface ManagedServiceIdentity { + /** + * The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ + type: ManagedServiceIdentityType; + /** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. */ + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentity | null; + }; +} + +/** User assigned identity properties */ +export interface UserAssignedIdentity { + /** + * The principal ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The client ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + +/** The storage task action represents conditional statements and operations to be performed on target objects. */ +export interface StorageTaskAction { + /** The if block of storage task operation */ + if: IfCondition; + /** The else block of storage task operation */ + else?: ElseCondition; +} + +/** The if block of storage task operation */ +export interface IfCondition { + /** The condition predicate which is composed of object properties, eg: blob and container properties. */ + condition: string; + /** List of operations to execute when the condition predicate satisfies. */ + operations: StorageTaskOperation[]; +} + +/** Represents an operation to be performed on the object */ +export interface StorageTaskOperation { + /** The operation to be performed on the object. */ + name: StorageTaskOperationName; + /** Key-value parameters for the operation. */ + parameters?: { [propertyName: string]: string }; + /** Action to be taken when the operation is successful for a object. */ + onSuccess?: "continue"; + /** Action to be taken when the operation fails for a object. */ + onFailure?: "break"; +} + +/** The else block of storage task operation */ +export interface ElseCondition { + /** List of operations to execute in the else block */ + operations: StorageTaskOperation[]; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** Parameters of the storage task update request */ +export interface StorageTaskUpdateParameters { + /** The identity of the resource. */ + identity?: ManagedServiceIdentity; + /** Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. */ + tags?: { [propertyName: string]: string }; + /** + * Storage task version. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly taskVersion?: number; + /** Storage Task is enabled when set to true and disabled when set to false */ + enabled?: boolean; + /** Text that describes the purpose of the storage task */ + description?: string; + /** The storage task action that is executed */ + action?: StorageTaskAction; + /** + * Represents the provisioning state of the storage task. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * The creation date and time of the storage task in UTC. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly creationTimeInUtc?: Date; +} + +/** The response from the List Storage Tasks operation. */ +export interface StorageTasksListResult { + /** + * Gets the list of storage tasks and their properties. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: StorageTask[]; + /** + * Request URL that can be used to query next page of storage tasks. Returned when total number of requested storage tasks exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The response from the List Storage Tasks operation. */ +export interface StorageTaskAssignmentsListResult { + /** + * Gets the list of storage task assignment Ids. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: StorageTaskAssignment[]; + /** + * Request URL that can be used to query next page of storage task assignment Ids. Returned when total number of requested storage task assignment Ids exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Fetch the Storage task assignment ARM ids. */ +export interface StorageTaskAssignment { + /** + * ARM Id of the storage task assignments, associated with the storage tasks. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; +} + +/** Fetch Storage Tasks Run Summary. */ +export interface StorageTaskReportSummary { + /** + * Gets storage tasks run result summary. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: StorageTaskReportInstance[]; + /** + * Request URL that can be used to query next page of storage task run results summary. Returned when the number of run instances and summary reports exceed maximum page size. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Storage task execution report for a run instance. */ +export interface StorageTaskReportProperties { + /** + * Represents the Storage Task Assignment Id associated with the storage task that provided an execution context. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly taskAssignmentId?: string; + /** + * Represents the Storage Account Id where the storage task definition was applied and executed. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly storageAccountId?: string; + /** + * Start time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly startTime?: string; + /** + * End time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly finishTime?: string; + /** + * Total number of objects that meet the condition as defined in the storage task assignment execution context. Filter options such as objectsTargetedCount gt 50 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly objectsTargetedCount?: string; + /** + * Total number of objects that meet the storage tasks condition and were operated upon. Filter options such as objectsOperatedOnCount ge 100 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly objectsOperatedOnCount?: string; + /** + * Total number of objects where task operation failed when was attempted. Filter options such as objectFailedCount eq 0 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly objectFailedCount?: string; + /** + * Total number of objects where task operation succeeded when was attempted.Filter options such as objectsSucceededCount gt 150 and other comparison operators can be used as described for Numerical properties in https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly objectsSucceededCount?: string; + /** + * Well known Azure Storage error code that represents the error encountered during execution of the run instance. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly runStatusError?: string; + /** + * Represents the status of the execution. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly runStatusEnum?: RunStatusEnum; + /** + * Full path to the verbose report stored in the reporting container as specified in the assignment execution context for the storage account. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly summaryReportPath?: string; + /** + * Storage Task Arm Id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly taskId?: string; + /** + * Storage Task Version + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly taskVersion?: string; + /** + * Represents the overall result of the execution for the run instance + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly runResult?: RunResult; +} + +/** Storage Task Preview Action. */ +export interface StorageTaskPreviewAction { + /** Preview action container properties to be tested for a match with the provided condition. */ + container: StorageTaskPreviewContainerProperties; + /** Preview action container properties to be tested for a match with the provided condition. */ + blobs: StorageTaskPreviewBlobProperties[]; + /** Preview action container properties to be tested for a match with the provided condition. */ + action: StorageTaskPreviewActionCondition; +} + +/** Storage task preview container properties */ +export interface StorageTaskPreviewContainerProperties { + /** property for the container name. */ + name?: string; + /** metadata key value pairs to be tested for a match against the provided condition. */ + metadata?: StorageTaskPreviewKeyValueProperties[]; +} + +/** Storage task preview object key value pair properties. */ +export interface StorageTaskPreviewKeyValueProperties { + /** Represents the key property of the pair. */ + key?: string; + /** Represents the value property of the pair. */ + value?: string; +} + +/** Storage task preview container properties */ +export interface StorageTaskPreviewBlobProperties { + /** property for the container name. */ + name?: string; + /** properties key value pairs to be tested for a match against the provided condition. */ + properties?: StorageTaskPreviewKeyValueProperties[]; + /** metadata key value pairs to be tested for a match against the provided condition. */ + metadata?: StorageTaskPreviewKeyValueProperties[]; + /** tags key value pairs to be tested for a match against the provided condition. */ + tags?: StorageTaskPreviewKeyValueProperties[]; + /** + * Represents the condition block name that matched blob properties. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly matchedBlock?: MatchedBlockName; +} + +/** Represents the storage task conditions to be tested for a match with container and blob properties. */ +export interface StorageTaskPreviewActionCondition { + /** The condition to be tested for a match with container and blob properties. */ + if: StorageTaskPreviewActionIfCondition; + /** Specify whether the else block is present in the condition. */ + elseBlockExists: boolean; +} + +/** Represents storage task preview action condition. */ +export interface StorageTaskPreviewActionIfCondition { + /** Storage task condition to bes tested for a match. */ + condition?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +/** Represents Storage Task. */ +export interface StorageTask extends TrackedResource { + /** The managed service identity of the resource. */ + identity?: ManagedServiceIdentity; + /** + * Storage task version. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly taskVersion?: number; + /** Storage Task is enabled when set to true and disabled when set to false */ + enabled?: boolean; + /** Text that describes the purpose of the storage task */ + description?: string; + /** The storage task action that is executed */ + action?: StorageTaskAction; + /** + * Represents the provisioning state of the storage task. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * The creation date and time of the storage task in UTC. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly creationTimeInUtc?: Date; +} + +/** Storage Tasks run report instance */ +export interface StorageTaskReportInstance extends ProxyResource { + /** Storage task execution report for a run instance. */ + properties?: StorageTaskReportProperties; +} + +/** Defines headers for StorageTasks_create operation. */ +export interface StorageTasksCreateHeaders { + location?: string; +} + +/** Defines headers for StorageTasks_delete operation. */ +export interface StorageTasksDeleteHeaders { + location?: string; +} + +/** Defines headers for StorageTasks_update operation. */ +export interface StorageTasksUpdateHeaders { + location?: string; +} + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** User */ + User = "user", + /** System */ + System = "system", + /** UserSystem */ + UserSystem = "user,system" +} + +/** + * Defines values for Origin. \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user** \ + * **system** \ + * **user,system** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + /** Internal */ + Internal = "Internal" +} + +/** + * Defines values for ActionType. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal** + */ +export type ActionType = string; + +/** Known values of {@link ManagedServiceIdentityType} that the service accepts. */ +export enum KnownManagedServiceIdentityType { + /** None */ + None = "None", + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** UserAssigned */ + UserAssigned = "UserAssigned", + /** SystemAssignedUserAssigned */ + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned" +} + +/** + * Defines values for ManagedServiceIdentityType. \ + * {@link KnownManagedServiceIdentityType} can be used interchangeably with ManagedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** \ + * **UserAssigned** \ + * **SystemAssigned,UserAssigned** + */ +export type ManagedServiceIdentityType = string; + +/** Known values of {@link StorageTaskOperationName} that the service accepts. */ +export enum KnownStorageTaskOperationName { + /** SetBlobTier */ + SetBlobTier = "SetBlobTier", + /** SetBlobTags */ + SetBlobTags = "SetBlobTags", + /** SetBlobImmutabilityPolicy */ + SetBlobImmutabilityPolicy = "SetBlobImmutabilityPolicy", + /** SetBlobLegalHold */ + SetBlobLegalHold = "SetBlobLegalHold", + /** SetBlobExpiry */ + SetBlobExpiry = "SetBlobExpiry", + /** DeleteBlob */ + DeleteBlob = "DeleteBlob", + /** UndeleteBlob */ + UndeleteBlob = "UndeleteBlob" +} + +/** + * Defines values for StorageTaskOperationName. \ + * {@link KnownStorageTaskOperationName} can be used interchangeably with StorageTaskOperationName, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SetBlobTier** \ + * **SetBlobTags** \ + * **SetBlobImmutabilityPolicy** \ + * **SetBlobLegalHold** \ + * **SetBlobExpiry** \ + * **DeleteBlob** \ + * **UndeleteBlob** + */ +export type StorageTaskOperationName = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link RunStatusEnum} that the service accepts. */ +export enum KnownRunStatusEnum { + /** InProgress */ + InProgress = "InProgress", + /** Finished */ + Finished = "Finished" +} + +/** + * Defines values for RunStatusEnum. \ + * {@link KnownRunStatusEnum} can be used interchangeably with RunStatusEnum, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InProgress** \ + * **Finished** + */ +export type RunStatusEnum = string; + +/** Known values of {@link RunResult} that the service accepts. */ +export enum KnownRunResult { + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed" +} + +/** + * Defines values for RunResult. \ + * {@link KnownRunResult} can be used interchangeably with RunResult, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** + */ +export type RunResult = string; + +/** Known values of {@link MatchedBlockName} that the service accepts. */ +export enum KnownMatchedBlockName { + /** If */ + If = "If", + /** Else */ + Else = "Else", + /** None */ + None = "None" +} + +/** + * Defines values for MatchedBlockName. \ + * {@link KnownMatchedBlockName} can be used interchangeably with MatchedBlockName, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **If** \ + * **Else** \ + * **None** + */ +export type MatchedBlockName = string; +/** Defines values for ProvisioningState. */ +export type ProvisioningState = + | "ValidateSubscriptionQuotaBegin" + | "ValidateSubscriptionQuotaEnd" + | "Creating" + | "Succeeded" + | "Deleting" + | "Canceled" + | "Failed"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface StorageTasksCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type StorageTasksCreateResponse = StorageTask; + +/** Optional parameters. */ +export interface StorageTasksDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type StorageTasksDeleteResponse = StorageTasksDeleteHeaders; + +/** Optional parameters. */ +export interface StorageTasksGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type StorageTasksGetResponse = StorageTask; + +/** Optional parameters. */ +export interface StorageTasksUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type StorageTasksUpdateResponse = StorageTask; + +/** Optional parameters. */ +export interface StorageTasksListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type StorageTasksListBySubscriptionResponse = StorageTasksListResult; + +/** Optional parameters. */ +export interface StorageTasksListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type StorageTasksListByResourceGroupResponse = StorageTasksListResult; + +/** Optional parameters. */ +export interface StorageTasksPreviewActionsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the previewActions operation. */ +export type StorageTasksPreviewActionsResponse = StorageTaskPreviewAction; + +/** Optional parameters. */ +export interface StorageTasksListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type StorageTasksListBySubscriptionNextResponse = StorageTasksListResult; + +/** Optional parameters. */ +export interface StorageTasksListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type StorageTasksListByResourceGroupNextResponse = StorageTasksListResult; + +/** Optional parameters. */ +export interface StorageTaskAssignmentListOptionalParams + extends coreClient.OperationOptions { + /** Optional, specifies the maximum number of storage task assignment Ids to be included in the list response. */ + maxpagesize?: string; +} + +/** Contains response data for the list operation. */ +export type StorageTaskAssignmentListResponse = StorageTaskAssignmentsListResult; + +/** Optional parameters. */ +export interface StorageTaskAssignmentListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type StorageTaskAssignmentListNextResponse = StorageTaskAssignmentsListResult; + +/** Optional parameters. */ +export interface StorageTasksReportListOptionalParams + extends coreClient.OperationOptions { + /** Optional, specifies the maximum number of storage task assignment Ids to be included in the list response. */ + maxpagesize?: string; + /** Optional. When specified, it can be used to query using reporting properties. */ + filter?: string; +} + +/** Contains response data for the list operation. */ +export type StorageTasksReportListResponse = StorageTaskReportSummary; + +/** Optional parameters. */ +export interface StorageTasksReportListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type StorageTasksReportListNextResponse = StorageTaskReportSummary; + +/** Optional parameters. */ +export interface StorageActionsManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/storageactions/arm-storageactions/src/models/mappers.ts b/sdk/storageactions/arm-storageactions/src/models/mappers.ts new file mode 100644 index 000000000000..f0d6d749b8f3 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/models/mappers.ts @@ -0,0 +1,1104 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 * as coreClient from "@azure/core-client"; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String" + } + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const ManagedServiceIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedServiceIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "Uuid" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { name: "Composite", className: "UserAssignedIdentity" } + } + } + } + } + } +}; + +export const UserAssignedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "Uuid" + } + } + } + } +}; + +export const StorageTaskAction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskAction", + modelProperties: { + if: { + serializedName: "if", + type: { + name: "Composite", + className: "IfCondition" + } + }, + else: { + serializedName: "else", + type: { + name: "Composite", + className: "ElseCondition" + } + } + } + } +}; + +export const IfCondition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "IfCondition", + modelProperties: { + condition: { + serializedName: "condition", + required: true, + type: { + name: "String" + } + }, + operations: { + serializedName: "operations", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskOperation" + } + } + } + } + } + } +}; + +export const StorageTaskOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskOperation", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + parameters: { + serializedName: "parameters", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + onSuccess: { + defaultValue: "continue", + isConstant: true, + serializedName: "onSuccess", + type: { + name: "String" + } + }, + onFailure: { + defaultValue: "break", + isConstant: true, + serializedName: "onFailure", + type: { + name: "String" + } + } + } + } +}; + +export const ElseCondition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ElseCondition", + modelProperties: { + operations: { + serializedName: "operations", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskOperation" + } + } + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const StorageTaskUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskUpdateParameters", + modelProperties: { + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + taskVersion: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 1 + }, + serializedName: "properties.taskVersion", + readOnly: true, + type: { + name: "Number" + } + }, + enabled: { + serializedName: "properties.enabled", + type: { + name: "Boolean" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + action: { + serializedName: "properties.action", + type: { + name: "Composite", + className: "StorageTaskAction" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "Enum", + allowedValues: [ + "ValidateSubscriptionQuotaBegin", + "ValidateSubscriptionQuotaEnd", + "Creating", + "Succeeded", + "Deleting", + "Canceled", + "Failed" + ] + } + }, + creationTimeInUtc: { + serializedName: "properties.creationTimeInUtc", + readOnly: true, + type: { + name: "DateTime" + } + } + } + } +}; + +export const StorageTasksListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTasksListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTask" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StorageTaskAssignmentsListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskAssignmentsListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskAssignment" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StorageTaskAssignment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskAssignment", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StorageTaskReportSummary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskReportSummary", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskReportInstance" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StorageTaskReportProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskReportProperties", + modelProperties: { + taskAssignmentId: { + serializedName: "taskAssignmentId", + readOnly: true, + type: { + name: "String" + } + }, + storageAccountId: { + serializedName: "storageAccountId", + readOnly: true, + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "String" + } + }, + finishTime: { + serializedName: "finishTime", + readOnly: true, + type: { + name: "String" + } + }, + objectsTargetedCount: { + serializedName: "objectsTargetedCount", + readOnly: true, + type: { + name: "String" + } + }, + objectsOperatedOnCount: { + serializedName: "objectsOperatedOnCount", + readOnly: true, + type: { + name: "String" + } + }, + objectFailedCount: { + serializedName: "objectFailedCount", + readOnly: true, + type: { + name: "String" + } + }, + objectsSucceededCount: { + serializedName: "objectsSucceededCount", + readOnly: true, + type: { + name: "String" + } + }, + runStatusError: { + serializedName: "runStatusError", + readOnly: true, + type: { + name: "String" + } + }, + runStatusEnum: { + serializedName: "runStatusEnum", + readOnly: true, + type: { + name: "String" + } + }, + summaryReportPath: { + serializedName: "summaryReportPath", + readOnly: true, + type: { + name: "String" + } + }, + taskId: { + serializedName: "taskId", + readOnly: true, + type: { + name: "String" + } + }, + taskVersion: { + serializedName: "taskVersion", + readOnly: true, + type: { + name: "String" + } + }, + runResult: { + serializedName: "runResult", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StorageTaskPreviewAction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskPreviewAction", + modelProperties: { + container: { + serializedName: "properties.container", + type: { + name: "Composite", + className: "StorageTaskPreviewContainerProperties" + } + }, + blobs: { + serializedName: "properties.blobs", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskPreviewBlobProperties" + } + } + } + }, + action: { + serializedName: "properties.action", + type: { + name: "Composite", + className: "StorageTaskPreviewActionCondition" + } + } + } + } +}; + +export const StorageTaskPreviewContainerProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskPreviewContainerProperties", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + metadata: { + serializedName: "metadata", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskPreviewKeyValueProperties" + } + } + } + } + } + } +}; + +export const StorageTaskPreviewKeyValueProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskPreviewKeyValueProperties", + modelProperties: { + key: { + serializedName: "key", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const StorageTaskPreviewBlobProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskPreviewBlobProperties", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskPreviewKeyValueProperties" + } + } + } + }, + metadata: { + serializedName: "metadata", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskPreviewKeyValueProperties" + } + } + } + }, + tags: { + serializedName: "tags", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageTaskPreviewKeyValueProperties" + } + } + } + }, + matchedBlock: { + serializedName: "matchedBlock", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StorageTaskPreviewActionCondition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskPreviewActionCondition", + modelProperties: { + if: { + serializedName: "if", + type: { + name: "Composite", + className: "StorageTaskPreviewActionIfCondition" + } + }, + elseBlockExists: { + serializedName: "elseBlockExists", + required: true, + type: { + name: "Boolean" + } + } + } + } +}; + +export const StorageTaskPreviewActionIfCondition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskPreviewActionIfCondition", + modelProperties: { + condition: { + serializedName: "condition", + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const StorageTask: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTask", + modelProperties: { + ...TrackedResource.type.modelProperties, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity" + } + }, + taskVersion: { + constraints: { + InclusiveMaximum: 1, + InclusiveMinimum: 1 + }, + serializedName: "properties.taskVersion", + readOnly: true, + type: { + name: "Number" + } + }, + enabled: { + serializedName: "properties.enabled", + type: { + name: "Boolean" + } + }, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + action: { + serializedName: "properties.action", + type: { + name: "Composite", + className: "StorageTaskAction" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "Enum", + allowedValues: [ + "ValidateSubscriptionQuotaBegin", + "ValidateSubscriptionQuotaEnd", + "Creating", + "Succeeded", + "Deleting", + "Canceled", + "Failed" + ] + } + }, + creationTimeInUtc: { + serializedName: "properties.creationTimeInUtc", + readOnly: true, + type: { + name: "DateTime" + } + } + } + } +}; + +export const StorageTaskReportInstance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTaskReportInstance", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "StorageTaskReportProperties" + } + } + } + } +}; + +export const StorageTasksCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTasksCreateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const StorageTasksDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTasksDeleteHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const StorageTasksUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageTasksUpdateHeaders", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/storageactions/arm-storageactions/src/models/parameters.ts b/sdk/storageactions/arm-storageactions/src/models/parameters.ts new file mode 100644 index 000000000000..eebe8604db9e --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/models/parameters.ts @@ -0,0 +1,166 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + StorageTask as StorageTaskMapper, + StorageTaskUpdateParameters as StorageTaskUpdateParametersMapper, + StorageTaskPreviewAction as StorageTaskPreviewActionMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2023-01-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: StorageTaskMapper +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const storageTaskName: OperationURLParameter = { + parameterPath: "storageTaskName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-z0-9]{3,18}$"), + MaxLength: 18, + MinLength: 3 + }, + serializedName: "storageTaskName", + required: true, + type: { + name: "String" + } + } +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "Uuid" + } + } +}; + +export const parameters1: OperationParameter = { + parameterPath: "parameters", + mapper: StorageTaskUpdateParametersMapper +}; + +export const parameters2: OperationParameter = { + parameterPath: "parameters", + mapper: StorageTaskPreviewActionMapper +}; + +export const location: OperationURLParameter = { + parameterPath: "location", + mapper: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } +}; + +export const maxpagesize: OperationQueryParameter = { + parameterPath: ["options", "maxpagesize"], + mapper: { + serializedName: "$maxpagesize", + type: { + name: "String" + } + } +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; diff --git a/sdk/storageactions/arm-storageactions/src/operations/index.ts b/sdk/storageactions/arm-storageactions/src/operations/index.ts new file mode 100644 index 000000000000..ba07bfabb800 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operations/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./storageTasks"; +export * from "./storageTaskAssignmentOperations"; +export * from "./storageTasksReport"; diff --git a/sdk/storageactions/arm-storageactions/src/operations/operations.ts b/sdk/storageactions/arm-storageactions/src/operations/operations.ts new file mode 100644 index 000000000000..850e28d49f5c --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageActionsManagementClient } from "../storageActionsManagementClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: StorageActionsManagementClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: StorageActionsManagementClient) { + this.client = client; + } + + /** + * Lists all of the available Storage Actions Rest API operations. + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all of the available Storage Actions Rest API operations. + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.StorageActions/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storageactions/arm-storageactions/src/operations/storageTaskAssignmentOperations.ts b/sdk/storageactions/arm-storageactions/src/operations/storageTaskAssignmentOperations.ts new file mode 100644 index 000000000000..c8495bcb6eca --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operations/storageTaskAssignmentOperations.ts @@ -0,0 +1,205 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { StorageTaskAssignmentOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageActionsManagementClient } from "../storageActionsManagementClient"; +import { + StorageTaskAssignment, + StorageTaskAssignmentListNextOptionalParams, + StorageTaskAssignmentListOptionalParams, + StorageTaskAssignmentListResponse, + StorageTaskAssignmentListNextResponse +} from "../models"; + +/// +/** Class containing StorageTaskAssignmentOperations operations. */ +export class StorageTaskAssignmentOperationsImpl + implements StorageTaskAssignmentOperations { + private readonly client: StorageActionsManagementClient; + + /** + * Initialize a new instance of the class StorageTaskAssignmentOperations class. + * @param client Reference to the service client + */ + constructor(client: StorageActionsManagementClient) { + this.client = client; + } + + /** + * Lists all the storage tasks available under the given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTaskAssignmentListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + storageTaskName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + storageTaskName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTaskAssignmentListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: StorageTaskAssignmentListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, storageTaskName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + storageTaskName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTaskAssignmentListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + storageTaskName, + options + )) { + yield* page; + } + } + + /** + * Lists all the storage tasks available under the given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTaskAssignmentListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageTaskName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + storageTaskName: string, + nextLink: string, + options?: StorageTaskAssignmentListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageTaskName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTaskAssignmentsListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.maxpagesize], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.storageTaskName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTaskAssignmentsListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.storageTaskName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storageactions/arm-storageactions/src/operations/storageTasks.ts b/sdk/storageactions/arm-storageactions/src/operations/storageTasks.ts new file mode 100644 index 000000000000..77dd9456bca9 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operations/storageTasks.ts @@ -0,0 +1,801 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { StorageTasks } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageActionsManagementClient } from "../storageActionsManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + StorageTask, + StorageTasksListBySubscriptionNextOptionalParams, + StorageTasksListBySubscriptionOptionalParams, + StorageTasksListBySubscriptionResponse, + StorageTasksListByResourceGroupNextOptionalParams, + StorageTasksListByResourceGroupOptionalParams, + StorageTasksListByResourceGroupResponse, + StorageTasksCreateOptionalParams, + StorageTasksCreateResponse, + StorageTasksDeleteOptionalParams, + StorageTasksDeleteResponse, + StorageTasksGetOptionalParams, + StorageTasksGetResponse, + StorageTaskUpdateParameters, + StorageTasksUpdateOptionalParams, + StorageTasksUpdateResponse, + StorageTaskPreviewAction, + StorageTasksPreviewActionsOptionalParams, + StorageTasksPreviewActionsResponse, + StorageTasksListBySubscriptionNextResponse, + StorageTasksListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing StorageTasks operations. */ +export class StorageTasksImpl implements StorageTasks { + private readonly client: StorageActionsManagementClient; + + /** + * Initialize a new instance of the class StorageTasks class. + * @param client Reference to the service client + */ + constructor(client: StorageActionsManagementClient) { + this.client = client; + } + + /** + * Lists all the storage tasks available under the subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: StorageTasksListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: StorageTasksListBySubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: StorageTasksListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionPagingAll( + options?: StorageTasksListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all the storage tasks available under the given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: StorageTasksListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: StorageTasksListByResourceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: StorageTasksListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: StorageTasksListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task + * is already created and a subsequent create request is issued with different properties, the storage + * task properties will be updated. If a storage task is already created and a subsequent create or + * update request is issued with the exact same set of properties, the request will succeed. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param parameters The parameters to create a Storage Task. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + storageTaskName: string, + parameters: StorageTask, + options?: StorageTasksCreateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + StorageTasksCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, storageTaskName, parameters, options }, + spec: createOperationSpec + }); + const poller = await createHttpPoller< + StorageTasksCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task + * is already created and a subsequent create request is issued with different properties, the storage + * task properties will be updated. If a storage task is already created and a subsequent create or + * update request is issued with the exact same set of properties, the request will succeed. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param parameters The parameters to create a Storage Task. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + storageTaskName: string, + parameters: StorageTask, + options?: StorageTasksCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + storageTaskName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete the storage task resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksDeleteOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + StorageTasksDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, storageTaskName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller< + StorageTasksDeleteResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete the storage task resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageTaskName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Get the storage task properties + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageTaskName, options }, + getOperationSpec + ); + } + + /** + * Update storage task properties + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param parameters The parameters to provide to update the storage task resource. + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + storageTaskName: string, + parameters: StorageTaskUpdateParameters, + options?: StorageTasksUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + StorageTasksUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, storageTaskName, parameters, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + StorageTasksUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Update storage task properties + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param parameters The parameters to provide to update the storage task resource. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + storageTaskName: string, + parameters: StorageTaskUpdateParameters, + options?: StorageTasksUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + storageTaskName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Lists all the storage tasks available under the subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: StorageTasksListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Lists all the storage tasks available under the given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: StorageTasksListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Runs the input conditions against input object metadata properties and designates matched objects in + * response. + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @param options The options parameters. + */ + previewActions( + location: string, + parameters: StorageTaskPreviewAction, + options?: StorageTasksPreviewActionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { location, parameters, options }, + previewActionsOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: StorageTasksListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: StorageTasksListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.StorageTask + }, + 201: { + bodyMapper: Mappers.StorageTask + }, + 202: { + bodyMapper: Mappers.StorageTask + }, + 204: { + bodyMapper: Mappers.StorageTask + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.storageTaskName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.StorageTasksDeleteHeaders + }, + 201: { + headersMapper: Mappers.StorageTasksDeleteHeaders + }, + 202: { + headersMapper: Mappers.StorageTasksDeleteHeaders + }, + 204: { + headersMapper: Mappers.StorageTasksDeleteHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.storageTaskName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTask + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.storageTaskName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.StorageTask + }, + 201: { + bodyMapper: Mappers.StorageTask + }, + 202: { + bodyMapper: Mappers.StorageTask + }, + 204: { + bodyMapper: Mappers.StorageTask + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.storageTaskName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTasksListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTasksListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const previewActionsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.StorageTaskPreviewAction + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.location + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTasksListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTasksListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storageactions/arm-storageactions/src/operations/storageTasksReport.ts b/sdk/storageactions/arm-storageactions/src/operations/storageTasksReport.ts new file mode 100644 index 000000000000..7e00d0a92e1f --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operations/storageTasksReport.ts @@ -0,0 +1,208 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { StorageTasksReport } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageActionsManagementClient } from "../storageActionsManagementClient"; +import { + StorageTaskReportInstance, + StorageTasksReportListNextOptionalParams, + StorageTasksReportListOptionalParams, + StorageTasksReportListResponse, + StorageTasksReportListNextResponse +} from "../models"; + +/// +/** Class containing StorageTasksReport operations. */ +export class StorageTasksReportImpl implements StorageTasksReport { + private readonly client: StorageActionsManagementClient; + + /** + * Initialize a new instance of the class StorageTasksReport class. + * @param client Reference to the service client + */ + constructor(client: StorageActionsManagementClient) { + this.client = client; + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksReportListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + storageTaskName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + storageTaskName, + options, + settings + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksReportListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: StorageTasksReportListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, storageTaskName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + storageTaskName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksReportListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + storageTaskName, + options + )) { + yield* page; + } + } + + /** + * Fetch the storage tasks run report summary for each assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksReportListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageTaskName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + storageTaskName: string, + nextLink: string, + options?: StorageTasksReportListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageTaskName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTaskReportSummary + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.maxpagesize, + Parameters.filter + ], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.storageTaskName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.StorageTaskReportSummary + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.storageTaskName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storageactions/arm-storageactions/src/operationsInterfaces/index.ts b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..ba07bfabb800 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./storageTasks"; +export * from "./storageTaskAssignmentOperations"; +export * from "./storageTasksReport"; diff --git a/sdk/storageactions/arm-storageactions/src/operationsInterfaces/operations.ts b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..0a0e852dd79b --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available Storage Actions Rest API operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTaskAssignmentOperations.ts b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTaskAssignmentOperations.ts new file mode 100644 index 000000000000..ebc6ccd605c1 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTaskAssignmentOperations.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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + StorageTaskAssignment, + StorageTaskAssignmentListOptionalParams +} from "../models"; + +/// +/** Interface representing a StorageTaskAssignmentOperations. */ +export interface StorageTaskAssignmentOperations { + /** + * Lists all the storage tasks available under the given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTaskAssignmentListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTasks.ts b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTasks.ts new file mode 100644 index 000000000000..82506501fbca --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTasks.ts @@ -0,0 +1,180 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + StorageTask, + StorageTasksListBySubscriptionOptionalParams, + StorageTasksListByResourceGroupOptionalParams, + StorageTasksCreateOptionalParams, + StorageTasksCreateResponse, + StorageTasksDeleteOptionalParams, + StorageTasksDeleteResponse, + StorageTasksGetOptionalParams, + StorageTasksGetResponse, + StorageTaskUpdateParameters, + StorageTasksUpdateOptionalParams, + StorageTasksUpdateResponse, + StorageTaskPreviewAction, + StorageTasksPreviewActionsOptionalParams, + StorageTasksPreviewActionsResponse +} from "../models"; + +/// +/** Interface representing a StorageTasks. */ +export interface StorageTasks { + /** + * Lists all the storage tasks available under the subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: StorageTasksListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists all the storage tasks available under the given resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: StorageTasksListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task + * is already created and a subsequent create request is issued with different properties, the storage + * task properties will be updated. If a storage task is already created and a subsequent create or + * update request is issued with the exact same set of properties, the request will succeed. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param parameters The parameters to create a Storage Task. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + storageTaskName: string, + parameters: StorageTask, + options?: StorageTasksCreateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + StorageTasksCreateResponse + > + >; + /** + * Asynchronously creates a new storage task resource with the specified parameters. If a storage task + * is already created and a subsequent create request is issued with different properties, the storage + * task properties will be updated. If a storage task is already created and a subsequent create or + * update request is issued with the exact same set of properties, the request will succeed. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param parameters The parameters to create a Storage Task. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + storageTaskName: string, + parameters: StorageTask, + options?: StorageTasksCreateOptionalParams + ): Promise; + /** + * Delete the storage task resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksDeleteOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + StorageTasksDeleteResponse + > + >; + /** + * Delete the storage task resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksDeleteOptionalParams + ): Promise; + /** + * Get the storage task properties + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksGetOptionalParams + ): Promise; + /** + * Update storage task properties + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param parameters The parameters to provide to update the storage task resource. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + storageTaskName: string, + parameters: StorageTaskUpdateParameters, + options?: StorageTasksUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + StorageTasksUpdateResponse + > + >; + /** + * Update storage task properties + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param parameters The parameters to provide to update the storage task resource. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + storageTaskName: string, + parameters: StorageTaskUpdateParameters, + options?: StorageTasksUpdateOptionalParams + ): Promise; + /** + * Runs the input conditions against input object metadata properties and designates matched objects in + * response. + * @param location The location to perform preview of the actions. + * @param parameters The parameters to preview action condition. + * @param options The options parameters. + */ + previewActions( + location: string, + parameters: StorageTaskPreviewAction, + options?: StorageTasksPreviewActionsOptionalParams + ): Promise; +} diff --git a/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTasksReport.ts b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTasksReport.ts new file mode 100644 index 000000000000..4a5ac1df7a2a --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/operationsInterfaces/storageTasksReport.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. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + StorageTaskReportInstance, + StorageTasksReportListOptionalParams +} from "../models"; + +/// +/** Interface representing a StorageTasksReport. */ +export interface StorageTasksReport { + /** + * Fetch the storage tasks run report summary for each assignment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageTaskName The name of the storage task within the specified resource group. Storage + * task names must be between 3 and 18 characters in length and use numbers and lower-case letters + * only. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + storageTaskName: string, + options?: StorageTasksReportListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storageactions/arm-storageactions/src/pagingHelper.ts b/sdk/storageactions/arm-storageactions/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/pagingHelper.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. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/storageactions/arm-storageactions/src/storageActionsManagementClient.ts b/sdk/storageactions/arm-storageactions/src/storageActionsManagementClient.ts new file mode 100644 index 000000000000..7f090de72654 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/src/storageActionsManagementClient.ts @@ -0,0 +1,158 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { + OperationsImpl, + StorageTasksImpl, + StorageTaskAssignmentOperationsImpl, + StorageTasksReportImpl +} from "./operations"; +import { + Operations, + StorageTasks, + StorageTaskAssignmentOperations, + StorageTasksReport +} from "./operationsInterfaces"; +import { StorageActionsManagementClientOptionalParams } from "./models"; + +export class StorageActionsManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the StorageActionsManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: StorageActionsManagementClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: StorageActionsManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-storageactions/1.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2023-01-01"; + this.operations = new OperationsImpl(this); + this.storageTasks = new StorageTasksImpl(this); + this.storageTaskAssignmentOperations = new StorageTaskAssignmentOperationsImpl( + this + ); + this.storageTasksReport = new StorageTasksReportImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + storageTasks: StorageTasks; + storageTaskAssignmentOperations: StorageTaskAssignmentOperations; + storageTasksReport: StorageTasksReport; +} diff --git a/sdk/storageactions/arm-storageactions/test/sampleTest.ts b/sdk/storageactions/arm-storageactions/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/test/sampleTest.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. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/storageactions/arm-storageactions/tsconfig.json b/sdk/storageactions/arm-storageactions/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/storageactions/arm-storageactions/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/storageactions/ci.mgmt.yml b/sdk/storageactions/ci.mgmt.yml new file mode 100644 index 000000000000..448ca7bc9240 --- /dev/null +++ b/sdk/storageactions/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/storageactions/arm-storageactions + - sdk/storageactions/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/storageactions/arm-storageactions + - sdk/storageactions/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storageactions + Artifacts: + - name: azure-arm-storageactions + safeName: azurearmstorageactions + \ No newline at end of file