ZiWei Chen 2024-03-22 14:48:26 +08:00 коммит произвёл GitHub
Родитель 3af79f2702
Коммит e2e4ba3dbe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
70 изменённых файлов: 6823 добавлений и 6 удалений

3
.github/CODEOWNERS поставляемый
Просмотреть файл

@ -786,6 +786,9 @@
# PRLabel: %Mgmt
/sdk/storage/arm-storage/ @qiaozha @MaryGao
# PRLabel: %Mgmt
/sdk/storageactions/arm-storageactions/ @qiaozha @MaryGao
# PRLabel: %Mgmt
/sdk/storage/arm-storage-profile-2020-09-01-hybrid/ @qiaozha @MaryGao

Просмотреть файл

@ -671,6 +671,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
@ -3566,7 +3569,7 @@ packages:
resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==}
dependencies:
'@types/jsonfile': 6.1.4
'@types/node': 18.19.26
'@types/node': 20.10.8
dev: false
/@types/fs-extra@8.1.5:
@ -3613,7 +3616,7 @@ packages:
/@types/jsonfile@6.1.4:
resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==}
dependencies:
'@types/node': 18.19.26
'@types/node': 20.10.8
dev: false
/@types/jsonwebtoken@9.0.6:
@ -3735,7 +3738,7 @@ packages:
/@types/readdir-glob@1.1.5:
resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==}
dependencies:
'@types/node': 18.19.26
'@types/node': 20.10.8
dev: false
/@types/resolve@1.20.2:
@ -8952,6 +8955,7 @@ packages:
/queue-tick@1.0.1:
resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==}
requiresBuild: true
dev: false
/randombytes@2.1.0:
@ -17233,6 +17237,34 @@ packages:
- supports-color
dev: false
file:projects/arm-storageactions.tgz:
resolution: {integrity: sha512-cb+CLfW2LY79o+VK93D8Ty9ZZzcsvt4wZyn6vW0/2V3N+yOLphrIcF+JKrqZWdxsH0MXw+JUgl5nlUh6EhQliw==, tarball: file:projects/arm-storageactions.tgz}
name: '@rush-temp/arm-storageactions'
version: 0.0.0
dependencies:
'@azure/abort-controller': 1.1.0
'@azure/identity': 4.0.1
'@microsoft/api-extractor': 7.43.0(@types/node@18.19.26)
'@types/chai': 4.3.14
'@types/mocha': 10.0.6
'@types/node': 18.19.26
chai: 4.3.10
cross-env: 7.0.3
dotenv: 16.4.5
esm: 3.2.25
mkdirp: 2.1.6
mocha: 10.3.0
rimraf: 5.0.5
ts-node: 10.9.2(@types/node@18.19.26)(typescript@5.3.3)
tslib: 2.6.2
typescript: 5.3.3
uglify-js: 3.17.4
transitivePeerDependencies:
- '@swc/core'
- '@swc/wasm'
- supports-color
dev: false
file:projects/arm-storagecache.tgz:
resolution: {integrity: sha512-BmqN6ugeFzb49BkhF1bWQ6xJ8CD5y0mfAg+d+ZweVu0kjPTKCbhF8+Mh/mLpJ0zp2ha7S0EEE7ePWhTk0CAVpw==, tarball: file:projects/arm-storagecache.tgz}
name: '@rush-temp/arm-storagecache'
@ -19833,7 +19865,7 @@ packages:
dev: false
file:projects/identity-broker.tgz:
resolution: {integrity: sha512-pEzSuEC+bJbFJ/bJ0uWL98hxzLq3DrXEkDOnBhOkgXIqsZ/N2i5MkwCpmF1uUtd6c/Jj7GeoBalZRKDp9rb92g==, tarball: file:projects/identity-broker.tgz}
resolution: {integrity: sha512-qY6zvput4lQHqhzPdsjjnl+Mu2xsNP5BDuTPK9EqyNthY++uxe+6KFNy1eKt5s2eiVlHLahFpSOaQsvsmf8AHg==, tarball: file:projects/identity-broker.tgz}
name: '@rush-temp/identity-broker'
version: 0.0.0
dependencies:

Просмотреть файл

@ -17,3 +17,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-largeinstance?view=azure-no
https://docs.microsoft.com/javascript/api/@azure/arm-springappdiscovery?view=azure-node-preview
https://docs.microsoft.com/javascript/api/@azure-rest/purview-datamap?view=azure-node-preview
https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/purview/purview-datamap-rest/samples
https://docs.microsoft.com/javascript/api/@azure/arm-storageactions?view=azure-node-preview

Просмотреть файл

@ -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.
@ -2207,6 +2207,11 @@
"packageName": "@azure/arm-springappdiscovery",
"projectFolder": "sdk/springappdiscovery/arm-springappdiscovery",
"versionPolicyName": "management"
},
{
"packageName": "@azure/arm-storageactions",
"projectFolder": "sdk/storageactions/arm-storageactions",
"versionPolicyName": "management"
}
]
}
}

Просмотреть файл

@ -0,0 +1,5 @@
# Release History
## 1.0.0-beta.1 (2024-03-07)
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/azsdk/js/mgmt/quickstart ).

Просмотреть файл

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2024 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.

Просмотреть файл

@ -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?view=azure-node-preview) |
[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: "<YOUR_TENANT_ID>",
// clientId: "<YOUR_CLIENT_ID>"
// });
// 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

Просмотреть файл

@ -0,0 +1,8 @@
{
"commit": "84849e5293de3a8e01cbdde13b2d7086d3fb34d6",
"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=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\storageactions\\resource-manager\\readme.md --use=@autorest/typescript@6.0.17 --generate-sample=true",
"repository_url": "https://github.com/Azure/azure-rest-api-specs.git",
"release_tool": "@azure-tools/js-sdk-release-tools@2.7.4",
"use": "@autorest/typescript@6.0.17"
}

Просмотреть файл

@ -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"
}
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
{
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "js",
"TagPrefix": "js/storageactions/arm-storageactions",
"Tag": "js/storageactions/arm-storageactions_b80e0da60d"
}

Просмотреть файл

@ -0,0 +1,118 @@
{
"name": "@azure/arm-storageactions",
"sdk-type": "mgmt",
"author": "Microsoft Corporation",
"description": "A generated SDK for StorageActionsManagementClient.",
"version": "1.0.0-beta.1",
"engines": {
"node": ">=18.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.6.0",
"@azure/core-rest-pipeline": "^1.14.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",
"mkdirp": "^2.1.2",
"typescript": "~5.3.3",
"uglify-js": "^3.4.9",
"rimraf": "^5.0.0",
"dotenv": "^16.0.0",
"@azure/dev-tool": "^1.0.0",
"@azure/identity": "^4.0.1",
"@azure-tools/test-recorder": "^3.0.0",
"@azure-tools/test-credential": "^1.0.0",
"mocha": "^10.0.0",
"@types/mocha": "^10.0.0",
"esm": "^3.2.18",
"@types/chai": "^4.2.8",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"@types/node": "^18.0.0",
"ts-node": "^10.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",
"tsconfig.json",
"review/*",
"CHANGELOG.md",
"types/*"
],
"scripts": {
"build": "npm run clean && tsc && dev-tool run bundle && 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",
"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",
"//sampleConfiguration": {
"productName": "",
"productSlugs": [
"azure"
],
"disableDocsMs": true,
"apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-storageactions?view=azure-node-preview"
}
}

Просмотреть файл

@ -0,0 +1,521 @@
## 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<string, unknown>;
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<Operation>;
}
// @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 {
identity?: ManagedServiceIdentity;
properties?: StorageTaskProperties;
}
// @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<StorageTaskAssignment>;
}
// @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 {
properties: StorageTaskPreviewActionProperties;
}
// @public
export interface StorageTaskPreviewActionCondition {
elseBlockExists: boolean;
if: StorageTaskPreviewActionIfCondition;
}
// @public
export interface StorageTaskPreviewActionIfCondition {
condition?: string;
}
// @public
export interface StorageTaskPreviewActionProperties {
action: StorageTaskPreviewActionCondition;
blobs: StorageTaskPreviewBlobProperties[];
container: StorageTaskPreviewContainerProperties;
}
// @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 StorageTaskProperties {
action: StorageTaskAction;
readonly creationTimeInUtc?: Date;
description: string;
enabled: boolean;
readonly provisioningState?: ProvisioningState;
readonly taskVersion?: number;
}
// @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<SimplePollerLike<OperationState<StorageTasksCreateResponse>, StorageTasksCreateResponse>>;
beginCreateAndWait(resourceGroupName: string, storageTaskName: string, parameters: StorageTask, options?: StorageTasksCreateOptionalParams): Promise<StorageTasksCreateResponse>;
beginDelete(resourceGroupName: string, storageTaskName: string, options?: StorageTasksDeleteOptionalParams): Promise<SimplePollerLike<OperationState<StorageTasksDeleteResponse>, StorageTasksDeleteResponse>>;
beginDeleteAndWait(resourceGroupName: string, storageTaskName: string, options?: StorageTasksDeleteOptionalParams): Promise<StorageTasksDeleteResponse>;
beginUpdate(resourceGroupName: string, storageTaskName: string, parameters: StorageTaskUpdateParameters, options?: StorageTasksUpdateOptionalParams): Promise<SimplePollerLike<OperationState<StorageTasksUpdateResponse>, StorageTasksUpdateResponse>>;
beginUpdateAndWait(resourceGroupName: string, storageTaskName: string, parameters: StorageTaskUpdateParameters, options?: StorageTasksUpdateOptionalParams): Promise<StorageTasksUpdateResponse>;
get(resourceGroupName: string, storageTaskName: string, options?: StorageTasksGetOptionalParams): Promise<StorageTasksGetResponse>;
listByResourceGroup(resourceGroupName: string, options?: StorageTasksListByResourceGroupOptionalParams): PagedAsyncIterableIterator<StorageTask>;
listBySubscription(options?: StorageTasksListBySubscriptionOptionalParams): PagedAsyncIterableIterator<StorageTask>;
previewActions(location: string, parameters: StorageTaskPreviewAction, options?: StorageTasksPreviewActionsOptionalParams): Promise<StorageTasksPreviewActionsResponse>;
}
// @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<StorageTaskReportInstance>;
}
// @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 {
identity?: ManagedServiceIdentity;
properties?: StorageTaskProperties;
tags?: {
[propertyName: string]: string;
};
}
// @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)
```

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all of the available Storage Actions Rest API operations.
*
* @summary Lists all of the available Storage Actions Rest API operations.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/OperationsList.json
*/
async function operationsList() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsList();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the given resource group.
*
* @summary Lists all the storage tasks available under the given resource group.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json
*/
async function listStorageTaskAssignmentsByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "rgroup1";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTaskAssignmentOperations.list(
resourceGroupName,
storageTaskName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTaskAssignmentsByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,72 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code 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 {
StorageTask,
StorageActionsManagementClient,
} from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to 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.
*
* @summary 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.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PutStorageTask.json
*/
async function putStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const parameters: StorageTask = {
location: "westus",
properties: {
description: "My Storage task",
action: {
else: {
operations: [
{ name: "DeleteBlob", onFailure: "break", onSuccess: "continue" },
],
},
if: {
condition: "[[equals(AccessTier, 'Cool')]]",
operations: [
{
name: "SetBlobTier",
onFailure: "break",
onSuccess: "continue",
parameters: { tier: "Hot" },
},
],
},
},
enabled: true,
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginCreateAndWait(
resourceGroupName,
storageTaskName,
parameters,
);
console.log(result);
}
async function main() {
putStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete the storage task resource.
*
* @summary Delete the storage task resource.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/DeleteStorageTask.json
*/
async function deleteStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginDeleteAndWait(
resourceGroupName,
storageTaskName,
);
console.log(result);
}
async function main() {
deleteStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get the storage task properties
*
* @summary Get the storage task properties
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json
*/
async function getStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.get(
resourceGroupName,
storageTaskName,
);
console.log(result);
}
async function main() {
getStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the given resource group.
*
* @summary Lists all the storage tasks available under the given resource group.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksByResourceGroup.json
*/
async function listStorageTasksByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res6117";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasks.listByResourceGroup(
resourceGroupName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the subscription.
*
* @summary Lists all the storage tasks available under the subscription.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json
*/
async function listStorageTasksBySubscription() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasks.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksBySubscription();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,90 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code 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 {
StorageTaskPreviewAction,
StorageActionsManagementClient,
} from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Runs the input conditions against input object metadata properties and designates matched objects in response.
*
* @summary Runs the input conditions against input object metadata properties and designates matched objects in response.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/PerformStorageTaskActionsPreview.json
*/
async function performStorageTaskActionsPreview() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const location = "eastus";
const parameters: StorageTaskPreviewAction = {
properties: {
action: {
elseBlockExists: true,
if: { condition: "[[equals(AccessTier, 'Hot')]]" },
},
blobs: [
{
name: "folder1/file1.txt",
metadata: [{ key: "mKey1", value: "mValue1" }],
properties: [
{ key: "Creation-Time", value: "Wed, 07 Jun 2023 05:23:29 GMT" },
{ key: "Last-Modified", value: "Wed, 07 Jun 2023 05:23:29 GMT" },
{ key: "Etag", value: "0x8DB67175454D36D" },
{ key: "Content-Length", value: "38619" },
{ key: "Content-Type", value: "text/xml" },
{ key: "Content-Encoding", value: "" },
{ key: "Content-Language", value: "" },
{ key: "Content-CRC64", value: "" },
{ key: "Content-MD5", value: "njr6iDrmU9+FC89WMK22EA==" },
{ key: "Cache-Control", value: "" },
{ key: "Content-Disposition", value: "" },
{ key: "BlobType", value: "BlockBlob" },
{ key: "AccessTier", value: "Hot" },
{ key: "AccessTierInferred", value: "true" },
{ key: "LeaseStatus", value: "unlocked" },
{ key: "LeaseState", value: "available" },
{ key: "ServerEncrypted", value: "true" },
{ key: "TagCount", value: "1" },
],
tags: [{ key: "tKey1", value: "tValue1" }],
},
{
name: "folder2/file1.txt",
metadata: [{ key: "mKey2", value: "mValue2" }],
properties: [
{ key: "Creation-Time", value: "Wed, 06 Jun 2023 05:23:29 GMT" },
{ key: "Last-Modified", value: "Wed, 06 Jun 2023 05:23:29 GMT" },
{ key: "Etag", value: "0x6FB67175454D36D" },
],
tags: [{ key: "tKey2", value: "tValue2" }],
},
],
container: {
name: "firstContainer",
metadata: [{ key: "mContainerKey1", value: "mContainerValue1" }],
},
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.previewActions(location, parameters);
console.log(result);
}
async function main() {
performStorageTaskActionsPreview();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Fetch the storage tasks run report summary for each assignment.
*
* @summary Fetch the storage tasks run report summary for each assignment.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json
*/
async function listStorageTasksByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "rgroup1";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasksReport.list(
resourceGroupName,
storageTaskName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,71 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code 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 {
StorageTaskUpdateParameters,
StorageActionsManagementClient,
} from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Update storage task properties
*
* @summary Update storage task properties
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PatchStorageTask.json
*/
async function patchStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const parameters: StorageTaskUpdateParameters = {
properties: {
description: "My Storage task",
action: {
else: {
operations: [
{ name: "DeleteBlob", onFailure: "break", onSuccess: "continue" },
],
},
if: {
condition: "[[equals(AccessTier, 'Cool')]]",
operations: [
{
name: "SetBlobTier",
onFailure: "break",
onSuccess: "continue",
parameters: { tier: "Hot" },
},
],
},
},
enabled: true,
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginUpdateAndWait(
resourceGroupName,
storageTaskName,
parameters,
);
console.log(result);
}
async function main() {
patchStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,68 @@
# client library samples for JavaScript (Beta)
These sample programs show how to use the JavaScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [operationsListSample.js][operationslistsample] | Lists all of the available Storage Actions Rest API operations. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/OperationsList.json |
| [storageTaskAssignmentListSample.js][storagetaskassignmentlistsample] | Lists all the storage tasks available under the given resource group. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json |
| [storageTasksCreateSample.js][storagetaskscreatesample] | 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. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PutStorageTask.json |
| [storageTasksDeleteSample.js][storagetasksdeletesample] | Delete the storage task resource. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/DeleteStorageTask.json |
| [storageTasksGetSample.js][storagetasksgetsample] | Get the storage task properties x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json |
| [storageTasksListByResourceGroupSample.js][storagetaskslistbyresourcegroupsample] | Lists all the storage tasks available under the given resource group. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksByResourceGroup.json |
| [storageTasksListBySubscriptionSample.js][storagetaskslistbysubscriptionsample] | Lists all the storage tasks available under the subscription. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json |
| [storageTasksPreviewActionsSample.js][storagetaskspreviewactionssample] | Runs the input conditions against input object metadata properties and designates matched objects in response. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/PerformStorageTaskActionsPreview.json |
| [storageTasksReportListSample.js][storagetasksreportlistsample] | Fetch the storage tasks run report summary for each assignment. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json |
| [storageTasksUpdateSample.js][storagetasksupdatesample] | Update storage task properties x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PatchStorageTask.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
3. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node operationsListSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env STORAGEACTIONS_SUBSCRIPTION_ID="<storageactions subscription id>" node operationsListSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/operationsListSample.js
[storagetaskassignmentlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTaskAssignmentListSample.js
[storagetaskscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTasksCreateSample.js
[storagetasksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTasksDeleteSample.js
[storagetasksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTasksGetSample.js
[storagetaskslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTasksListByResourceGroupSample.js
[storagetaskslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTasksListBySubscriptionSample.js
[storagetaskspreviewactionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTasksPreviewActionsSample.js
[storagetasksreportlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTasksReportListSample.js
[storagetasksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/javascript/storageTasksUpdateSample.js
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storageactions?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storageactions/arm-storageactions/README.md

Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists all of the available Storage Actions Rest API operations.
*
* @summary Lists all of the available Storage Actions Rest API operations.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/OperationsList.json
*/
async function operationsList() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsList();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,32 @@
{
"name": "@azure-samples/arm-storageactions-js-beta",
"private": true,
"version": "1.0.0",
"description": " client library samples for JavaScript (Beta)",
"engines": {
"node": ">=18.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/storageactions/arm-storageactions"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storageactions/arm-storageactions",
"dependencies": {
"@azure/arm-storageactions": "next",
"dotenv": "latest",
"@azure/identity": "^4.0.1"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,42 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the given resource group.
*
* @summary Lists all the storage tasks available under the given resource group.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json
*/
async function listStorageTaskAssignmentsByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName = process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "rgroup1";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTaskAssignmentOperations.list(
resourceGroupName,
storageTaskName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTaskAssignmentsByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,63 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to 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.
*
* @summary 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.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PutStorageTask.json
*/
async function putStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName = process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const parameters = {
location: "westus",
properties: {
description: "My Storage task",
action: {
else: {
operations: [{ name: "DeleteBlob", onFailure: "break", onSuccess: "continue" }],
},
if: {
condition: "[[equals(AccessTier, 'Cool')]]",
operations: [
{
name: "SetBlobTier",
onFailure: "break",
onSuccess: "continue",
parameters: { tier: "Hot" },
},
],
},
},
enabled: true,
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginCreateAndWait(
resourceGroupName,
storageTaskName,
parameters,
);
console.log(result);
}
async function main() {
putStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Delete the storage task resource.
*
* @summary Delete the storage task resource.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/DeleteStorageTask.json
*/
async function deleteStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName = process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginDeleteAndWait(resourceGroupName, storageTaskName);
console.log(result);
}
async function main() {
deleteStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,36 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Get the storage task properties
*
* @summary Get the storage task properties
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json
*/
async function getStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName = process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.get(resourceGroupName, storageTaskName);
console.log(result);
}
async function main() {
getStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,38 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the given resource group.
*
* @summary Lists all the storage tasks available under the given resource group.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksByResourceGroup.json
*/
async function listStorageTasksByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName = process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res6117";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasks.listByResourceGroup(resourceGroupName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the subscription.
*
* @summary Lists all the storage tasks available under the subscription.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json
*/
async function listStorageTasksBySubscription() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasks.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksBySubscription();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,84 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Runs the input conditions against input object metadata properties and designates matched objects in response.
*
* @summary Runs the input conditions against input object metadata properties and designates matched objects in response.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/PerformStorageTaskActionsPreview.json
*/
async function performStorageTaskActionsPreview() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const location = "eastus";
const parameters = {
properties: {
action: {
elseBlockExists: true,
if: { condition: "[[equals(AccessTier, 'Hot')]]" },
},
blobs: [
{
name: "folder1/file1.txt",
metadata: [{ key: "mKey1", value: "mValue1" }],
properties: [
{ key: "Creation-Time", value: "Wed, 07 Jun 2023 05:23:29 GMT" },
{ key: "Last-Modified", value: "Wed, 07 Jun 2023 05:23:29 GMT" },
{ key: "Etag", value: "0x8DB67175454D36D" },
{ key: "Content-Length", value: "38619" },
{ key: "Content-Type", value: "text/xml" },
{ key: "Content-Encoding", value: "" },
{ key: "Content-Language", value: "" },
{ key: "Content-CRC64", value: "" },
{ key: "Content-MD5", value: "njr6iDrmU9+FC89WMK22EA==" },
{ key: "Cache-Control", value: "" },
{ key: "Content-Disposition", value: "" },
{ key: "BlobType", value: "BlockBlob" },
{ key: "AccessTier", value: "Hot" },
{ key: "AccessTierInferred", value: "true" },
{ key: "LeaseStatus", value: "unlocked" },
{ key: "LeaseState", value: "available" },
{ key: "ServerEncrypted", value: "true" },
{ key: "TagCount", value: "1" },
],
tags: [{ key: "tKey1", value: "tValue1" }],
},
{
name: "folder2/file1.txt",
metadata: [{ key: "mKey2", value: "mValue2" }],
properties: [
{ key: "Creation-Time", value: "Wed, 06 Jun 2023 05:23:29 GMT" },
{ key: "Last-Modified", value: "Wed, 06 Jun 2023 05:23:29 GMT" },
{ key: "Etag", value: "0x6FB67175454D36D" },
],
tags: [{ key: "tKey2", value: "tValue2" }],
},
],
container: {
name: "firstContainer",
metadata: [{ key: "mContainerKey1", value: "mContainerValue1" }],
},
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.previewActions(location, parameters);
console.log(result);
}
async function main() {
performStorageTaskActionsPreview();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,39 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Fetch the storage tasks run report summary for each assignment.
*
* @summary Fetch the storage tasks run report summary for each assignment.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json
*/
async function listStorageTasksByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName = process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "rgroup1";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasksReport.list(resourceGroupName, storageTaskName)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,62 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
const { StorageActionsManagementClient } = require("@azure/arm-storageactions");
const { DefaultAzureCredential } = require("@azure/identity");
require("dotenv").config();
/**
* This sample demonstrates how to Update storage task properties
*
* @summary Update storage task properties
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PatchStorageTask.json
*/
async function patchStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] || "1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName = process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const parameters = {
properties: {
description: "My Storage task",
action: {
else: {
operations: [{ name: "DeleteBlob", onFailure: "break", onSuccess: "continue" }],
},
if: {
condition: "[[equals(AccessTier, 'Cool')]]",
operations: [
{
name: "SetBlobTier",
onFailure: "break",
onSuccess: "continue",
parameters: { tier: "Hot" },
},
],
},
},
enabled: true,
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginUpdateAndWait(
resourceGroupName,
storageTaskName,
parameters,
);
console.log(result);
}
async function main() {
patchStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,81 @@
# client library samples for TypeScript (Beta)
These sample programs show how to use the TypeScript client libraries for in some common scenarios.
| **File Name** | **Description** |
| --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [operationsListSample.ts][operationslistsample] | Lists all of the available Storage Actions Rest API operations. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/OperationsList.json |
| [storageTaskAssignmentListSample.ts][storagetaskassignmentlistsample] | Lists all the storage tasks available under the given resource group. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json |
| [storageTasksCreateSample.ts][storagetaskscreatesample] | 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. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PutStorageTask.json |
| [storageTasksDeleteSample.ts][storagetasksdeletesample] | Delete the storage task resource. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/DeleteStorageTask.json |
| [storageTasksGetSample.ts][storagetasksgetsample] | Get the storage task properties x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json |
| [storageTasksListByResourceGroupSample.ts][storagetaskslistbyresourcegroupsample] | Lists all the storage tasks available under the given resource group. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksByResourceGroup.json |
| [storageTasksListBySubscriptionSample.ts][storagetaskslistbysubscriptionsample] | Lists all the storage tasks available under the subscription. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json |
| [storageTasksPreviewActionsSample.ts][storagetaskspreviewactionssample] | Runs the input conditions against input object metadata properties and designates matched objects in response. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/PerformStorageTaskActionsPreview.json |
| [storageTasksReportListSample.ts][storagetasksreportlistsample] | Fetch the storage tasks run report summary for each assignment. x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json |
| [storageTasksUpdateSample.ts][storagetasksupdatesample] | Update storage task properties x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PatchStorageTask.json |
## Prerequisites
The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule).
Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using:
```bash
npm install -g typescript
```
You need [an Azure subscription][freesub] to run these sample programs.
Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package].
## Setup
To run the samples using the published version of the package:
1. Install the dependencies using `npm`:
```bash
npm install
```
2. Compile the samples:
```bash
npm run build
```
3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically.
4. Run whichever samples you like (note that some samples may require additional setup, see the table above):
```bash
node dist/operationsListSample.js
```
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):
```bash
npx cross-env STORAGEACTIONS_SUBSCRIPTION_ID="<storageactions subscription id>" node dist/operationsListSample.js
```
## Next Steps
Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients.
[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/operationsListSample.ts
[storagetaskassignmentlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTaskAssignmentListSample.ts
[storagetaskscreatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTasksCreateSample.ts
[storagetasksdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTasksDeleteSample.ts
[storagetasksgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTasksGetSample.ts
[storagetaskslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTasksListByResourceGroupSample.ts
[storagetaskslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTasksListBySubscriptionSample.ts
[storagetaskspreviewactionssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTasksPreviewActionsSample.ts
[storagetasksreportlistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTasksReportListSample.ts
[storagetasksupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storageactions/arm-storageactions/samples/v1-beta/typescript/src/storageTasksUpdateSample.ts
[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storageactions?view=azure-node-preview
[freesub]: https://azure.microsoft.com/free/
[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storageactions/arm-storageactions/README.md
[typescript]: https://www.typescriptlang.org/docs/home.html

Просмотреть файл

@ -0,0 +1,41 @@
{
"name": "@azure-samples/arm-storageactions-ts-beta",
"private": true,
"version": "1.0.0",
"description": " client library samples for TypeScript (Beta)",
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Azure/azure-sdk-for-js.git",
"directory": "sdk/storageactions/arm-storageactions"
},
"keywords": [
"node",
"azure",
"typescript",
"browser",
"isomorphic"
],
"author": "Microsoft Corporation",
"license": "MIT",
"bugs": {
"url": "https://github.com/Azure/azure-sdk-for-js/issues"
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storageactions/arm-storageactions",
"dependencies": {
"@azure/arm-storageactions": "next",
"dotenv": "latest",
"@azure/identity": "^4.0.1"
},
"devDependencies": {
"@types/node": "^18.0.0",
"typescript": "~5.3.3",
"rimraf": "latest"
}
}

Просмотреть файл

@ -0,0 +1,4 @@
# App registration secret for AAD authentication
AZURE_CLIENT_SECRET=
AZURE_CLIENT_ID=
AZURE_TENANT_ID=

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all of the available Storage Actions Rest API operations.
*
* @summary Lists all of the available Storage Actions Rest API operations.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/OperationsList.json
*/
async function operationsList() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"00000000-0000-0000-0000-000000000000";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.operations.list()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
operationsList();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the given resource group.
*
* @summary Lists all the storage tasks available under the given resource group.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json
*/
async function listStorageTaskAssignmentsByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "rgroup1";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTaskAssignmentOperations.list(
resourceGroupName,
storageTaskName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTaskAssignmentsByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,72 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code 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 {
StorageTask,
StorageActionsManagementClient,
} from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to 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.
*
* @summary 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.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PutStorageTask.json
*/
async function putStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const parameters: StorageTask = {
location: "westus",
properties: {
description: "My Storage task",
action: {
else: {
operations: [
{ name: "DeleteBlob", onFailure: "break", onSuccess: "continue" },
],
},
if: {
condition: "[[equals(AccessTier, 'Cool')]]",
operations: [
{
name: "SetBlobTier",
onFailure: "break",
onSuccess: "continue",
parameters: { tier: "Hot" },
},
],
},
},
enabled: true,
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginCreateAndWait(
resourceGroupName,
storageTaskName,
parameters,
);
console.log(result);
}
async function main() {
putStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Delete the storage task resource.
*
* @summary Delete the storage task resource.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/DeleteStorageTask.json
*/
async function deleteStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginDeleteAndWait(
resourceGroupName,
storageTaskName,
);
console.log(result);
}
async function main() {
deleteStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,43 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Get the storage task properties
*
* @summary Get the storage task properties
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/GetStorageTask.json
*/
async function getStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.get(
resourceGroupName,
storageTaskName,
);
console.log(result);
}
async function main() {
getStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,44 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the given resource group.
*
* @summary Lists all the storage tasks available under the given resource group.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksByResourceGroup.json
*/
async function listStorageTasksByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res6117";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasks.listByResourceGroup(
resourceGroupName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,40 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Lists all the storage tasks available under the subscription.
*
* @summary Lists all the storage tasks available under the subscription.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json
*/
async function listStorageTasksBySubscription() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasks.listBySubscription()) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksBySubscription();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,90 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code 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 {
StorageTaskPreviewAction,
StorageActionsManagementClient,
} from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Runs the input conditions against input object metadata properties and designates matched objects in response.
*
* @summary Runs the input conditions against input object metadata properties and designates matched objects in response.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/misc/PerformStorageTaskActionsPreview.json
*/
async function performStorageTaskActionsPreview() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const location = "eastus";
const parameters: StorageTaskPreviewAction = {
properties: {
action: {
elseBlockExists: true,
if: { condition: "[[equals(AccessTier, 'Hot')]]" },
},
blobs: [
{
name: "folder1/file1.txt",
metadata: [{ key: "mKey1", value: "mValue1" }],
properties: [
{ key: "Creation-Time", value: "Wed, 07 Jun 2023 05:23:29 GMT" },
{ key: "Last-Modified", value: "Wed, 07 Jun 2023 05:23:29 GMT" },
{ key: "Etag", value: "0x8DB67175454D36D" },
{ key: "Content-Length", value: "38619" },
{ key: "Content-Type", value: "text/xml" },
{ key: "Content-Encoding", value: "" },
{ key: "Content-Language", value: "" },
{ key: "Content-CRC64", value: "" },
{ key: "Content-MD5", value: "njr6iDrmU9+FC89WMK22EA==" },
{ key: "Cache-Control", value: "" },
{ key: "Content-Disposition", value: "" },
{ key: "BlobType", value: "BlockBlob" },
{ key: "AccessTier", value: "Hot" },
{ key: "AccessTierInferred", value: "true" },
{ key: "LeaseStatus", value: "unlocked" },
{ key: "LeaseState", value: "available" },
{ key: "ServerEncrypted", value: "true" },
{ key: "TagCount", value: "1" },
],
tags: [{ key: "tKey1", value: "tValue1" }],
},
{
name: "folder2/file1.txt",
metadata: [{ key: "mKey2", value: "mValue2" }],
properties: [
{ key: "Creation-Time", value: "Wed, 06 Jun 2023 05:23:29 GMT" },
{ key: "Last-Modified", value: "Wed, 06 Jun 2023 05:23:29 GMT" },
{ key: "Etag", value: "0x6FB67175454D36D" },
],
tags: [{ key: "tKey2", value: "tValue2" }],
},
],
container: {
name: "firstContainer",
metadata: [{ key: "mContainerKey1", value: "mContainerValue1" }],
},
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.previewActions(location, parameters);
console.log(result);
}
async function main() {
performStorageTaskActionsPreview();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,46 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
*/
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { StorageActionsManagementClient } from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Fetch the storage tasks run report summary for each assignment.
*
* @summary Fetch the storage tasks run report summary for each assignment.
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json
*/
async function listStorageTasksByResourceGroup() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "rgroup1";
const storageTaskName = "mytask1";
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.storageTasksReport.list(
resourceGroupName,
storageTaskName,
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main() {
listStorageTasksByResourceGroup();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,71 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the MIT License.
*
* Code generated by Microsoft (R) AutoRest Code 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 {
StorageTaskUpdateParameters,
StorageActionsManagementClient,
} from "@azure/arm-storageactions";
import { DefaultAzureCredential } from "@azure/identity";
import * as dotenv from "dotenv";
dotenv.config();
/**
* This sample demonstrates how to Update storage task properties
*
* @summary Update storage task properties
* x-ms-original-file: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksCrud/PatchStorageTask.json
*/
async function patchStorageTask() {
const subscriptionId =
process.env["STORAGEACTIONS_SUBSCRIPTION_ID"] ||
"1f31ba14-ce16-4281-b9b4-3e78da6e1616";
const resourceGroupName =
process.env["STORAGEACTIONS_RESOURCE_GROUP"] || "res4228";
const storageTaskName = "mytask1";
const parameters: StorageTaskUpdateParameters = {
properties: {
description: "My Storage task",
action: {
else: {
operations: [
{ name: "DeleteBlob", onFailure: "break", onSuccess: "continue" },
],
},
if: {
condition: "[[equals(AccessTier, 'Cool')]]",
operations: [
{
name: "SetBlobTier",
onFailure: "break",
onSuccess: "continue",
parameters: { tier: "Hot" },
},
],
},
},
enabled: true,
},
};
const credential = new DefaultAzureCredential();
const client = new StorageActionsManagementClient(credential, subscriptionId);
const result = await client.storageTasks.beginUpdateAndWait(
resourceGroupName,
storageTaskName,
parameters,
);
console.log(result);
}
async function main() {
patchStorageTask();
}
main().catch(console.error);

Просмотреть файл

@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"alwaysStrict": true,
"outDir": "dist",
"rootDir": "src"
},
"include": [
"src/**.ts"
]
}

Просмотреть файл

@ -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.
*/
/// <reference lib="esnext.asynciterable" />
export { getContinuationToken } from "./pagingHelper";
export * from "./models";
export { StorageActionsManagementClient } from "./storageActionsManagementClient";
export * from "./operationsInterfaces";

Просмотреть файл

@ -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<T>(inputs: {
sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>;
args: Record<string, unknown>;
spec: {
readonly requestBody?: unknown;
readonly path?: string;
readonly httpMethod: string;
} & Record<string, any>;
}): LongRunningOperation<T> {
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,
});
},
};
}

Просмотреть файл

@ -0,0 +1,818 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the 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<string, unknown>;
}
/** 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;
}
/** Properties of the storage task. */
export interface StorageTaskProperties {
/**
* 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 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 };
/** Properties of the storage task. */
properties?: StorageTaskProperties;
}
/** 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 {
/** Properties of the storage task preview. */
properties: StorageTaskPreviewActionProperties;
}
/** Storage task preview action properties. */
export interface StorageTaskPreviewActionProperties {
/** 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;
/** Properties of the storage task. */
properties?: StorageTaskProperties;
}
/** 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;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -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",
},
},
};

Просмотреть файл

@ -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";

Просмотреть файл

@ -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";
/// <reference lib="esnext.asynciterable" />
/** 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<Operation> {
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<Operation[]> {
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<Operation> {
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<OperationsListResponse> {
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<OperationsListNextResponse> {
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,
};

Просмотреть файл

@ -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";
/// <reference lib="esnext.asynciterable" />
/** 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<StorageTaskAssignment> {
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<StorageTaskAssignment[]> {
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<StorageTaskAssignment> {
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<StorageTaskAssignmentListResponse> {
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<StorageTaskAssignmentListNextResponse> {
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,
};

Просмотреть файл

@ -0,0 +1,791 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the 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";
/// <reference lib="esnext.asynciterable" />
/** 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<StorageTask> {
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<StorageTask[]> {
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<StorageTask> {
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<StorageTask> {
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<StorageTask[]> {
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<StorageTask> {
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>,
StorageTasksCreateResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<StorageTasksCreateResponse> => {
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<StorageTasksCreateResponse>
>(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<StorageTasksCreateResponse> {
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>,
StorageTasksDeleteResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<StorageTasksDeleteResponse> => {
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<StorageTasksDeleteResponse>
>(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<StorageTasksDeleteResponse> {
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<StorageTasksGetResponse> {
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>,
StorageTasksUpdateResponse
>
> {
const directSendOperation = async (
args: coreClient.OperationArguments,
spec: coreClient.OperationSpec,
): Promise<StorageTasksUpdateResponse> => {
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<StorageTasksUpdateResponse>
>(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<StorageTasksUpdateResponse> {
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<StorageTasksListBySubscriptionResponse> {
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<StorageTasksListByResourceGroupResponse> {
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<StorageTasksPreviewActionsResponse> {
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<StorageTasksListBySubscriptionNextResponse> {
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<StorageTasksListByResourceGroupNextResponse> {
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,
};

Просмотреть файл

@ -0,0 +1,207 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the 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";
/// <reference lib="esnext.asynciterable" />
/** 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<StorageTaskReportInstance> {
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<StorageTaskReportInstance[]> {
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<StorageTaskReportInstance> {
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<StorageTasksReportListResponse> {
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<StorageTasksReportListNextResponse> {
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,
};

Просмотреть файл

@ -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";

Просмотреть файл

@ -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";
/// <reference lib="esnext.asynciterable" />
/** 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<Operation>;
}

Просмотреть файл

@ -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";
/// <reference lib="esnext.asynciterable" />
/** 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<StorageTaskAssignment>;
}

Просмотреть файл

@ -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";
/// <reference lib="esnext.asynciterable" />
/** 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<StorageTask>;
/**
* 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<StorageTask>;
/**
* 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>,
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<StorageTasksCreateResponse>;
/**
* 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>,
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<StorageTasksDeleteResponse>;
/**
* 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<StorageTasksGetResponse>;
/**
* 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>,
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<StorageTasksUpdateResponse>;
/**
* 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<StorageTasksPreviewActionsResponse>;
}

Просмотреть файл

@ -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";
/// <reference lib="esnext.asynciterable" />
/** 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<StorageTaskReportInstance>;
}

Просмотреть файл

@ -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<object, PageInfo>();
/**
* 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);
}

Просмотреть файл

@ -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-beta.1`;
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<PipelineResponse> {
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;
}

Просмотреть файл

@ -0,0 +1,121 @@
/*
* Copyright (c) Microsoft Corporation.
* Licensed under the 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 {
env,
Recorder,
RecorderStartOptions,
delay,
isPlaybackMode,
} from "@azure-tools/test-recorder";
import { createTestCredential } from "@azure-tools/test-credential";
import { assert } from "chai";
import { Context } from "mocha";
import { StorageActionsManagementClient } from "../src/storageActionsManagementClient";
const replaceableVariables: Record<string, string> = {
AZURE_CLIENT_ID: "azure_client_id",
AZURE_CLIENT_SECRET: "azure_client_secret",
AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888",
SUBSCRIPTION_ID: "88888888-8888-8888-8888-888888888888"
};
const recorderOptions: RecorderStartOptions = {
envSetupForPlayback: replaceableVariables
};
export const testPollingOptions = {
updateIntervalInMs: isPlaybackMode() ? 0 : undefined,
};
describe("StorageActions test", () => {
let recorder: Recorder;
let subscriptionId: string;
let client: StorageActionsManagementClient;
let location: string;
let resourceGroup: string;
let resourcename: string;
beforeEach(async function (this: Context) {
recorder = new Recorder(this.currentTest);
await recorder.start(recorderOptions);
subscriptionId = env.SUBSCRIPTION_ID || '';
// This is an example of how the environment variables are used
const credential = createTestCredential();
client = new StorageActionsManagementClient(credential, subscriptionId, recorder.configureClientOptions({}));
location = "eastus2euap";
resourceGroup = "myjstest";
resourcename = "resourcetest";
});
afterEach(async function () {
await recorder.stop();
});
it("storageTasks create test", async function () {
const res = await client.storageTasks.beginCreateAndWait(
resourceGroup,
resourcename,
{
identity: {
type: "SystemAssigned"
},
location,
properties: {
description: "My Storage task",
action: {
else: {
operations: [
{ name: "DeleteBlob", onFailure: "break", onSuccess: "continue" },
],
},
if: {
condition: "[[equals(AccessTier, 'Cool')]]",
operations: [
{
name: "SetBlobTier",
onFailure: "break",
onSuccess: "continue",
parameters: { tier: "Hot" },
},
],
},
},
enabled: true,
},
},
testPollingOptions);
assert.equal(res.name, resourcename);
});
it("storageTasks get test", async function () {
const res = await client.storageTasks.get(
resourceGroup,
resourcename);
assert.equal(res.name, resourcename);
});
it("storageTasks list test", async function () {
const resArray = new Array();
for await (let item of client.storageTasks.listByResourceGroup(resourceGroup)) {
resArray.push(item);
}
assert.equal(resArray.length, 1);
});
it("storageTasks delete test", async function () {
const resArray = new Array();
const res = await client.storageTasks.beginDeleteAndWait(resourceGroup, resourcename
)
for await (let item of client.storageTasks.listByResourceGroup(resourceGroup)) {
resArray.push(item);
}
assert.equal(resArray.length, 0);
});
})

Просмотреть файл

@ -0,0 +1,33 @@
{
"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,
"paths": {
"@azure/arm-storageactions": [
"./src/index"
]
}
},
"include": [
"./src/**/*.ts",
"./test/**/*.ts",
"samples-dev/**/*.ts"
],
"exclude": [
"node_modules"
]
}

Просмотреть файл

@ -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