diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 0a554e9578c8..25a732ebb3b4 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -63,6 +63,7 @@ specifiers: '@rush-temp/arm-sql': file:./projects/arm-sql.tgz '@rush-temp/arm-sqlvirtualmachine': file:./projects/arm-sqlvirtualmachine.tgz '@rush-temp/arm-storage': file:./projects/arm-storage.tgz + '@rush-temp/arm-storagecache': file:./projects/arm-storagecache.tgz '@rush-temp/arm-streamanalytics': file:./projects/arm-streamanalytics.tgz '@rush-temp/arm-templatespecs': file:./projects/arm-templatespecs.tgz '@rush-temp/arm-videoanalyzer': file:./projects/arm-videoanalyzer.tgz @@ -232,6 +233,7 @@ dependencies: '@rush-temp/arm-sql': file:projects/arm-sql.tgz '@rush-temp/arm-sqlvirtualmachine': file:projects/arm-sqlvirtualmachine.tgz '@rush-temp/arm-storage': file:projects/arm-storage.tgz + '@rush-temp/arm-storagecache': file:projects/arm-storagecache.tgz '@rush-temp/arm-streamanalytics': file:projects/arm-streamanalytics.tgz '@rush-temp/arm-templatespecs': file:projects/arm-templatespecs.tgz '@rush-temp/arm-videoanalyzer': file:projects/arm-videoanalyzer.tgz @@ -1661,6 +1663,7 @@ packages: /@opentelemetry/node/0.22.0_@opentelemetry+api@1.0.3: resolution: {integrity: sha512-+HhGbDruQ7cwejVOIYyxRa28uosnG8W95NiQZ6qE8PXXPsDSyGeftAPbtYpGit0H2f5hrVcMlwmWHeAo9xkSLA==} engines: {node: '>=8.0.0'} + deprecated: Package renamed to @opentelemetry/sdk-trace-node peerDependencies: '@opentelemetry/api': ^1.0.0 dependencies: @@ -9830,6 +9833,27 @@ packages: uglify-js: 3.14.3 dev: false + file:projects/arm-storagecache.tgz: + resolution: {integrity: sha512-4X1hUa8AptC8GdjwZuXzTraOOm6q1gREy55+NdO/gwi/1gAWqOjwhxJ2+IJuJ5RiNqvcSwsZbolFte/K4OJovw==, tarball: file:projects/arm-storagecache.tgz} + name: '@rush-temp/arm-storagecache' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.18.19 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.3 + dev: false + file:projects/arm-streamanalytics.tgz: resolution: {integrity: sha512-MhbiHP5ZomEoVlRa9KOHteLHqPOvxZfszSEZ0JgUowO9APTWrir2HLd1R+bHBpX3myNuOGV0yRtk1x661KVLgg==, tarball: file:projects/arm-streamanalytics.tgz} name: '@rush-temp/arm-streamanalytics' diff --git a/rush.json b/rush.json index a7e20ebf1c9d..7ce511c6b07f 100644 --- a/rush.json +++ b/rush.json @@ -1155,6 +1155,11 @@ "packageName": "@azure/arm-loadtestservice", "projectFolder": "sdk/loadtestservice/arm-loadtestservice", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-storagecache", + "projectFolder": "sdk/storagecache/arm-storagecache", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/CHANGELOG.md b/sdk/storagecache/arm-storagecache/CHANGELOG.md new file mode 100644 index 000000000000..e4501f4448ac --- /dev/null +++ b/sdk/storagecache/arm-storagecache/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 5.0.0 (2021-12-09) + +The package of @azure/arm-storagecache is using our next generation design principles since version 5.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/storagecache/arm-storagecache/LICENSE.txt b/sdk/storagecache/arm-storagecache/LICENSE similarity index 99% rename from sdk/storagecache/arm-storagecache/LICENSE.txt rename to sdk/storagecache/arm-storagecache/LICENSE index 2d3163745319..ccb63b166732 100644 --- a/sdk/storagecache/arm-storagecache/LICENSE.txt +++ b/sdk/storagecache/arm-storagecache/LICENSE @@ -18,4 +18,4 @@ 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. +SOFTWARE. \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/README.md b/sdk/storagecache/arm-storagecache/README.md index 067211e82e77..32ecbf5800f0 100644 --- a/sdk/storagecache/arm-storagecache/README.md +++ b/sdk/storagecache/arm-storagecache/README.md @@ -1,98 +1,98 @@ -## Azure StorageCacheManagementClient SDK for JavaScript +# Azure StorageCacheManagement client library for JavaScript -This package contains an isomorphic SDK for StorageCacheManagementClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure StorageCacheManagement client. + +A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagecache/arm-storagecache) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-storagecache) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-storagecache) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-storagecache` package -### How to Install +Install the Azure StorageCacheManagement client library for JavaScript with `npm`: ```bash npm install @azure/arm-storagecache ``` -### How to use +### Create and authenticate a `StorageCacheManagementClient` -#### nodejs - client creation and list operations as an example written in TypeScript. +To create a client object to access the Azure StorageCacheManagement API, you will need the `endpoint` of your Azure StorageCacheManagement resource and a `credential`. The Azure StorageCacheManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure StorageCacheManagement resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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: -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. ```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure StorageCacheManagement** 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). -While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package -```typescript -const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +```javascript const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new StorageCacheManagementClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new StorageCacheManagementClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and list operations as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth -``` +## Key concepts + +### StorageCacheManagementClient -##### Sample code - -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-storagecache sample - - - - - - - - +`StorageCacheManagementClient` is the primary interface for developers using the Azure StorageCacheManagement client library. Explore the methods on this client object to understand the different features of the Azure StorageCacheManagement 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) +- [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%2Fstoragecache%2Farm-storagecache%2FREADME.png) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/storagecache/arm-storagecache/README.png) +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/storagecache/arm-storagecache/_meta.json b/sdk/storagecache/arm-storagecache/_meta.json new file mode 100644 index 000000000000..35143a5c924c --- /dev/null +++ b/sdk/storagecache/arm-storagecache/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "16fc4eda1089d72f6ca94e9251c4ccf6a173337b", + "readme": "specification/storagecache/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/storagecache/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" +} \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/api-extractor.json b/sdk/storagecache/arm-storagecache/api-extractor.json new file mode 100644 index 000000000000..a11923871dda --- /dev/null +++ b/sdk/storagecache/arm-storagecache/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$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-storagecache.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/storagecache/arm-storagecache/package.json b/sdk/storagecache/arm-storagecache/package.json index be9abbe053c5..1c856ef68a1d 100644 --- a/sdk/storagecache/arm-storagecache/package.json +++ b/sdk/storagecache/arm-storagecache/package.json @@ -1,57 +1,91 @@ { "name": "@azure/arm-storagecache", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "StorageCacheManagementClient Library with typescript type definitions for node.js and browser.", - "version": "4.0.0", + "description": "A generated SDK for StorageCacheManagementClient.", + "version": "5.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-storagecache.js", - "module": "./esm/storageCacheManagementClient.js", - "types": "./esm/storageCacheManagementClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-storagecache.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagecache/arm-storagecache", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-storagecache.js.map'\" -o ./dist/arm-storagecache.min.js ./dist/arm-storagecache.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf 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": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, "autoPublish": true diff --git a/sdk/storagecache/arm-storagecache/review/arm-storagecache.api.md b/sdk/storagecache/arm-storagecache/review/arm-storagecache.api.md new file mode 100644 index 000000000000..04b251a01182 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/review/arm-storagecache.api.md @@ -0,0 +1,892 @@ +## API Report File for "@azure/arm-storagecache" + +> 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 { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export interface ApiOperation { + display?: ApiOperationDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; + serviceSpecification?: ApiOperationPropertiesServiceSpecification; +} + +// @public +export interface ApiOperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface ApiOperationListResult { + nextLink?: string; + value?: ApiOperation[]; +} + +// @public +export interface ApiOperationPropertiesServiceSpecification { + metricSpecifications?: MetricSpecification[]; +} + +// @public +export interface AscOperation { + endTime?: string; + error?: ErrorResponse; + id?: string; + name?: string; + output?: { + [propertyName: string]: Record; + }; + startTime?: string; + status?: string; +} + +// @public +export interface AscOperations { + get(location: string, operationId: string, options?: AscOperationsGetOptionalParams): Promise; +} + +// @public +export interface AscOperationsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AscOperationsGetResponse = AscOperation; + +// @public +export interface BlobNfsTarget { + target?: string; + usageModel?: string; +} + +// @public +interface Cache_2 { + cacheSizeGB?: number; + directoryServicesSettings?: CacheDirectorySettings; + encryptionSettings?: CacheEncryptionSettings; + readonly health?: CacheHealth; + readonly id?: string; + identity?: CacheIdentity; + location?: string; + readonly mountAddresses?: string[]; + readonly name?: string; + networkSettings?: CacheNetworkSettings; + readonly provisioningState?: ProvisioningStateType; + securitySettings?: CacheSecuritySettings; + sku?: CacheSku; + subnet?: string; + readonly systemData?: SystemData; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; + readonly upgradeStatus?: CacheUpgradeStatus; + zones?: string[]; +} +export { Cache_2 as Cache } + +// @public +export interface CacheActiveDirectorySettings { + cacheNetBiosName: string; + credentials?: CacheActiveDirectorySettingsCredentials; + readonly domainJoined?: DomainJoinedType; + domainName: string; + domainNetBiosName: string; + primaryDnsIpAddress: string; + secondaryDnsIpAddress?: string; +} + +// @public +export interface CacheActiveDirectorySettingsCredentials { + password: string; + username: string; +} + +// @public +export interface CacheDirectorySettings { + activeDirectory?: CacheActiveDirectorySettings; + usernameDownload?: CacheUsernameDownloadSettings; +} + +// @public +export interface CacheEncryptionSettings { + keyEncryptionKey?: KeyVaultKeyReference; + rotationToLatestKeyVersionEnabled?: boolean; +} + +// @public +export interface CacheHealth { + readonly conditions?: Condition[]; + state?: HealthStateType; + statusDescription?: string; +} + +// @public +export interface CacheIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: CacheIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentitiesValue; + }; +} + +// @public +export type CacheIdentityType = "SystemAssigned" | "UserAssigned" | "SystemAssigned, UserAssigned" | "None"; + +// @public +export interface CacheNetworkSettings { + dnsSearchDomain?: string; + dnsServers?: string[]; + mtu?: number; + ntpServer?: string; + readonly utilityAddresses?: string[]; +} + +// @public +export interface Caches { + beginCreateOrUpdate(resourceGroupName: string, cacheName: string, options?: CachesCreateOrUpdateOptionalParams): Promise, CachesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, cacheName: string, options?: CachesCreateOrUpdateOptionalParams): Promise; + beginDebugInfo(resourceGroupName: string, cacheName: string, options?: CachesDebugInfoOptionalParams): Promise, void>>; + beginDebugInfoAndWait(resourceGroupName: string, cacheName: string, options?: CachesDebugInfoOptionalParams): Promise; + beginDelete(resourceGroupName: string, cacheName: string, options?: CachesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, cacheName: string, options?: CachesDeleteOptionalParams): Promise; + beginFlush(resourceGroupName: string, cacheName: string, options?: CachesFlushOptionalParams): Promise, void>>; + beginFlushAndWait(resourceGroupName: string, cacheName: string, options?: CachesFlushOptionalParams): Promise; + beginStart(resourceGroupName: string, cacheName: string, options?: CachesStartOptionalParams): Promise, void>>; + beginStartAndWait(resourceGroupName: string, cacheName: string, options?: CachesStartOptionalParams): Promise; + beginStop(resourceGroupName: string, cacheName: string, options?: CachesStopOptionalParams): Promise, void>>; + beginStopAndWait(resourceGroupName: string, cacheName: string, options?: CachesStopOptionalParams): Promise; + beginUpgradeFirmware(resourceGroupName: string, cacheName: string, options?: CachesUpgradeFirmwareOptionalParams): Promise, void>>; + beginUpgradeFirmwareAndWait(resourceGroupName: string, cacheName: string, options?: CachesUpgradeFirmwareOptionalParams): Promise; + get(resourceGroupName: string, cacheName: string, options?: CachesGetOptionalParams): Promise; + list(options?: CachesListOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: CachesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, cacheName: string, options?: CachesUpdateOptionalParams): Promise; +} + +// @public +export interface CachesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + cache?: Cache_2; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CachesCreateOrUpdateResponse = Cache_2; + +// @public +export interface CachesDebugInfoOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CachesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CacheSecuritySettings { + accessPolicies?: NfsAccessPolicy[]; +} + +// @public +export interface CachesFlushOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CachesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesGetResponse = Cache_2; + +// @public +export interface CacheSku { + name?: string; +} + +// @public +export interface CachesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesListByResourceGroupNextResponse = CachesListResult; + +// @public +export interface CachesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesListByResourceGroupResponse = CachesListResult; + +// @public +export interface CachesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesListNextResponse = CachesListResult; + +// @public +export interface CachesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesListResponse = CachesListResult; + +// @public +export interface CachesListResult { + nextLink?: string; + value?: Cache_2[]; +} + +// @public +export interface CachesStartOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CachesStopOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CachesUpdateOptionalParams extends coreClient.OperationOptions { + cache?: Cache_2; +} + +// @public +export type CachesUpdateResponse = Cache_2; + +// @public +export interface CachesUpgradeFirmwareOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CacheUpgradeStatus { + readonly currentFirmwareVersion?: string; + readonly firmwareUpdateDeadline?: Date; + readonly firmwareUpdateStatus?: FirmwareStatusType; + readonly lastFirmwareUpdate?: Date; + readonly pendingFirmwareVersion?: string; +} + +// @public +export interface CacheUsernameDownloadSettings { + autoDownloadCertificate?: boolean; + caCertificateURI?: string; + credentials?: CacheUsernameDownloadSettingsCredentials; + encryptLdapConnection?: boolean; + extendedGroups?: boolean; + groupFileURI?: string; + ldapBaseDN?: string; + ldapServer?: string; + requireValidCertificate?: boolean; + userFileURI?: string; + readonly usernameDownloaded?: UsernameDownloadedType; + usernameSource?: UsernameSource; +} + +// @public +export interface CacheUsernameDownloadSettingsCredentials { + bindDn?: string; + bindPassword?: string; +} + +// @public +export interface ClfsTarget { + target?: string; +} + +// @public +export interface CloudError { + error?: CloudErrorBody; +} + +// @public +export interface CloudErrorBody { + code?: string; + details?: CloudErrorBody[]; + message?: string; + target?: string; +} + +// @public +export interface Condition { + readonly message?: string; + readonly timestamp?: Date; +} + +// @public +export type CreatedByType = string; + +// @public +export type DomainJoinedType = string; + +// @public +export interface ErrorResponse { + code?: string; + message?: string; +} + +// @public +export type FirmwareStatusType = string; + +// @public +export type HealthStateType = string; + +// @public +export interface KeyVaultKeyReference { + keyUrl: string; + sourceVault: KeyVaultKeyReferenceSourceVault; +} + +// @public +export interface KeyVaultKeyReferenceSourceVault { + id?: string; +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownDomainJoinedType { + // (undocumented) + Error = "Error", + // (undocumented) + No = "No", + // (undocumented) + Yes = "Yes" +} + +// @public +export enum KnownFirmwareStatusType { + // (undocumented) + Available = "available", + // (undocumented) + Unavailable = "unavailable" +} + +// @public +export enum KnownHealthStateType { + // (undocumented) + Degraded = "Degraded", + // (undocumented) + Down = "Down", + // (undocumented) + Flushing = "Flushing", + // (undocumented) + Healthy = "Healthy", + // (undocumented) + Stopped = "Stopped", + // (undocumented) + Stopping = "Stopping", + // (undocumented) + Transitioning = "Transitioning", + // (undocumented) + Unknown = "Unknown", + // (undocumented) + Upgrading = "Upgrading" +} + +// @public +export enum KnownMetricAggregationType { + // (undocumented) + Average = "Average", + // (undocumented) + Count = "Count", + // (undocumented) + Maximum = "Maximum", + // (undocumented) + Minimum = "Minimum", + // (undocumented) + None = "None", + // (undocumented) + NotSpecified = "NotSpecified", + // (undocumented) + Total = "Total" +} + +// @public +export enum KnownNfsAccessRuleAccess { + // (undocumented) + No = "no", + // (undocumented) + Ro = "ro", + // (undocumented) + Rw = "rw" +} + +// @public +export enum KnownNfsAccessRuleScope { + // (undocumented) + Default = "default", + // (undocumented) + Host = "host", + // (undocumented) + Network = "network" +} + +// @public +export enum KnownOperationalStateType { + // (undocumented) + Busy = "Busy", + // (undocumented) + Flushing = "Flushing", + // (undocumented) + Ready = "Ready", + // (undocumented) + Suspended = "Suspended" +} + +// @public +export enum KnownProvisioningStateType { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownReasonCode { + // (undocumented) + NotAvailableForSubscription = "NotAvailableForSubscription", + // (undocumented) + QuotaId = "QuotaId" +} + +// @public +export enum KnownStorageTargetType { + // (undocumented) + BlobNfs = "blobNfs", + // (undocumented) + Clfs = "clfs", + // (undocumented) + Nfs3 = "nfs3", + // (undocumented) + Unknown = "unknown" +} + +// @public +export enum KnownUsernameDownloadedType { + // (undocumented) + Error = "Error", + // (undocumented) + No = "No", + // (undocumented) + Yes = "Yes" +} + +// @public +export enum KnownUsernameSource { + // (undocumented) + AD = "AD", + // (undocumented) + File = "File", + // (undocumented) + Ldap = "LDAP", + // (undocumented) + None = "None" +} + +// @public +export type MetricAggregationType = string; + +// @public +export interface MetricDimension { + displayName?: string; + internalName?: string; + name?: string; + toBeExportedForShoebox?: boolean; +} + +// @public +export interface MetricSpecification { + aggregationType?: string; + dimensions?: MetricDimension[]; + displayDescription?: string; + displayName?: string; + metricClass?: string; + name?: string; + supportedAggregationTypes?: MetricAggregationType[]; + unit?: string; +} + +// @public +export interface NamespaceJunction { + namespacePath?: string; + nfsAccessPolicy?: string; + nfsExport?: string; + targetPath?: string; +} + +// @public +export interface Nfs3Target { + target?: string; + usageModel?: string; +} + +// @public +export interface NfsAccessPolicy { + accessRules: NfsAccessRule[]; + name: string; +} + +// @public +export interface NfsAccessRule { + access: NfsAccessRuleAccess; + anonymousGID?: string; + anonymousUID?: string; + filter?: string; + rootSquash?: boolean; + scope: NfsAccessRuleScope; + submountAccess?: boolean; + suid?: boolean; +} + +// @public +export type NfsAccessRuleAccess = string; + +// @public +export type NfsAccessRuleScope = string; + +// @public +export type OperationalStateType = string; + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = ApiOperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = ApiOperationListResult; + +// @public +export type ProvisioningStateType = string; + +// @public +export type ReasonCode = string; + +// @public +export interface ResourceSku { + capabilities?: ResourceSkuCapabilities[]; + locationInfo?: ResourceSkuLocationInfo[]; + readonly locations?: string[]; + name?: string; + readonly resourceType?: string; + restrictions?: Restriction[]; +} + +// @public +export interface ResourceSkuCapabilities { + name?: string; + value?: string; +} + +// @public +export interface ResourceSkuLocationInfo { + location?: string; + zones?: string[]; +} + +// @public +export interface ResourceSkusResult { + nextLink?: string; + readonly value?: ResourceSku[]; +} + +// @public +export interface Restriction { + reasonCode?: ReasonCode; + readonly type?: string; + readonly values?: string[]; +} + +// @public +export interface Skus { + list(options?: SkusListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SkusListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SkusListNextResponse = ResourceSkusResult; + +// @public +export interface SkusListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SkusListResponse = ResourceSkusResult; + +// @public (undocumented) +export class StorageCacheManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: StorageCacheManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + ascOperations: AscOperations; + // (undocumented) + caches: Caches; + // (undocumented) + operations: Operations; + // (undocumented) + skus: Skus; + // (undocumented) + storageTargetOperations: StorageTargetOperations; + // (undocumented) + storageTargets: StorageTargets; + // (undocumented) + subscriptionId: string; + // (undocumented) + usageModels: UsageModels; +} + +// @public +export interface StorageCacheManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type StorageTarget = StorageTargetResource & { + junctions?: NamespaceJunction[]; + targetType?: StorageTargetType; + readonly provisioningState?: ProvisioningStateType; + state?: OperationalStateType; + nfs3?: Nfs3Target; + clfs?: ClfsTarget; + unknown?: UnknownTarget; + blobNfs?: BlobNfsTarget; +}; + +// @public +export interface StorageTargetFlushOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargetInvalidateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargetOperations { + beginFlush(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetFlushOptionalParams): Promise, void>>; + beginFlushAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetFlushOptionalParams): Promise; + beginInvalidate(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetInvalidateOptionalParams): Promise, void>>; + beginInvalidateAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetInvalidateOptionalParams): Promise; + beginResume(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetResumeOptionalParams): Promise, void>>; + beginResumeAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetResumeOptionalParams): Promise; + beginSuspend(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetSuspendOptionalParams): Promise, void>>; + beginSuspendAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetSuspendOptionalParams): Promise; +} + +// @public +export interface StorageTargetResource { + readonly id?: string; + readonly location?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface StorageTargetResumeOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargets { + beginCreateOrUpdate(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsCreateOrUpdateOptionalParams): Promise, StorageTargetsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsDeleteOptionalParams): Promise; + beginDnsRefresh(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsDnsRefreshOptionalParams): Promise, void>>; + beginDnsRefreshAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsDnsRefreshOptionalParams): Promise; + get(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsGetOptionalParams): Promise; + listByCache(resourceGroupName: string, cacheName: string, options?: StorageTargetsListByCacheOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface StorageTargetsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + storagetarget?: StorageTarget; + updateIntervalInMs?: number; +} + +// @public +export type StorageTargetsCreateOrUpdateResponse = StorageTarget; + +// @public +export interface StorageTargetsDeleteOptionalParams extends coreClient.OperationOptions { + force?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargetsDnsRefreshOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargetsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTargetsGetResponse = StorageTarget; + +// @public +export interface StorageTargetsListByCacheNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTargetsListByCacheNextResponse = StorageTargetsResult; + +// @public +export interface StorageTargetsListByCacheOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTargetsListByCacheResponse = StorageTargetsResult; + +// @public +export interface StorageTargetsResult { + nextLink?: string; + value?: StorageTarget[]; +} + +// @public +export interface StorageTargetSuspendOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type StorageTargetType = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface UnknownTarget { + attributes?: { + [propertyName: string]: string; + }; +} + +// @public +export interface UsageModel { + display?: UsageModelDisplay; + modelName?: string; + targetType?: string; +} + +// @public +export interface UsageModelDisplay { + description?: string; +} + +// @public +export interface UsageModels { + list(options?: UsageModelsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface UsageModelsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UsageModelsListNextResponse = UsageModelsResult; + +// @public +export interface UsageModelsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UsageModelsListResponse = UsageModelsResult; + +// @public +export interface UsageModelsResult { + nextLink?: string; + value?: UsageModel[]; +} + +// @public (undocumented) +export interface UserAssignedIdentitiesValue { + readonly clientId?: string; + readonly principalId?: string; +} + +// @public +export type UsernameDownloadedType = string; + +// @public +export type UsernameSource = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/storagecache/arm-storagecache/rollup.config.js b/sdk/storagecache/arm-storagecache/rollup.config.js index 8e109d293547..9be1955eb7f1 100644 --- a/sdk/storagecache/arm-storagecache/rollup.config.js +++ b/sdk/storagecache/arm-storagecache/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/storageCacheManagementClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-storagecache.js", - format: "umd", - name: "Azure.ArmStoragecache", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false }; -export default config; +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/storagecache/arm-storagecache/src/models/skusMappers.ts b/sdk/storagecache/arm-storagecache/src/index.ts similarity index 54% rename from sdk/storagecache/arm-storagecache/src/models/skusMappers.ts rename to sdk/storagecache/arm-storagecache/src/index.ts index 08ac5a68e1b9..92127b7a821a 100644 --- a/sdk/storagecache/arm-storagecache/src/models/skusMappers.ts +++ b/sdk/storagecache/arm-storagecache/src/index.ts @@ -6,11 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - CloudError, - ResourceSku, - ResourceSkuCapabilities, - ResourceSkuLocationInfo, - ResourceSkusResult, - Restriction -} from "../models/mappers"; +/// +export * from "./models"; +export { StorageCacheManagementClient } from "./storageCacheManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/storagecache/arm-storagecache/src/lroImpl.ts b/sdk/storagecache/arm-storagecache/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/storagecache/arm-storagecache/src/models/cachesMappers.ts b/sdk/storagecache/arm-storagecache/src/models/cachesMappers.ts deleted file mode 100644 index 9aed7646cd96..000000000000 --- a/sdk/storagecache/arm-storagecache/src/models/cachesMappers.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the 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 { - BaseResource, - BlobNfsTarget, - Cache, - CacheActiveDirectorySettings, - CacheActiveDirectorySettingsCredentials, - CacheDirectorySettings, - CacheEncryptionSettings, - CacheHealth, - CacheIdentity, - CacheNetworkSettings, - CacheSecuritySettings, - CacheSku, - CachesListResult, - CacheUpgradeStatus, - CacheUsernameDownloadSettings, - CacheUsernameDownloadSettingsCredentials, - ClfsTarget, - CloudError, - Condition, - KeyVaultKeyReference, - KeyVaultKeyReferenceSourceVault, - NamespaceJunction, - Nfs3Target, - NfsAccessPolicy, - NfsAccessRule, - StorageTarget, - StorageTargetResource, - SystemData, - UnknownTarget -} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/models/index.ts b/sdk/storagecache/arm-storagecache/src/models/index.ts index 969068b2dc0e..3e612ed20568 100644 --- a/sdk/storagecache/arm-storagecache/src/models/index.ts +++ b/sdk/storagecache/arm-storagecache/src/models/index.ts @@ -6,1577 +6,1171 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +/** Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. */ +export interface ApiOperationListResult { + /** URL to get the next set of operation list results if there are any. */ + nextLink?: string; + /** List of Resource Provider operations supported by the Microsoft.StorageCache resource provider. */ + value?: ApiOperation[]; +} -/** - * The object that represents the operation. - */ +/** REST API operation description: see https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation */ +export interface ApiOperation { + /** The object that represents the operation. */ + display?: ApiOperationDisplay; + /** Origin of the operation. */ + origin?: string; + /** The flag that indicates whether the operation applies to data plane. */ + isDataAction?: boolean; + /** Operation name: {provider}/{resource}/{operation} */ + name?: string; + /** Specification of the all the metrics provided for a resource type. */ + serviceSpecification?: ApiOperationPropertiesServiceSpecification; +} + +/** The object that represents the operation. */ export interface ApiOperationDisplay { - /** - * Operation type: Read, write, delete, etc. - */ + /** Operation type: Read, write, delete, etc. */ operation?: string; - /** - * Service provider: Microsoft.StorageCache - */ + /** Service provider: Microsoft.StorageCache */ provider?: string; - /** - * Resource on which the operation is performed: Cache, etc. - */ + /** Resource on which the operation is performed: Cache, etc. */ resource?: string; - /** - * The description of the operation - */ + /** The description of the operation */ description?: string; } -/** - * Specifications of the Dimension of metrics. - */ -export interface MetricDimension { - /** - * Name of the dimension - */ - name?: string; - /** - * Localized friendly display name of the dimension - */ - displayName?: string; - /** - * Internal name of the dimension. - */ - internalName?: string; - /** - * To be exported to shoe box. - */ - toBeExportedForShoebox?: boolean; +/** Specification of the all the metrics provided for a resource type. */ +export interface ApiOperationPropertiesServiceSpecification { + /** Details about operations related to metrics. */ + metricSpecifications?: MetricSpecification[]; } -/** - * Details about operation related to metrics. - */ +/** Details about operation related to metrics. */ export interface MetricSpecification { - /** - * The name of the metric. - */ + /** The name of the metric. */ name?: string; - /** - * Localized display name of the metric. - */ + /** Localized display name of the metric. */ displayName?: string; - /** - * The description of the metric. - */ + /** The description of the metric. */ displayDescription?: string; - /** - * The unit that the metric is measured in. - */ + /** The unit that the metric is measured in. */ unit?: string; - /** - * The type of metric aggregation. - */ + /** The type of metric aggregation. */ aggregationType?: string; - /** - * Support metric aggregation type. - */ + /** Support metric aggregation type. */ supportedAggregationTypes?: MetricAggregationType[]; - /** - * Type of metrics. - */ + /** Type of metrics. */ metricClass?: string; - /** - * Dimensions of the metric - */ + /** Dimensions of the metric */ dimensions?: MetricDimension[]; } -/** - * Specification of the all the metrics provided for a resource type. - */ -export interface ApiOperationPropertiesServiceSpecification { - /** - * Details about operations related to metrics. - */ - metricSpecifications?: MetricSpecification[]; +/** Specifications of the Dimension of metrics. */ +export interface MetricDimension { + /** Name of the dimension */ + name?: string; + /** Localized friendly display name of the dimension */ + displayName?: string; + /** Internal name of the dimension. */ + internalName?: string; + /** To be exported to shoe box. */ + toBeExportedForShoebox?: boolean; } -/** - * REST API operation description: see - * https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation - */ -export interface ApiOperation { - /** - * The object that represents the operation. - */ - display?: ApiOperationDisplay; +/** An error response. */ +export interface CloudError { + /** The body of the error. */ + error?: CloudErrorBody; +} + +/** An error response. */ +export interface CloudErrorBody { + /** An identifier for the error. Codes are invariant and are intended to be consumed programmatically. */ + code?: string; + /** A list of additional details about the error. */ + details?: CloudErrorBody[]; + /** A message describing the error, intended to be suitable for display in a user interface. */ + message?: string; + /** The target of the particular error. For example, the name of the property in error. */ + target?: string; +} + +/** The response from the List Cache SKUs operation. */ +export interface ResourceSkusResult { + /** The URI to fetch the next page of Cache SKUs. */ + nextLink?: string; /** - * Origin of the operation. + * The list of SKUs available for the subscription. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - origin?: string; + readonly value?: ResourceSku[]; +} + +/** A resource SKU. */ +export interface ResourceSku { /** - * The flag that indicates whether the operation applies to data plane. + * The type of resource the SKU applies to. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - isDataAction?: boolean; + readonly resourceType?: string; + /** A list of capabilities of this SKU, such as throughput or ops/sec. */ + capabilities?: ResourceSkuCapabilities[]; /** - * Operation name: {provider}/{resource}/{operation} + * The set of locations where the SKU is available. This is the supported and registered Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.). + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly locations?: string[]; + /** The set of locations where the SKU is available. */ + locationInfo?: ResourceSkuLocationInfo[]; + /** The name of this SKU. */ name?: string; - /** - * Specification of the all the metrics provided for a resource type. - */ - serviceSpecification?: ApiOperationPropertiesServiceSpecification; + /** The restrictions preventing this SKU from being used. This is empty if there are no restrictions. */ + restrictions?: Restriction[]; } -/** - * An error response. - */ -export interface CloudErrorBody { - /** - * An identifier for the error. Codes are invariant and are intended to be consumed - * programmatically. - */ - code?: string; - /** - * A list of additional details about the error. - */ - details?: CloudErrorBody[]; +/** A resource SKU capability. */ +export interface ResourceSkuCapabilities { + /** Name of a capability, such as ops/sec. */ + name?: string; + /** Quantity, if the capability is measured by quantity. */ + value?: string; +} + +/** Resource SKU location information. */ +export interface ResourceSkuLocationInfo { + /** Location where this SKU is available. */ + location?: string; + /** Zones if any. */ + zones?: string[]; +} + +/** The restrictions preventing this SKU from being used. */ +export interface Restriction { /** - * A message describing the error, intended to be suitable for display in a user interface. + * The type of restrictions. In this version, the only possible value for this is location. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - message?: string; + readonly type?: string; /** - * The target of the particular error. For example, the name of the property in error. + * The value of restrictions. If the restriction type is set to location, then this would be the different locations where the SKU is restricted. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - target?: string; + readonly values?: string[]; + /** The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. */ + reasonCode?: ReasonCode; } -/** - * Describes the format of Error response. - */ +/** A list of Cache usage models. */ +export interface UsageModelsResult { + /** The URI to fetch the next page of Cache usage models. */ + nextLink?: string; + /** The list of usage models available for the subscription. */ + value?: UsageModel[]; +} + +/** A usage model. */ +export interface UsageModel { + /** Localized information describing this usage model. */ + display?: UsageModelDisplay; + /** Non-localized keyword name for this usage model. */ + modelName?: string; + /** The type of Storage Target to which this model is applicable (only nfs3 as of this version). */ + targetType?: string; +} + +/** Localized information describing this usage model. */ +export interface UsageModelDisplay { + /** String to display for this usage model. */ + description?: string; +} + +/** The status of operation. */ +export interface AscOperation { + /** The operation Id. */ + id?: string; + /** The operation name. */ + name?: string; + /** The start time of the operation. */ + startTime?: string; + /** The end time of the operation. */ + endTime?: string; + /** The status of the operation. */ + status?: string; + /** The error detail of the operation if any. */ + error?: ErrorResponse; + /** Additional operation-specific output. */ + output?: { [propertyName: string]: Record }; +} + +/** Describes the format of Error response. */ export interface ErrorResponse { - /** - * Error code - */ + /** Error code */ code?: string; - /** - * Error message indicating why the operation failed. - */ + /** Error message indicating why the operation failed. */ message?: string; } -/** - * The status of operation. - */ -export interface AscOperation { +/** Result of the request to list Caches. It contains a list of Caches and a URL link to get the next set of results. */ +export interface CachesListResult { + /** URL to get the next set of Cache list results, if there are any. */ + nextLink?: string; + /** List of Caches. */ + value?: Cache[]; +} + +/** A Cache instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md */ +export interface Cache { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; /** - * The operation Id. + * Resource ID of the Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - id?: string; + readonly id?: string; + /** Region name string. */ + location?: string; /** - * The operation name. + * Name of Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - name?: string; + readonly name?: string; /** - * The start time of the operation. + * Type of the Cache; Microsoft.StorageCache/Cache + * NOTE: This property will not be serialized. It can only be populated by the server. */ - startTime?: string; + readonly type?: string; + /** The identity of the cache, if configured. */ + identity?: CacheIdentity; /** - * The end time of the operation. + * The system meta data relating to this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - endTime?: string; + readonly systemData?: SystemData; + /** SKU for the Cache. */ + sku?: CacheSku; + /** The size of this Cache, in GB. */ + cacheSizeGB?: number; /** - * The status of the operation. + * Health of the Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - status?: string; + readonly health?: CacheHealth; /** - * The error detail of the operation if any. + * Array of IP addresses that can be used by clients mounting this Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - error?: ErrorResponse; + readonly mountAddresses?: string[]; + /** + * ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningStateType; + /** Subnet used for the Cache. */ + subnet?: string; /** - * Additional operation-specific output. + * Upgrade status of the Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - output?: { [propertyName: string]: any }; + readonly upgradeStatus?: CacheUpgradeStatus; + /** Specifies network settings of the cache. */ + networkSettings?: CacheNetworkSettings; + /** Specifies encryption settings of the cache. */ + encryptionSettings?: CacheEncryptionSettings; + /** Specifies security settings of the cache. */ + securitySettings?: CacheSecuritySettings; + /** Specifies Directory Services settings of the cache. */ + directoryServicesSettings?: CacheDirectorySettings; + /** Availability zones for resources. This field should only contain a single element in the array. */ + zones?: string[]; } -/** - * Cache identity properties. - */ +/** Cache identity properties. */ export interface CacheIdentity { /** - * The principal id of the cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The principal ID for the system-assigned identity of the cache. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly principalId?: string; /** - * The tenant id associated with the cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The tenant ID associated with the cache. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly tenantId?: string; - /** - * The type of identity used for the cache. Possible values include: 'SystemAssigned', 'None' - */ + /** The type of identity used for the cache */ type?: CacheIdentityType; + /** A dictionary where each key is a user assigned identity resource ID, and each key's value is an empty dictionary. */ + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentitiesValue; + }; } -/** - * Metadata pertaining to creation and last modification of the resource. - */ -export interface SystemData { +export interface UserAssignedIdentitiesValue { /** - * The identity that created the resource. + * The principal ID of the user-assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - createdBy?: string; + readonly principalId?: string; /** - * The type of identity that created the resource. Possible values include: 'User', - * 'Application', 'ManagedIdentity', 'Key' + * The client ID of the user-assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly clientId?: string; +} + +/** 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). - */ + /** The timestamp of resource creation (UTC). */ createdAt?: Date; - /** - * The identity that last modified the resource. - */ + /** The identity that last modified the resource. */ lastModifiedBy?: string; - /** - * The type of identity that last modified the resource. Possible values include: 'User', - * 'Application', 'ManagedIdentity', 'Key' - */ + /** The type of identity that last modified the resource. */ lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** An indication of Cache health. Gives more information about health than just that related to provisioning. */ +export interface CacheHealth { + /** List of Cache health states. */ + state?: HealthStateType; + /** Describes explanation of state. */ + statusDescription?: string; /** - * The timestamp of resource last modification (UTC) + * Outstanding conditions that need to be investigated and resolved. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - lastModifiedAt?: Date; + readonly conditions?: Condition[]; } -/** - * Outstanding conditions that will need to be resolved. - */ +/** Outstanding conditions that will need to be resolved. */ export interface Condition { /** * The time when the condition was raised. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly timestamp?: Date; /** * The issue requiring attention. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly message?: string; } -/** - * An indication of Cache health. Gives more information about health than just that related to - * provisioning. - */ -export interface CacheHealth { - /** - * List of Cache health states. Possible values include: 'Unknown', 'Healthy', 'Degraded', - * 'Down', 'Transitioning', 'Stopping', 'Stopped', 'Upgrading', 'Flushing' - */ - state?: HealthStateType; - /** - * Describes explanation of state. - */ - statusDescription?: string; - /** - * Outstanding conditions that need to be investigated and resolved. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly conditions?: Condition[]; -} - -/** - * Properties describing the software upgrade state of the Cache. - */ +/** Properties describing the software upgrade state of the Cache. */ export interface CacheUpgradeStatus { /** * Version string of the firmware currently installed on this Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly currentFirmwareVersion?: string; /** - * True if there is a firmware update ready to install on this Cache. The firmware will - * automatically be installed after firmwareUpdateDeadline if not triggered earlier via the - * upgrade operation. Possible values include: 'available', 'unavailable' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * True if there is a firmware update ready to install on this Cache. The firmware will automatically be installed after firmwareUpdateDeadline if not triggered earlier via the upgrade operation. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly firmwareUpdateStatus?: FirmwareStatusType; /** * Time at which the pending firmware update will automatically be installed on the Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly firmwareUpdateDeadline?: Date; /** * Time of the last successful firmware update. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly lastFirmwareUpdate?: Date; /** * When firmwareUpdateAvailable is true, this field holds the version string for the update. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly pendingFirmwareVersion?: string; } -/** - * Cache network settings. - */ +/** Cache network settings. */ export interface CacheNetworkSettings { - /** - * The IPv4 maximum transmission unit configured for the subnet. Default value: 1500. - */ + /** The IPv4 maximum transmission unit configured for the subnet. */ mtu?: number; /** * Array of additional IP addresses used by this Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly utilityAddresses?: string[]; - /** - * DNS servers for the cache to use. It will be set from the network configuration if no value - * is provided. - */ + /** DNS servers for the cache to use. It will be set from the network configuration if no value is provided. */ dnsServers?: string[]; - /** - * DNS search domain - */ + /** DNS search domain */ dnsSearchDomain?: string; - /** - * NTP server IP Address or FQDN for the cache to use. The default is time.windows.com. - */ + /** NTP server IP Address or FQDN for the cache to use. The default is time.windows.com. */ ntpServer?: string; } -/** - * Describes a resource Id to source Key Vault. - */ -export interface KeyVaultKeyReferenceSourceVault { - /** - * Resource Id. - */ - id?: string; +/** Cache encryption settings. */ +export interface CacheEncryptionSettings { + /** Specifies the location of the key encryption key in Key Vault. */ + keyEncryptionKey?: KeyVaultKeyReference; + /** Specifies whether the service will automatically rotate to the newest version of the key in the Key Vault. */ + rotationToLatestKeyVersionEnabled?: boolean; } -/** - * Describes a reference to Key Vault Key. - */ +/** Describes a reference to Key Vault Key. */ export interface KeyVaultKeyReference { - /** - * The URL referencing a key encryption key in Key Vault. - */ + /** The URL referencing a key encryption key in Key Vault. */ keyUrl: string; - /** - * Describes a resource Id to source Key Vault. - */ + /** Describes a resource Id to source Key Vault. */ sourceVault: KeyVaultKeyReferenceSourceVault; } -/** - * Cache encryption settings. - */ -export interface CacheEncryptionSettings { - /** - * Specifies the location of the key encryption key in Key Vault. - */ - keyEncryptionKey?: KeyVaultKeyReference; +/** Describes a resource Id to source Key Vault. */ +export interface KeyVaultKeyReferenceSourceVault { + /** Resource Id. */ + id?: string; } -/** - * Rule to place restrictions on portions of the cache namespace being presented to clients. - */ +/** Cache security settings. */ +export interface CacheSecuritySettings { + /** NFS access policies defined for this cache. */ + accessPolicies?: NfsAccessPolicy[]; +} + +/** A set of rules describing access policies applied to NFSv3 clients of the cache. */ +export interface NfsAccessPolicy { + /** Name identifying this policy. Access Policy names are not case sensitive. */ + name: string; + /** The set of rules describing client accesses allowed under this policy. */ + accessRules: NfsAccessRule[]; +} + +/** Rule to place restrictions on portions of the cache namespace being presented to clients. */ export interface NfsAccessRule { - /** - * Scope for this rule. The scope and filter determine which clients match the rule. Possible - * values include: 'default', 'network', 'host' - */ + /** Scope for this rule. The scope and filter determine which clients match the rule. */ scope: NfsAccessRuleScope; - /** - * Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' - * scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR - * format (for example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name - * as filter. If a client does not match any filter rule and there is no default rule, access is - * denied. - */ + /** Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name as filter. If a client does not match any filter rule and there is no default rule, access is denied. */ filter?: string; - /** - * Access allowed by this rule. Possible values include: 'no', 'ro', 'rw' - */ + /** Access allowed by this rule. */ access: NfsAccessRuleAccess; - /** - * Allow SUID semantics. - */ + /** Allow SUID semantics. */ suid?: boolean; - /** - * For the default policy, allow access to subdirectories under the root export. If this is set - * to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, - * like '/a/b'. - */ + /** For the default policy, allow access to subdirectories under the root export. If this is set to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, like '/a/b'. */ submountAccess?: boolean; - /** - * Map root accesses to anonymousUID and anonymousGID. - */ + /** Map root accesses to anonymousUID and anonymousGID. */ rootSquash?: boolean; - /** - * UID value that replaces 0 when rootSquash is true. 65534 will be used if not provided. - */ + /** UID value that replaces 0 when rootSquash is true. 65534 will be used if not provided. */ anonymousUID?: string; - /** - * GID value that replaces 0 when rootSquash is true. This will use the value of anonymousUID if - * not provided. - */ + /** GID value that replaces 0 when rootSquash is true. This will use the value of anonymousUID if not provided. */ anonymousGID?: string; } -/** - * A set of rules describing access policies applied to NFSv3 clients of the cache. - */ -export interface NfsAccessPolicy { - /** - * Name identifying this policy. Access Policy names are not case sensitive. - */ - name: string; - /** - * The set of rules describing client accesses allowed under this policy. - */ - accessRules: NfsAccessRule[]; -} - -/** - * Cache security settings. - */ -export interface CacheSecuritySettings { - /** - * NFS access policies defined for this cache. - */ - accessPolicies?: NfsAccessPolicy[]; -} - -/** - * Active Directory admin credentials used to join the HPC Cache to a domain. - */ -export interface CacheActiveDirectorySettingsCredentials { - /** - * Username of the Active Directory domain administrator. This value is stored encrypted and not - * returned on response. - */ - username: string; - /** - * Plain text password of the Active Directory domain administrator. This value is stored - * encrypted and not returned on response. - */ - password: string; +/** Cache Directory Services settings. */ +export interface CacheDirectorySettings { + /** Specifies settings for joining the HPC Cache to an Active Directory domain. */ + activeDirectory?: CacheActiveDirectorySettings; + /** Specifies settings for Extended Groups. Extended Groups allows users to be members of more than 16 groups. */ + usernameDownload?: CacheUsernameDownloadSettings; } -/** - * Active Directory settings used to join a cache to a domain. - */ +/** Active Directory settings used to join a cache to a domain. */ export interface CacheActiveDirectorySettings { - /** - * Primary DNS IP address used to resolve the Active Directory domain controller's fully - * qualified domain name. - */ + /** Primary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. */ primaryDnsIpAddress: string; - /** - * Secondary DNS IP address used to resolve the Active Directory domain controller's fully - * qualified domain name. - */ + /** Secondary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. */ secondaryDnsIpAddress?: string; - /** - * The fully qualified domain name of the Active Directory domain controller. - */ + /** The fully qualified domain name of the Active Directory domain controller. */ domainName: string; - /** - * The Active Directory domain's NetBIOS name. - */ + /** The Active Directory domain's NetBIOS name. */ domainNetBiosName: string; - /** - * The NetBIOS name to assign to the HPC Cache when it joins the Active Directory domain as a - * server. Length must 1-15 characters from the class [-0-9a-zA-Z]. - */ + /** The NetBIOS name to assign to the HPC Cache when it joins the Active Directory domain as a server. Length must 1-15 characters from the class [-0-9a-zA-Z]. */ cacheNetBiosName: string; /** - * True if the HPC Cache is joined to the Active Directory domain. Possible values include: - * 'Yes', 'No', 'Error' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * True if the HPC Cache is joined to the Active Directory domain. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly domainJoined?: DomainJoinedType; - /** - * Active Directory admin credentials used to join the HPC Cache to a domain. - */ + /** Active Directory admin credentials used to join the HPC Cache to a domain. */ credentials?: CacheActiveDirectorySettingsCredentials; } -/** - * When present, these are the credentials for the secure LDAP connection. - */ -export interface CacheUsernameDownloadSettingsCredentials { - /** - * The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is - * stored encrypted and not returned on response. - */ - bindDn?: string; - /** - * The Bind password to be used in the secure LDAP connection. This value is stored encrypted and - * not returned on response. - */ - bindPassword?: string; +/** Active Directory admin credentials used to join the HPC Cache to a domain. */ +export interface CacheActiveDirectorySettingsCredentials { + /** Username of the Active Directory domain administrator. This value is stored encrypted and not returned on response. */ + username: string; + /** Plain text password of the Active Directory domain administrator. This value is stored encrypted and not returned on response. */ + password: string; } -/** - * Settings for Extended Groups username and group download. - */ +/** Settings for Extended Groups username and group download. */ export interface CacheUsernameDownloadSettings { - /** - * Whether or not Extended Groups is enabled. - */ + /** Whether or not Extended Groups is enabled. */ extendedGroups?: boolean; - /** - * This setting determines how the cache gets username and group names for clients. Possible - * values include: 'AD', 'LDAP', 'File', 'None'. Default value: 'None'. - */ + /** This setting determines how the cache gets username and group names for clients. */ usernameSource?: UsernameSource; - /** - * The URI of the file containing group information (in /etc/group file format). This field must - * be populated when 'usernameSource' is set to 'File'. - */ + /** The URI of the file containing group information (in /etc/group file format). This field must be populated when 'usernameSource' is set to 'File'. */ groupFileURI?: string; - /** - * The URI of the file containing user information (in /etc/passwd file format). This field must - * be populated when 'usernameSource' is set to 'File'. - */ + /** The URI of the file containing user information (in /etc/passwd file format). This field must be populated when 'usernameSource' is set to 'File'. */ userFileURI?: string; - /** - * The fully qualified domain name or IP address of the LDAP server to use. - */ + /** The fully qualified domain name or IP address of the LDAP server to use. */ ldapServer?: string; - /** - * The base distinguished name for the LDAP domain. - */ + /** The base distinguished name for the LDAP domain. */ ldapBaseDN?: string; - /** - * Whether or not the LDAP connection should be encrypted. - */ + /** Whether or not the LDAP connection should be encrypted. */ encryptLdapConnection?: boolean; - /** - * Determines if the certificates must be validated by a certificate authority. When true, - * caCertificateURI must be provided. - */ + /** Determines if the certificates must be validated by a certificate authority. When true, caCertificateURI must be provided. */ requireValidCertificate?: boolean; - /** - * Determines if the certificate should be automatically downloaded. This applies to - * 'caCertificateURI' only if 'requireValidCertificate' is true. - */ + /** Determines if the certificate should be automatically downloaded. This applies to 'caCertificateURI' only if 'requireValidCertificate' is true. */ autoDownloadCertificate?: boolean; - /** - * The URI of the CA certificate to validate the LDAP secure connection. This field must be - * populated when 'requireValidCertificate' is set to true. - */ + /** The URI of the CA certificate to validate the LDAP secure connection. This field must be populated when 'requireValidCertificate' is set to true. */ caCertificateURI?: string; /** * Indicates whether or not the HPC Cache has performed the username download successfully. - * Possible values include: 'Yes', 'No', 'Error' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly usernameDownloaded?: UsernameDownloadedType; - /** - * When present, these are the credentials for the secure LDAP connection. - */ + /** When present, these are the credentials for the secure LDAP connection. */ credentials?: CacheUsernameDownloadSettingsCredentials; } -/** - * Cache Directory Services settings. - */ -export interface CacheDirectorySettings { - /** - * Specifies settings for joining the HPC Cache to an Active Directory domain. - */ - activeDirectory?: CacheActiveDirectorySettings; - /** - * Specifies settings for Extended Groups. Extended Groups allows users to be members of more - * than 16 groups. - */ - usernameDownload?: CacheUsernameDownloadSettings; +/** When present, these are the credentials for the secure LDAP connection. */ +export interface CacheUsernameDownloadSettingsCredentials { + /** The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. */ + bindDn?: string; + /** The Bind password to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. */ + bindPassword?: string; } -/** - * SKU for the Cache. - */ +/** SKU for the Cache. */ export interface CacheSku { - /** - * SKU name for this Cache. - */ + /** SKU name for this Cache. */ name?: string; } -/** - * A Cache instance. Follows Azure Resource Manager standards: - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md - */ -export interface Cache extends BaseResource { - /** - * Resource tags. - */ - tags?: { [propertyName: string]: string }; - /** - * Resource ID of the Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Region name string. - */ - location?: string; - /** - * Name of Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Type of the Cache; Microsoft.StorageCache/Cache - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The identity of the cache, if configured. - */ - identity?: CacheIdentity; - /** - * The system meta data relating to this resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly systemData?: SystemData; - /** - * The size of this Cache, in GB. - */ - cacheSizeGB?: number; - /** - * Health of the Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly health?: CacheHealth; - /** - * Array of IP addresses that can be used by clients mounting this Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly mountAddresses?: string[]; - /** - * ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', - * 'Updating' - */ - provisioningState?: ProvisioningStateType; - /** - * Subnet used for the Cache. - */ - subnet?: string; - /** - * Upgrade status of the Cache. - */ - upgradeStatus?: CacheUpgradeStatus; - /** - * Specifies network settings of the cache. - */ - networkSettings?: CacheNetworkSettings; - /** - * Specifies encryption settings of the cache. - */ - encryptionSettings?: CacheEncryptionSettings; - /** - * Specifies security settings of the cache. - */ - securitySettings?: CacheSecuritySettings; - /** - * Specifies Directory Services settings of the cache. - */ - directoryServicesSettings?: CacheDirectorySettings; - /** - * SKU for the Cache. - */ - sku?: CacheSku; +/** A list of Storage Targets. */ +export interface StorageTargetsResult { + /** The URI to fetch the next page of Storage Targets. */ + nextLink?: string; + /** The list of Storage Targets defined for the Cache. */ + value?: StorageTarget[]; } -/** - * A namespace junction. - */ +/** A namespace junction. */ export interface NamespaceJunction { - /** - * Namespace path on a Cache for a Storage Target. - */ + /** Namespace path on a Cache for a Storage Target. */ namespacePath?: string; - /** - * Path in Storage Target to which namespacePath points. - */ + /** Path in Storage Target to which namespacePath points. */ targetPath?: string; - /** - * NFS export where targetPath exists. - */ + /** NFS export where targetPath exists. */ nfsExport?: string; - /** - * Name of the access policy applied to this junction. - */ + /** Name of the access policy applied to this junction. */ nfsAccessPolicy?: string; } -/** - * Properties pertaining to the Nfs3Target - */ +/** Properties pertaining to the Nfs3Target */ export interface Nfs3Target { - /** - * IP address or host name of an NFSv3 host (e.g., 10.0.44.44). - */ + /** IP address or host name of an NFSv3 host (e.g., 10.0.44.44). */ target?: string; - /** - * Identifies the StorageCache usage model to be used for this storage target. - */ + /** Identifies the StorageCache usage model to be used for this storage target. */ usageModel?: string; } -/** - * Properties pertaining to the ClfsTarget - */ +/** Properties pertaining to the ClfsTarget */ export interface ClfsTarget { - /** - * Resource ID of storage container. - */ + /** Resource ID of storage container. */ target?: string; } -/** - * Properties pertaining to the UnknownTarget - */ +/** Properties pertaining to the UnknownTarget */ export interface UnknownTarget { - /** - * Dictionary of string->string pairs containing information about the Storage Target. - */ + /** Dictionary of string->string pairs containing information about the Storage Target. */ attributes?: { [propertyName: string]: string }; } -/** - * Properties pertaining to the BlobNfsTarget. - */ +/** Properties pertaining to the BlobNfsTarget. */ export interface BlobNfsTarget { - /** - * Resource ID of the storage container. - */ + /** Resource ID of the storage container. */ target?: string; - /** - * Identifies the StorageCache usage model to be used for this storage target. - */ + /** Identifies the StorageCache usage model to be used for this storage target. */ usageModel?: string; } -/** - * Resource used by a Cache. - */ -export interface StorageTargetResource extends BaseResource { +/** Resource used by a Cache. */ +export interface StorageTargetResource { /** * Name of the Storage Target. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * Resource ID of the Storage Target. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; /** * Type of the Storage Target; Microsoft.StorageCache/Cache/StorageTarget - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; /** * Region name string. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly location?: string; /** * The system meta data relating to this resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly systemData?: SystemData; } -/** - * Type of the Storage Target. - */ -export interface StorageTarget extends StorageTargetResource { - /** - * List of Cache namespace junctions to target for namespace associations. - */ +/** Type of the Storage Target. */ +export type StorageTarget = StorageTargetResource & { + /** List of Cache namespace junctions to target for namespace associations. */ junctions?: NamespaceJunction[]; + /** Type of the Storage Target. */ + targetType?: StorageTargetType; /** - * Type of the Storage Target. Possible values include: 'nfs3', 'clfs', 'unknown', 'blobNfs' - */ - targetType: StorageTargetType; - /** - * ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', - * 'Updating' - */ - provisioningState?: ProvisioningStateType; - /** - * Properties when targetType is nfs3. + * ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly provisioningState?: ProvisioningStateType; + /** Storage target operational state. */ + state?: OperationalStateType; + /** Properties when targetType is nfs3. */ nfs3?: Nfs3Target; - /** - * Properties when targetType is clfs. - */ + /** Properties when targetType is clfs. */ clfs?: ClfsTarget; - /** - * Properties when targetType is unknown. - */ + /** Properties when targetType is unknown. */ unknown?: UnknownTarget; - /** - * Properties when targetType is blobNfs. - */ + /** Properties when targetType is blobNfs. */ blobNfs?: BlobNfsTarget; +}; + +/** Known values of {@link MetricAggregationType} that the service accepts. */ +export enum KnownMetricAggregationType { + NotSpecified = "NotSpecified", + None = "None", + Average = "Average", + Minimum = "Minimum", + Maximum = "Maximum", + Total = "Total", + Count = "Count" } /** - * A resource SKU capability. - */ -export interface ResourceSkuCapabilities { - /** - * Name of a capability, such as ops/sec. - */ - name?: string; - /** - * Quantity, if the capability is measured by quantity. - */ - value?: string; + * Defines values for MetricAggregationType. \ + * {@link KnownMetricAggregationType} can be used interchangeably with MetricAggregationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotSpecified** \ + * **None** \ + * **Average** \ + * **Minimum** \ + * **Maximum** \ + * **Total** \ + * **Count** + */ +export type MetricAggregationType = string; + +/** Known values of {@link ReasonCode} that the service accepts. */ +export enum KnownReasonCode { + QuotaId = "QuotaId", + NotAvailableForSubscription = "NotAvailableForSubscription" } /** - * Resource SKU location information. + * Defines values for ReasonCode. \ + * {@link KnownReasonCode} can be used interchangeably with ReasonCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **QuotaId** \ + * **NotAvailableForSubscription** */ -export interface ResourceSkuLocationInfo { - /** - * Location where this SKU is available. - */ - location?: string; - /** - * Zones if any. - */ - zones?: string[]; -} +export type ReasonCode = string; -/** - * The restrictions preventing this SKU from being used. - */ -export interface Restriction { - /** - * The type of restrictions. In this version, the only possible value for this is location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The value of restrictions. If the restriction type is set to location, then this would be the - * different locations where the SKU is restricted. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly values?: string[]; - /** - * The reason for the restriction. As of now this can be "QuotaId" or - * "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as - * the subscription does not belong to that quota. "NotAvailableForSubscription" is related to - * capacity at the datacenter. Possible values include: 'QuotaId', 'NotAvailableForSubscription' - */ - reasonCode?: ReasonCode; +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" } /** - * A resource SKU. - */ -export interface ResourceSku { - /** - * The type of resource the SKU applies to. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly resourceType?: string; - /** - * A list of capabilities of this SKU, such as throughput or ops/sec. - */ - capabilities?: ResourceSkuCapabilities[]; - /** - * The set of locations where the SKU is available. This is the supported and registered Azure - * Geo Regions (e.g., West US, East US, Southeast Asia, etc.). - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly locations?: string[]; - /** - * The set of locations where the SKU is available. - */ - locationInfo?: ResourceSkuLocationInfo[]; - /** - * The name of this SKU. - */ - name?: string; - /** - * The restrictions preventing this SKU from being used. This is empty if there are no - * restrictions. - */ - restrictions?: Restriction[]; + * 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 HealthStateType} that the service accepts. */ +export enum KnownHealthStateType { + Unknown = "Unknown", + Healthy = "Healthy", + Degraded = "Degraded", + Down = "Down", + Transitioning = "Transitioning", + Stopping = "Stopping", + Stopped = "Stopped", + Upgrading = "Upgrading", + Flushing = "Flushing" } /** - * Localized information describing this usage model. - */ -export interface UsageModelDisplay { - /** - * String to display for this usage model. - */ - description?: string; + * Defines values for HealthStateType. \ + * {@link KnownHealthStateType} can be used interchangeably with HealthStateType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **Healthy** \ + * **Degraded** \ + * **Down** \ + * **Transitioning** \ + * **Stopping** \ + * **Stopped** \ + * **Upgrading** \ + * **Flushing** + */ +export type HealthStateType = string; + +/** Known values of {@link ProvisioningStateType} that the service accepts. */ +export enum KnownProvisioningStateType { + Succeeded = "Succeeded", + Failed = "Failed", + Cancelled = "Cancelled", + Creating = "Creating", + Deleting = "Deleting", + Updating = "Updating" } /** - * A usage model. + * Defines values for ProvisioningStateType. \ + * {@link KnownProvisioningStateType} can be used interchangeably with ProvisioningStateType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Cancelled** \ + * **Creating** \ + * **Deleting** \ + * **Updating** */ -export interface UsageModel { - /** - * Localized information describing this usage model. - */ - display?: UsageModelDisplay; - /** - * Non-localized keyword name for this usage model. - */ - modelName?: string; - /** - * The type of Storage Target to which this model is applicable (only nfs3 as of this version). - */ - targetType?: string; -} +export type ProvisioningStateType = string; -/** - * Optional Parameters. - */ -export interface CachesCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the user-selectable properties of the new Cache. If read-only properties are - * included, they must match the existing values of those properties. - */ - cache?: Cache; +/** Known values of {@link FirmwareStatusType} that the service accepts. */ +export enum KnownFirmwareStatusType { + Available = "available", + Unavailable = "unavailable" } /** - * Optional Parameters. + * Defines values for FirmwareStatusType. \ + * {@link KnownFirmwareStatusType} can be used interchangeably with FirmwareStatusType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **available** \ + * **unavailable** */ -export interface CachesUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the user-selectable properties of the Cache. If read-only properties are - * included, they must match the existing values of those properties. - */ - cache?: Cache; -} +export type FirmwareStatusType = string; -/** - * Optional Parameters. - */ -export interface CachesBeginCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the user-selectable properties of the new Cache. If read-only properties are - * included, they must match the existing values of those properties. - */ - cache?: Cache; +/** Known values of {@link NfsAccessRuleScope} that the service accepts. */ +export enum KnownNfsAccessRuleScope { + Default = "default", + Network = "network", + Host = "host" } /** - * Optional Parameters. + * Defines values for NfsAccessRuleScope. \ + * {@link KnownNfsAccessRuleScope} can be used interchangeably with NfsAccessRuleScope, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **default** \ + * **network** \ + * **host** */ -export interface StorageTargetsCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the definition of a Storage Target. - */ - storagetarget?: StorageTarget; -} +export type NfsAccessRuleScope = string; -/** - * Optional Parameters. - */ -export interface StorageTargetsBeginCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the definition of a Storage Target. - */ - storagetarget?: StorageTarget; +/** Known values of {@link NfsAccessRuleAccess} that the service accepts. */ +export enum KnownNfsAccessRuleAccess { + No = "no", + Ro = "ro", + Rw = "rw" } /** - * An interface representing StorageCacheManagementClientOptions. + * Defines values for NfsAccessRuleAccess. \ + * {@link KnownNfsAccessRuleAccess} can be used interchangeably with NfsAccessRuleAccess, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **no** \ + * **ro** \ + * **rw** */ -export interface StorageCacheManagementClientOptions extends AzureServiceClientOptions { - baseUri?: string; -} +export type NfsAccessRuleAccess = string; -/** - * @interface - * Result of the request to list Resource Provider operations. It contains a list of operations and - * a URL link to get the next set of results. - * @extends Array - */ -export interface ApiOperationListResult extends Array { - /** - * URL to get the next set of operation list results if there are any. - */ - nextLink?: string; +/** Known values of {@link DomainJoinedType} that the service accepts. */ +export enum KnownDomainJoinedType { + Yes = "Yes", + No = "No", + Error = "Error" } /** - * @interface - * The response from the List Cache SKUs operation. - * @extends Array + * Defines values for DomainJoinedType. \ + * {@link KnownDomainJoinedType} can be used interchangeably with DomainJoinedType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Yes** \ + * **No** \ + * **Error** */ -export interface ResourceSkusResult extends Array { - /** - * The URI to fetch the next page of Cache SKUs. - */ - nextLink?: string; +export type DomainJoinedType = string; + +/** Known values of {@link UsernameSource} that the service accepts. */ +export enum KnownUsernameSource { + AD = "AD", + Ldap = "LDAP", + File = "File", + None = "None" } /** - * @interface - * A list of Cache usage models. - * @extends Array + * Defines values for UsernameSource. \ + * {@link KnownUsernameSource} can be used interchangeably with UsernameSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AD** \ + * **LDAP** \ + * **File** \ + * **None** */ -export interface UsageModelsResult extends Array { - /** - * The URI to fetch the next page of Cache usage models. - */ - nextLink?: string; +export type UsernameSource = string; + +/** Known values of {@link UsernameDownloadedType} that the service accepts. */ +export enum KnownUsernameDownloadedType { + Yes = "Yes", + No = "No", + Error = "Error" } /** - * @interface - * Result of the request to list Caches. It contains a list of Caches and a URL link to get the - * next set of results. - * @extends Array + * Defines values for UsernameDownloadedType. \ + * {@link KnownUsernameDownloadedType} can be used interchangeably with UsernameDownloadedType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Yes** \ + * **No** \ + * **Error** */ -export interface CachesListResult extends Array { - /** - * URL to get the next set of Cache list results, if there are any. - */ - nextLink?: string; +export type UsernameDownloadedType = string; + +/** Known values of {@link StorageTargetType} that the service accepts. */ +export enum KnownStorageTargetType { + Nfs3 = "nfs3", + Clfs = "clfs", + Unknown = "unknown", + BlobNfs = "blobNfs" } /** - * @interface - * A list of Storage Targets. - * @extends Array + * Defines values for StorageTargetType. \ + * {@link KnownStorageTargetType} can be used interchangeably with StorageTargetType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **nfs3** \ + * **clfs** \ + * **unknown** \ + * **blobNfs** */ -export interface StorageTargetsResult extends Array { - /** - * The URI to fetch the next page of Storage Targets. - */ - nextLink?: string; +export type StorageTargetType = string; + +/** Known values of {@link OperationalStateType} that the service accepts. */ +export enum KnownOperationalStateType { + Ready = "Ready", + Busy = "Busy", + Suspended = "Suspended", + Flushing = "Flushing" } /** - * Defines values for MetricAggregationType. - * Possible values include: 'NotSpecified', 'None', 'Average', 'Minimum', 'Maximum', 'Total', - * 'Count' - * @readonly - * @enum {string} + * Defines values for OperationalStateType. \ + * {@link KnownOperationalStateType} can be used interchangeably with OperationalStateType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Ready** \ + * **Busy** \ + * **Suspended** \ + * **Flushing** */ -export type MetricAggregationType = 'NotSpecified' | 'None' | 'Average' | 'Minimum' | 'Maximum' | 'Total' | 'Count'; +export type OperationalStateType = string; +/** Defines values for CacheIdentityType. */ +export type CacheIdentityType = + | "SystemAssigned" + | "UserAssigned" + | "SystemAssigned, UserAssigned" + | "None"; -/** - * Defines values for CacheIdentityType. - * Possible values include: 'SystemAssigned', 'None' - * @readonly - * @enum {string} - */ -export type CacheIdentityType = 'SystemAssigned' | 'None'; +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for CreatedByType. - * Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - * @readonly - * @enum {string} - */ -export type CreatedByType = 'User' | 'Application' | 'ManagedIdentity' | 'Key'; +/** Contains response data for the list operation. */ +export type OperationsListResponse = ApiOperationListResult; -/** - * Defines values for HealthStateType. - * Possible values include: 'Unknown', 'Healthy', 'Degraded', 'Down', 'Transitioning', 'Stopping', - * 'Stopped', 'Upgrading', 'Flushing' - * @readonly - * @enum {string} - */ -export type HealthStateType = 'Unknown' | 'Healthy' | 'Degraded' | 'Down' | 'Transitioning' | 'Stopping' | 'Stopped' | 'Upgrading' | 'Flushing'; +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for ProvisioningStateType. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' - * @readonly - * @enum {string} - */ -export type ProvisioningStateType = 'Succeeded' | 'Failed' | 'Cancelled' | 'Creating' | 'Deleting' | 'Updating'; +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = ApiOperationListResult; -/** - * Defines values for FirmwareStatusType. - * Possible values include: 'available', 'unavailable' - * @readonly - * @enum {string} - */ -export type FirmwareStatusType = 'available' | 'unavailable'; +/** Optional parameters. */ +export interface SkusListOptionalParams extends coreClient.OperationOptions {} -/** - * Defines values for NfsAccessRuleScope. - * Possible values include: 'default', 'network', 'host' - * @readonly - * @enum {string} - */ -export type NfsAccessRuleScope = 'default' | 'network' | 'host'; +/** Contains response data for the list operation. */ +export type SkusListResponse = ResourceSkusResult; -/** - * Defines values for NfsAccessRuleAccess. - * Possible values include: 'no', 'ro', 'rw' - * @readonly - * @enum {string} - */ -export type NfsAccessRuleAccess = 'no' | 'ro' | 'rw'; +/** Optional parameters. */ +export interface SkusListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for DomainJoinedType. - * Possible values include: 'Yes', 'No', 'Error' - * @readonly - * @enum {string} - */ -export type DomainJoinedType = 'Yes' | 'No' | 'Error'; +/** Contains response data for the listNext operation. */ +export type SkusListNextResponse = ResourceSkusResult; -/** - * Defines values for UsernameSource. - * Possible values include: 'AD', 'LDAP', 'File', 'None' - * @readonly - * @enum {string} - */ -export type UsernameSource = 'AD' | 'LDAP' | 'File' | 'None'; +/** Optional parameters. */ +export interface UsageModelsListOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for UsernameDownloadedType. - * Possible values include: 'Yes', 'No', 'Error' - * @readonly - * @enum {string} - */ -export type UsernameDownloadedType = 'Yes' | 'No' | 'Error'; +/** Contains response data for the list operation. */ +export type UsageModelsListResponse = UsageModelsResult; -/** - * Defines values for StorageTargetType. - * Possible values include: 'nfs3', 'clfs', 'unknown', 'blobNfs' - * @readonly - * @enum {string} - */ -export type StorageTargetType = 'nfs3' | 'clfs' | 'unknown' | 'blobNfs'; +/** Optional parameters. */ +export interface UsageModelsListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for ReasonCode. - * Possible values include: 'QuotaId', 'NotAvailableForSubscription' - * @readonly - * @enum {string} - */ -export type ReasonCode = 'QuotaId' | 'NotAvailableForSubscription'; +/** Contains response data for the listNext operation. */ +export type UsageModelsListNextResponse = UsageModelsResult; -/** - * Contains response data for the list operation. - */ -export type OperationsListResponse = ApiOperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApiOperationListResult; - }; -}; +/** Optional parameters. */ +export interface AscOperationsGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listNext operation. - */ -export type OperationsListNextResponse = ApiOperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApiOperationListResult; - }; -}; +/** Contains response data for the get operation. */ +export type AscOperationsGetResponse = AscOperation; -/** - * Contains response data for the list operation. - */ -export type SkusListResponse = ResourceSkusResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ResourceSkusResult; - }; -}; +/** Optional parameters. */ +export interface CachesListOptionalParams extends coreClient.OperationOptions {} -/** - * Contains response data for the listNext operation. - */ -export type SkusListNextResponse = ResourceSkusResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ResourceSkusResult; - }; -}; +/** Contains response data for the list operation. */ +export type CachesListResponse = CachesListResult; -/** - * Contains response data for the list operation. - */ -export type UsageModelsListResponse = UsageModelsResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: UsageModelsResult; - }; -}; +/** Optional parameters. */ +export interface CachesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listNext operation. - */ -export type UsageModelsListNextResponse = UsageModelsResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: UsageModelsResult; - }; -}; +/** Contains response data for the listByResourceGroup operation. */ +export type CachesListByResourceGroupResponse = CachesListResult; -/** - * Contains response data for the get operation. - */ -export type AscOperationsGetResponse = AscOperation & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: AscOperation; - }; -}; +/** Optional parameters. */ +export interface CachesDeleteOptionalParams + 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 list operation. - */ -export type CachesListResponse = CachesListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CachesListResult; - }; -}; +/** Optional parameters. */ +export interface CachesGetOptionalParams extends coreClient.OperationOptions {} -/** - * Contains response data for the listByResourceGroup operation. - */ -export type CachesListByResourceGroupResponse = CachesListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CachesListResult; - }; -}; +/** Contains response data for the get operation. */ +export type CachesGetResponse = Cache; -/** - * Contains response data for the get operation. - */ -export type CachesGetResponse = Cache & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Cache; - }; -}; +/** Optional parameters. */ +export interface CachesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Object containing the user-selectable properties of the new Cache. If read-only properties are included, they must match the existing values of those properties. */ + cache?: Cache; + /** 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 createOrUpdate operation. - */ -export type CachesCreateOrUpdateResponse = Cache & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Cache; - }; -}; +/** Contains response data for the createOrUpdate operation. */ +export type CachesCreateOrUpdateResponse = Cache; -/** - * Contains response data for the update operation. - */ -export type CachesUpdateResponse = Cache & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Cache; - }; -}; +/** Optional parameters. */ +export interface CachesUpdateOptionalParams + extends coreClient.OperationOptions { + /** Object containing the user-selectable properties of the Cache. If read-only properties are included, they must match the existing values of those properties. */ + cache?: Cache; +} -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type CachesBeginCreateOrUpdateResponse = Cache & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Cache; - }; -}; +/** Contains response data for the update operation. */ +export type CachesUpdateResponse = Cache; -/** - * Contains response data for the listNext operation. - */ -export type CachesListNextResponse = CachesListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CachesListResult; - }; -}; +/** Optional parameters. */ +export interface CachesDebugInfoOptionalParams + 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 listByResourceGroupNext operation. - */ -export type CachesListByResourceGroupNextResponse = CachesListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CachesListResult; - }; -}; +/** Optional parameters. */ +export interface CachesFlushOptionalParams 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 listByCache operation. - */ -export type StorageTargetsListByCacheResponse = StorageTargetsResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTargetsResult; - }; -}; +/** Optional parameters. */ +export interface CachesStartOptionalParams 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 get operation. - */ -export type StorageTargetsGetResponse = StorageTarget & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTarget; - }; -}; +/** Optional parameters. */ +export interface CachesStopOptionalParams 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 createOrUpdate operation. - */ -export type StorageTargetsCreateOrUpdateResponse = StorageTarget & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTarget; - }; -}; +/** Optional parameters. */ +export interface CachesUpgradeFirmwareOptionalParams + 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 beginCreateOrUpdate operation. - */ -export type StorageTargetsBeginCreateOrUpdateResponse = StorageTarget & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTarget; - }; -}; +/** Optional parameters. */ +export interface CachesListNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listByCacheNext operation. - */ -export type StorageTargetsListByCacheNextResponse = StorageTargetsResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTargetsResult; - }; -}; +/** Contains response data for the listNext operation. */ +export type CachesListNextResponse = CachesListResult; + +/** Optional parameters. */ +export interface CachesListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type CachesListByResourceGroupNextResponse = CachesListResult; + +/** Optional parameters. */ +export interface StorageTargetsDnsRefreshOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageTargetsListByCacheOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCache operation. */ +export type StorageTargetsListByCacheResponse = StorageTargetsResult; + +/** Optional parameters. */ +export interface StorageTargetsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Boolean value requesting the force delete operation for a storage target. Force delete discards unwritten-data in the cache instead of flushing it to back-end storage. */ + force?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageTargetsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type StorageTargetsGetResponse = StorageTarget; + +/** Optional parameters. */ +export interface StorageTargetsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Object containing the definition of a Storage Target. */ + storagetarget?: StorageTarget; + /** 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 createOrUpdate operation. */ +export type StorageTargetsCreateOrUpdateResponse = StorageTarget; + +/** Optional parameters. */ +export interface StorageTargetsListByCacheNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCacheNext operation. */ +export type StorageTargetsListByCacheNextResponse = StorageTargetsResult; + +/** Optional parameters. */ +export interface StorageTargetFlushOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageTargetSuspendOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageTargetResumeOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageTargetInvalidateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageCacheManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/storagecache/arm-storagecache/src/models/mappers.ts b/sdk/storagecache/arm-storagecache/src/models/mappers.ts index ca2d43cbe9a1..a53b1087dbfd 100644 --- a/sdk/storagecache/arm-storagecache/src/models/mappers.ts +++ b/sdk/storagecache/arm-storagecache/src/models/mappers.ts @@ -6,82 +6,131 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; - -export const ApiOperationDisplay: msRest.CompositeMapper = { - serializedName: "ApiOperation_display", +export const ApiOperationListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ApiOperationDisplay", + className: "ApiOperationListResult", modelProperties: { - operation: { - serializedName: "operation", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - provider: { - serializedName: "provider", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApiOperation" + } + } + } + } + } + } +}; + +export const ApiOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiOperation", + modelProperties: { + display: { + serializedName: "display", + type: { + name: "Composite", + className: "ApiOperationDisplay" } }, - resource: { - serializedName: "resource", + origin: { + serializedName: "origin", type: { name: "String" } }, - description: { - serializedName: "description", + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + name: { + serializedName: "name", type: { name: "String" } + }, + serviceSpecification: { + serializedName: "properties.serviceSpecification", + type: { + name: "Composite", + className: "ApiOperationPropertiesServiceSpecification" + } } } } }; -export const MetricDimension: msRest.CompositeMapper = { - serializedName: "MetricDimension", +export const ApiOperationDisplay: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MetricDimension", + className: "ApiOperationDisplay", modelProperties: { - name: { - serializedName: "name", + operation: { + serializedName: "operation", type: { name: "String" } }, - displayName: { - serializedName: "displayName", + provider: { + serializedName: "provider", type: { name: "String" } }, - internalName: { - serializedName: "internalName", + resource: { + serializedName: "resource", type: { name: "String" } }, - toBeExportedForShoebox: { - serializedName: "toBeExportedForShoebox", + description: { + serializedName: "description", type: { - name: "Boolean" + name: "String" + } + } + } + } +}; + +export const ApiOperationPropertiesServiceSpecification: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiOperationPropertiesServiceSpecification", + modelProperties: { + metricSpecifications: { + serializedName: "metricSpecifications", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetricSpecification" + } + } } } } } }; -export const MetricSpecification: msRest.CompositeMapper = { - serializedName: "MetricSpecification", +export const MetricSpecification: coreClient.CompositeMapper = { type: { name: "Composite", className: "MetricSpecification", @@ -149,72 +198,56 @@ export const MetricSpecification: msRest.CompositeMapper = { } }; -export const ApiOperationPropertiesServiceSpecification: msRest.CompositeMapper = { - serializedName: "ApiOperation_properties_serviceSpecification", - type: { - name: "Composite", - className: "ApiOperationPropertiesServiceSpecification", - modelProperties: { - metricSpecifications: { - serializedName: "metricSpecifications", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MetricSpecification" - } - } - } - } - } - } -}; - -export const ApiOperation: msRest.CompositeMapper = { - serializedName: "ApiOperation", +export const MetricDimension: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ApiOperation", + className: "MetricDimension", modelProperties: { - display: { - serializedName: "display", + name: { + serializedName: "name", type: { - name: "Composite", - className: "ApiOperationDisplay" + name: "String" } }, - origin: { - serializedName: "origin", + displayName: { + serializedName: "displayName", type: { name: "String" } }, - isDataAction: { - serializedName: "isDataAction", + internalName: { + serializedName: "internalName", type: { - name: "Boolean" + name: "String" } }, - name: { - serializedName: "name", + toBeExportedForShoebox: { + serializedName: "toBeExportedForShoebox", type: { - name: "String" + name: "Boolean" } - }, - serviceSpecification: { - serializedName: "properties.serviceSpecification", + } + } + } +}; + +export const CloudError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudError", + modelProperties: { + error: { + serializedName: "error", type: { name: "Composite", - className: "ApiOperationPropertiesServiceSpecification" + className: "CloudErrorBody" } } } } }; -export const CloudErrorBody: msRest.CompositeMapper = { - serializedName: "CloudErrorBody", +export const CloudErrorBody: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudErrorBody", @@ -253,78 +286,96 @@ export const CloudErrorBody: msRest.CompositeMapper = { } }; -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", +export const ResourceSkusResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ErrorResponse", + className: "ResourceSkusResult", modelProperties: { - code: { - serializedName: "code", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - message: { - serializedName: "message", + value: { + serializedName: "value", + readOnly: true, type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceSku" + } + } } } } } }; -export const AscOperation: msRest.CompositeMapper = { - serializedName: "AscOperation", +export const ResourceSku: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AscOperation", + className: "ResourceSku", modelProperties: { - id: { - serializedName: "id", + resourceType: { + serializedName: "resourceType", + readOnly: true, type: { name: "String" } }, - name: { - serializedName: "name", + capabilities: { + serializedName: "capabilities", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceSkuCapabilities" + } + } } }, - startTime: { - serializedName: "startTime", + locations: { + serializedName: "locations", + readOnly: true, type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "String" + } + } } }, - endTime: { - serializedName: "endTime", + locationInfo: { + serializedName: "locationInfo", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceSkuLocationInfo" + } + } } }, - status: { - serializedName: "status", + name: { + serializedName: "name", type: { name: "String" } }, - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorResponse" - } - }, - output: { - serializedName: "properties.output", + restrictions: { + serializedName: "restrictions", type: { - name: "Dictionary", - value: { + name: "Sequence", + element: { type: { - name: "Object" + name: "Composite", + className: "Restriction" } } } @@ -333,102 +384,79 @@ export const AscOperation: msRest.CompositeMapper = { } }; -export const CacheIdentity: msRest.CompositeMapper = { - serializedName: "CacheIdentity", +export const ResourceSkuCapabilities: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheIdentity", + className: "ResourceSkuCapabilities", modelProperties: { - principalId: { - readOnly: true, - serializedName: "principalId", + name: { + serializedName: "name", type: { name: "String" } }, - tenantId: { - readOnly: true, - serializedName: "tenantId", + value: { + serializedName: "value", type: { name: "String" } - }, - type: { - serializedName: "type", - type: { - name: "Enum", - allowedValues: [ - "SystemAssigned", - "None" - ] - } } } } }; -export const SystemData: msRest.CompositeMapper = { - serializedName: "systemData", +export const ResourceSkuLocationInfo: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SystemData", + className: "ResourceSkuLocationInfo", modelProperties: { - createdBy: { - serializedName: "createdBy", - type: { - name: "String" - } - }, - createdByType: { - serializedName: "createdByType", - type: { - name: "String" - } - }, - createdAt: { - serializedName: "createdAt", - type: { - name: "DateTime" - } - }, - lastModifiedBy: { - serializedName: "lastModifiedBy", - type: { - name: "String" - } - }, - lastModifiedByType: { - serializedName: "lastModifiedByType", + location: { + serializedName: "location", type: { name: "String" } }, - lastModifiedAt: { - serializedName: "lastModifiedAt", + zones: { + serializedName: "zones", type: { - name: "DateTime" + name: "Sequence", + element: { + type: { + name: "String" + } + } } } } } }; -export const Condition: msRest.CompositeMapper = { - serializedName: "Condition", +export const Restriction: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Condition", + className: "Restriction", modelProperties: { - timestamp: { + type: { + serializedName: "type", readOnly: true, - serializedName: "timestamp", type: { - name: "DateTime" + name: "String" } }, - message: { + values: { + serializedName: "values", readOnly: true, - serializedName: "message", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + reasonCode: { + serializedName: "reasonCode", type: { name: "String" } @@ -437,33 +465,25 @@ export const Condition: msRest.CompositeMapper = { } }; -export const CacheHealth: msRest.CompositeMapper = { - serializedName: "CacheHealth", +export const UsageModelsResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheHealth", + className: "UsageModelsResult", modelProperties: { - state: { - serializedName: "state", - type: { - name: "String" - } - }, - statusDescription: { - serializedName: "statusDescription", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - conditions: { - readOnly: true, - serializedName: "conditions", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "Condition" + className: "UsageModel" } } } @@ -472,43 +492,41 @@ export const CacheHealth: msRest.CompositeMapper = { } }; -export const CacheUpgradeStatus: msRest.CompositeMapper = { - serializedName: "CacheUpgradeStatus", +export const UsageModel: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheUpgradeStatus", + className: "UsageModel", modelProperties: { - currentFirmwareVersion: { - readOnly: true, - serializedName: "currentFirmwareVersion", + display: { + serializedName: "display", type: { - name: "String" + name: "Composite", + className: "UsageModelDisplay" } }, - firmwareUpdateStatus: { - readOnly: true, - serializedName: "firmwareUpdateStatus", + modelName: { + serializedName: "modelName", type: { name: "String" } }, - firmwareUpdateDeadline: { - readOnly: true, - serializedName: "firmwareUpdateDeadline", - type: { - name: "DateTime" - } - }, - lastFirmwareUpdate: { - readOnly: true, - serializedName: "lastFirmwareUpdate", + targetType: { + serializedName: "targetType", type: { - name: "DateTime" + name: "String" } - }, - pendingFirmwareVersion: { - readOnly: true, - serializedName: "pendingFirmwareVersion", + } + } + } +}; + +export const UsageModelDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UsageModelDisplay", + modelProperties: { + description: { + serializedName: "description", type: { name: "String" } @@ -517,202 +535,252 @@ export const CacheUpgradeStatus: msRest.CompositeMapper = { } }; -export const CacheNetworkSettings: msRest.CompositeMapper = { - serializedName: "CacheNetworkSettings", +export const AscOperation: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheNetworkSettings", + className: "AscOperation", modelProperties: { - mtu: { - serializedName: "mtu", - defaultValue: 1500, - constraints: { - InclusiveMaximum: 1500, - InclusiveMinimum: 576 - }, + id: { + serializedName: "id", type: { - name: "Number" + name: "String" } }, - utilityAddresses: { - readOnly: true, - serializedName: "utilityAddresses", + name: { + serializedName: "name", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "String" } }, - dnsServers: { - serializedName: "dnsServers", + startTime: { + serializedName: "startTime", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "String" } }, - dnsSearchDomain: { - serializedName: "dnsSearchDomain", + endTime: { + serializedName: "endTime", type: { name: "String" } }, - ntpServer: { - serializedName: "ntpServer", + status: { + serializedName: "status", type: { name: "String" } - } - } - } -}; - -export const KeyVaultKeyReferenceSourceVault: msRest.CompositeMapper = { - serializedName: "KeyVaultKeyReference_sourceVault", - type: { - name: "Composite", - className: "KeyVaultKeyReferenceSourceVault", - modelProperties: { - id: { - serializedName: "id", + }, + error: { + serializedName: "error", type: { - name: "String" + name: "Composite", + className: "ErrorResponse" + } + }, + output: { + serializedName: "properties.output", + type: { + name: "Dictionary", + value: { + type: { name: "Dictionary", value: { type: { name: "any" } } } + } } } } } }; -export const KeyVaultKeyReference: msRest.CompositeMapper = { - serializedName: "KeyVaultKeyReference", +export const ErrorResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultKeyReference", + className: "ErrorResponse", modelProperties: { - keyUrl: { - required: true, - serializedName: "keyUrl", + code: { + serializedName: "code", type: { name: "String" } }, - sourceVault: { - required: true, - serializedName: "sourceVault", + message: { + serializedName: "message", type: { - name: "Composite", - className: "KeyVaultKeyReferenceSourceVault" + name: "String" } } } } }; -export const CacheEncryptionSettings: msRest.CompositeMapper = { - serializedName: "CacheEncryptionSettings", +export const CachesListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheEncryptionSettings", + className: "CachesListResult", modelProperties: { - keyEncryptionKey: { - serializedName: "keyEncryptionKey", + nextLink: { + serializedName: "nextLink", type: { - name: "Composite", - className: "KeyVaultKeyReference" + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Cache" + } + } } } } } }; -export const NfsAccessRule: msRest.CompositeMapper = { - serializedName: "NfsAccessRule", +export const Cache: coreClient.CompositeMapper = { type: { name: "Composite", - className: "NfsAccessRule", + className: "Cache", modelProperties: { - scope: { - required: true, - serializedName: "scope", + tags: { + serializedName: "tags", type: { - name: "String" + name: "Dictionary", + value: { type: { name: "String" } } } }, - filter: { - serializedName: "filter", + id: { + serializedName: "id", + readOnly: true, type: { name: "String" } }, - access: { - required: true, - serializedName: "access", + location: { + serializedName: "location", type: { name: "String" } }, - suid: { - serializedName: "suid", + name: { + constraints: { + Pattern: new RegExp("^[-0-9a-zA-Z_]{1,80}$") + }, + serializedName: "name", + readOnly: true, type: { - name: "Boolean" + name: "String" } }, - submountAccess: { - serializedName: "submountAccess", + type: { + serializedName: "type", + readOnly: true, type: { - name: "Boolean" + name: "String" } }, - rootSquash: { - serializedName: "rootSquash", + identity: { + serializedName: "identity", type: { - name: "Boolean" + name: "Composite", + className: "CacheIdentity" } }, - anonymousUID: { - serializedName: "anonymousUID", + systemData: { + serializedName: "systemData", type: { - name: "String" + name: "Composite", + className: "SystemData" } }, - anonymousGID: { - serializedName: "anonymousGID", + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "CacheSku" + } + }, + cacheSizeGB: { + serializedName: "properties.cacheSizeGB", + type: { + name: "Number" + } + }, + health: { + serializedName: "properties.health", + type: { + name: "Composite", + className: "CacheHealth" + } + }, + mountAddresses: { + serializedName: "properties.mountAddresses", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, type: { name: "String" } - } - } - } -}; - -export const NfsAccessPolicy: msRest.CompositeMapper = { - serializedName: "NfsAccessPolicy", - type: { - name: "Composite", - className: "NfsAccessPolicy", - modelProperties: { - name: { - required: true, - serializedName: "name", + }, + subnet: { + serializedName: "properties.subnet", type: { name: "String" } }, - accessRules: { - required: true, - serializedName: "accessRules", + upgradeStatus: { + serializedName: "properties.upgradeStatus", + type: { + name: "Composite", + className: "CacheUpgradeStatus" + } + }, + networkSettings: { + serializedName: "properties.networkSettings", + type: { + name: "Composite", + className: "CacheNetworkSettings" + } + }, + encryptionSettings: { + serializedName: "properties.encryptionSettings", + type: { + name: "Composite", + className: "CacheEncryptionSettings" + } + }, + securitySettings: { + serializedName: "properties.securitySettings", + type: { + name: "Composite", + className: "CacheSecuritySettings" + } + }, + directoryServicesSettings: { + serializedName: "properties.directoryServicesSettings", + type: { + name: "Composite", + className: "CacheDirectorySettings" + } + }, + zones: { + serializedName: "properties.zones", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "NfsAccessRule" + name: "String" } } } @@ -721,20 +789,45 @@ export const NfsAccessPolicy: msRest.CompositeMapper = { } }; -export const CacheSecuritySettings: msRest.CompositeMapper = { - serializedName: "CacheSecuritySettings", +export const CacheIdentity: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheSecuritySettings", + className: "CacheIdentity", modelProperties: { - accessPolicies: { - serializedName: "accessPolicies", + principalId: { + serializedName: "principalId", + readOnly: true, type: { - name: "Sequence", - element: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "Enum", + allowedValues: [ + "SystemAssigned", + "UserAssigned", + "SystemAssigned, UserAssigned", + "None" + ] + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { type: { name: "Composite", - className: "NfsAccessPolicy" + className: "UserAssignedIdentitiesValue" } } } @@ -743,22 +836,21 @@ export const CacheSecuritySettings: msRest.CompositeMapper = { } }; -export const CacheActiveDirectorySettingsCredentials: msRest.CompositeMapper = { - serializedName: "CacheActiveDirectorySettings_credentials", +export const UserAssignedIdentitiesValue: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheActiveDirectorySettingsCredentials", + className: "UserAssignedIdentitiesValue", modelProperties: { - username: { - required: true, - serializedName: "username", + principalId: { + serializedName: "principalId", + readOnly: true, type: { name: "String" } }, - password: { - required: true, - serializedName: "password", + clientId: { + serializedName: "clientId", + readOnly: true, type: { name: "String" } @@ -767,81 +859,100 @@ export const CacheActiveDirectorySettingsCredentials: msRest.CompositeMapper = { } }; -export const CacheActiveDirectorySettings: msRest.CompositeMapper = { - serializedName: "CacheActiveDirectorySettings", +export const SystemData: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheActiveDirectorySettings", + className: "SystemData", modelProperties: { - primaryDnsIpAddress: { - required: true, - serializedName: "primaryDnsIpAddress", + createdBy: { + serializedName: "createdBy", type: { name: "String" } }, - secondaryDnsIpAddress: { - serializedName: "secondaryDnsIpAddress", + createdByType: { + serializedName: "createdByType", type: { name: "String" } }, - domainName: { - required: true, - serializedName: "domainName", + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", type: { name: "String" } }, - domainNetBiosName: { - required: true, - serializedName: "domainNetBiosName", + lastModifiedByType: { + serializedName: "lastModifiedByType", type: { name: "String" } }, - cacheNetBiosName: { - required: true, - serializedName: "cacheNetBiosName", - constraints: { - Pattern: /^[-0-9a-zA-Z]{1,15}$/ - }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const CacheHealth: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CacheHealth", + modelProperties: { + state: { + serializedName: "state", type: { name: "String" } }, - domainJoined: { - readOnly: true, - serializedName: "domainJoined", + statusDescription: { + serializedName: "statusDescription", type: { name: "String" } }, - credentials: { - serializedName: "credentials", + conditions: { + serializedName: "conditions", + readOnly: true, type: { - name: "Composite", - className: "CacheActiveDirectorySettingsCredentials" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Condition" + } + } } } } } }; -export const CacheUsernameDownloadSettingsCredentials: msRest.CompositeMapper = { - serializedName: "CacheUsernameDownloadSettings_credentials", +export const Condition: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheUsernameDownloadSettingsCredentials", + className: "Condition", modelProperties: { - bindDn: { - serializedName: "bindDn", + timestamp: { + serializedName: "timestamp", + readOnly: true, type: { - name: "String" + name: "DateTime" } }, - bindPassword: { - serializedName: "bindPassword", + message: { + serializedName: "message", + readOnly: true, type: { name: "String" } @@ -850,123 +961,158 @@ export const CacheUsernameDownloadSettingsCredentials: msRest.CompositeMapper = } }; -export const CacheUsernameDownloadSettings: msRest.CompositeMapper = { - serializedName: "CacheUsernameDownloadSettings", +export const CacheUpgradeStatus: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheUsernameDownloadSettings", + className: "CacheUpgradeStatus", modelProperties: { - extendedGroups: { - serializedName: "extendedGroups", + currentFirmwareVersion: { + serializedName: "currentFirmwareVersion", + readOnly: true, type: { - name: "Boolean" + name: "String" } }, - usernameSource: { - serializedName: "usernameSource", - defaultValue: 'None', + firmwareUpdateStatus: { + serializedName: "firmwareUpdateStatus", + readOnly: true, type: { name: "String" } }, - groupFileURI: { - serializedName: "groupFileURI", + firmwareUpdateDeadline: { + serializedName: "firmwareUpdateDeadline", + readOnly: true, type: { - name: "String" + name: "DateTime" } }, - userFileURI: { - serializedName: "userFileURI", + lastFirmwareUpdate: { + serializedName: "lastFirmwareUpdate", + readOnly: true, type: { - name: "String" + name: "DateTime" } }, - ldapServer: { - serializedName: "ldapServer", + pendingFirmwareVersion: { + serializedName: "pendingFirmwareVersion", + readOnly: true, type: { name: "String" } - }, - ldapBaseDN: { - serializedName: "ldapBaseDN", + } + } + } +}; + +export const CacheNetworkSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CacheNetworkSettings", + modelProperties: { + mtu: { + defaultValue: 1500, + constraints: { + InclusiveMaximum: 1500, + InclusiveMinimum: 576 + }, + serializedName: "mtu", type: { - name: "String" + name: "Number" } }, - encryptLdapConnection: { - serializedName: "encryptLdapConnection", + utilityAddresses: { + serializedName: "utilityAddresses", + readOnly: true, type: { - name: "Boolean" + name: "Sequence", + element: { + type: { + name: "String" + } + } } }, - requireValidCertificate: { - serializedName: "requireValidCertificate", + dnsServers: { + serializedName: "dnsServers", type: { - name: "Boolean" + name: "Sequence", + element: { + type: { + name: "String" + } + } } }, - autoDownloadCertificate: { - serializedName: "autoDownloadCertificate", + dnsSearchDomain: { + serializedName: "dnsSearchDomain", type: { - name: "Boolean" + name: "String" } }, - caCertificateURI: { - serializedName: "caCertificateURI", + ntpServer: { + defaultValue: "time.windows.com", + serializedName: "ntpServer", type: { name: "String" } - }, - usernameDownloaded: { - readOnly: true, - serializedName: "usernameDownloaded", + } + } + } +}; + +export const CacheEncryptionSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CacheEncryptionSettings", + modelProperties: { + keyEncryptionKey: { + serializedName: "keyEncryptionKey", type: { - name: "String" + name: "Composite", + className: "KeyVaultKeyReference" } }, - credentials: { - serializedName: "credentials", + rotationToLatestKeyVersionEnabled: { + serializedName: "rotationToLatestKeyVersionEnabled", type: { - name: "Composite", - className: "CacheUsernameDownloadSettingsCredentials" + name: "Boolean" } } } } }; -export const CacheDirectorySettings: msRest.CompositeMapper = { - serializedName: "CacheDirectorySettings", +export const KeyVaultKeyReference: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheDirectorySettings", + className: "KeyVaultKeyReference", modelProperties: { - activeDirectory: { - serializedName: "activeDirectory", + keyUrl: { + serializedName: "keyUrl", + required: true, type: { - name: "Composite", - className: "CacheActiveDirectorySettings" + name: "String" } }, - usernameDownload: { - serializedName: "usernameDownload", + sourceVault: { + serializedName: "sourceVault", type: { name: "Composite", - className: "CacheUsernameDownloadSettings" + className: "KeyVaultKeyReferenceSourceVault" } } } } }; -export const CacheSku: msRest.CompositeMapper = { - serializedName: "Cache_sku", +export const KeyVaultKeyReferenceSourceVault: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheSku", + className: "KeyVaultKeyReferenceSourceVault", modelProperties: { - name: { - serializedName: "name", + id: { + serializedName: "id", type: { name: "String" } @@ -975,259 +1121,213 @@ export const CacheSku: msRest.CompositeMapper = { } }; -export const Cache: msRest.CompositeMapper = { - serializedName: "Cache", +export const CacheSecuritySettings: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Cache", + className: "CacheSecuritySettings", modelProperties: { - tags: { - serializedName: "tags", + accessPolicies: { + serializedName: "accessPolicies", type: { - name: "Dictionary", - value: { + name: "Sequence", + element: { type: { - name: "String" + name: "Composite", + className: "NfsAccessPolicy" } } } - }, - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } - }, + } + } + } +}; + +export const NfsAccessPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NfsAccessPolicy", + modelProperties: { name: { - readOnly: true, serializedName: "name", + required: true, type: { name: "String" } }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "CacheIdentity" - } - }, - systemData: { - readOnly: true, - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, - cacheSizeGB: { - serializedName: "properties.cacheSizeGB", - type: { - name: "Number" - } - }, - health: { - readOnly: true, - serializedName: "properties.health", - type: { - name: "Composite", - className: "CacheHealth" - } - }, - mountAddresses: { - readOnly: true, - serializedName: "properties.mountAddresses", + accessRules: { + serializedName: "accessRules", + required: true, type: { name: "Sequence", element: { type: { - name: "String" + name: "Composite", + className: "NfsAccessRule" } } } + } + } + } +}; + +export const NfsAccessRule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NfsAccessRule", + modelProperties: { + scope: { + serializedName: "scope", + required: true, + type: { + name: "String" + } }, - provisioningState: { - serializedName: "properties.provisioningState", + filter: { + serializedName: "filter", type: { name: "String" } }, - subnet: { - serializedName: "properties.subnet", + access: { + serializedName: "access", + required: true, type: { name: "String" } }, - upgradeStatus: { - serializedName: "properties.upgradeStatus", + suid: { + serializedName: "suid", type: { - name: "Composite", - className: "CacheUpgradeStatus" + name: "Boolean" } }, - networkSettings: { - serializedName: "properties.networkSettings", + submountAccess: { + serializedName: "submountAccess", type: { - name: "Composite", - className: "CacheNetworkSettings" + name: "Boolean" } }, - encryptionSettings: { - serializedName: "properties.encryptionSettings", + rootSquash: { + serializedName: "rootSquash", type: { - name: "Composite", - className: "CacheEncryptionSettings" + name: "Boolean" } }, - securitySettings: { - serializedName: "properties.securitySettings", + anonymousUID: { + serializedName: "anonymousUID", type: { - name: "Composite", - className: "CacheSecuritySettings" + name: "String" } }, - directoryServicesSettings: { - serializedName: "properties.directoryServicesSettings", + anonymousGID: { + serializedName: "anonymousGID", + type: { + name: "String" + } + } + } + } +}; + +export const CacheDirectorySettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CacheDirectorySettings", + modelProperties: { + activeDirectory: { + serializedName: "activeDirectory", type: { name: "Composite", - className: "CacheDirectorySettings" + className: "CacheActiveDirectorySettings" } }, - sku: { - serializedName: "sku", + usernameDownload: { + serializedName: "usernameDownload", type: { name: "Composite", - className: "CacheSku" + className: "CacheUsernameDownloadSettings" } } } } }; -export const NamespaceJunction: msRest.CompositeMapper = { - serializedName: "NamespaceJunction", +export const CacheActiveDirectorySettings: coreClient.CompositeMapper = { type: { name: "Composite", - className: "NamespaceJunction", + className: "CacheActiveDirectorySettings", modelProperties: { - namespacePath: { - serializedName: "namespacePath", + primaryDnsIpAddress: { + serializedName: "primaryDnsIpAddress", + required: true, type: { name: "String" } }, - targetPath: { - serializedName: "targetPath", + secondaryDnsIpAddress: { + serializedName: "secondaryDnsIpAddress", type: { name: "String" } }, - nfsExport: { - serializedName: "nfsExport", + domainName: { + serializedName: "domainName", + required: true, type: { name: "String" } }, - nfsAccessPolicy: { - serializedName: "nfsAccessPolicy", + domainNetBiosName: { + serializedName: "domainNetBiosName", + required: true, type: { name: "String" } - } - } - } -}; - -export const Nfs3Target: msRest.CompositeMapper = { - serializedName: "Nfs3Target", - type: { - name: "Composite", - className: "Nfs3Target", - modelProperties: { - target: { - serializedName: "target", + }, + cacheNetBiosName: { constraints: { - Pattern: /^[-.0-9a-zA-Z]+$/ + Pattern: new RegExp("^[-0-9a-zA-Z]{1,15}$") }, + serializedName: "cacheNetBiosName", + required: true, type: { name: "String" } }, - usageModel: { - serializedName: "usageModel", - type: { - name: "String" - } - } - } - } -}; - -export const ClfsTarget: msRest.CompositeMapper = { - serializedName: "ClfsTarget", - type: { - name: "Composite", - className: "ClfsTarget", - modelProperties: { - target: { - serializedName: "target", + domainJoined: { + serializedName: "domainJoined", + readOnly: true, type: { name: "String" } - } - } - } -}; - -export const UnknownTarget: msRest.CompositeMapper = { - serializedName: "UnknownTarget", - type: { - name: "Composite", - className: "UnknownTarget", - modelProperties: { - attributes: { - serializedName: "attributes", + }, + credentials: { + serializedName: "credentials", type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } + name: "Composite", + className: "CacheActiveDirectorySettingsCredentials" } } } } }; -export const BlobNfsTarget: msRest.CompositeMapper = { - serializedName: "BlobNfsTarget", +export const CacheActiveDirectorySettingsCredentials: coreClient.CompositeMapper = { type: { name: "Composite", - className: "BlobNfsTarget", + className: "CacheActiveDirectorySettingsCredentials", modelProperties: { - target: { - serializedName: "target", + username: { + serializedName: "username", + required: true, type: { name: "String" } }, - usageModel: { - serializedName: "usageModel", + password: { + serializedName: "password", + required: true, type: { name: "String" } @@ -1236,192 +1336,118 @@ export const BlobNfsTarget: msRest.CompositeMapper = { } }; -export const StorageTargetResource: msRest.CompositeMapper = { - serializedName: "StorageTargetResource", +export const CacheUsernameDownloadSettings: coreClient.CompositeMapper = { type: { name: "Composite", - className: "StorageTargetResource", + className: "CacheUsernameDownloadSettings", modelProperties: { - name: { - readOnly: true, - serializedName: "name", + extendedGroups: { + serializedName: "extendedGroups", type: { - name: "String" + name: "Boolean" } }, - id: { - readOnly: true, - serializedName: "id", + usernameSource: { + defaultValue: "None", + serializedName: "usernameSource", type: { name: "String" } }, - type: { - readOnly: true, - serializedName: "type", + groupFileURI: { + serializedName: "groupFileURI", type: { name: "String" } }, - location: { - readOnly: true, - serializedName: "location", + userFileURI: { + serializedName: "userFileURI", type: { name: "String" } }, - systemData: { - readOnly: true, - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const StorageTarget: msRest.CompositeMapper = { - serializedName: "StorageTarget", - type: { - name: "Composite", - className: "StorageTarget", - modelProperties: { - ...StorageTargetResource.type.modelProperties, - junctions: { - serializedName: "properties.junctions", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NamespaceJunction" - } - } - } - }, - targetType: { - required: true, - serializedName: "properties.targetType", + ldapServer: { + serializedName: "ldapServer", type: { name: "String" } }, - provisioningState: { - serializedName: "properties.provisioningState", + ldapBaseDN: { + serializedName: "ldapBaseDN", type: { name: "String" } }, - nfs3: { - serializedName: "properties.nfs3", + encryptLdapConnection: { + serializedName: "encryptLdapConnection", type: { - name: "Composite", - className: "Nfs3Target" + name: "Boolean" } }, - clfs: { - serializedName: "properties.clfs", + requireValidCertificate: { + serializedName: "requireValidCertificate", type: { - name: "Composite", - className: "ClfsTarget" + name: "Boolean" } }, - unknown: { - serializedName: "properties.unknown", + autoDownloadCertificate: { + serializedName: "autoDownloadCertificate", type: { - name: "Composite", - className: "UnknownTarget" + name: "Boolean" } }, - blobNfs: { - serializedName: "properties.blobNfs", + caCertificateURI: { + serializedName: "caCertificateURI", type: { - name: "Composite", - className: "BlobNfsTarget" + name: "String" } - } - } - } -}; - -export const ResourceSkuCapabilities: msRest.CompositeMapper = { - serializedName: "ResourceSkuCapabilities", - type: { - name: "Composite", - className: "ResourceSkuCapabilities", - modelProperties: { - name: { - serializedName: "name", + }, + usernameDownloaded: { + serializedName: "usernameDownloaded", + readOnly: true, type: { name: "String" } }, - value: { - serializedName: "value", + credentials: { + serializedName: "credentials", type: { - name: "String" + name: "Composite", + className: "CacheUsernameDownloadSettingsCredentials" } } } } }; -export const ResourceSkuLocationInfo: msRest.CompositeMapper = { - serializedName: "ResourceSkuLocationInfo", +export const CacheUsernameDownloadSettingsCredentials: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ResourceSkuLocationInfo", + className: "CacheUsernameDownloadSettingsCredentials", modelProperties: { - location: { - serializedName: "location", + bindDn: { + serializedName: "bindDn", type: { name: "String" } }, - zones: { - serializedName: "zones", + bindPassword: { + serializedName: "bindPassword", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "String" } } } } -}; - -export const Restriction: msRest.CompositeMapper = { - serializedName: "Restriction", - type: { - name: "Composite", - className: "Restriction", - modelProperties: { - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - values: { - readOnly: true, - serializedName: "values", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - reasonCode: { - serializedName: "reasonCode", +}; + +export const CacheSku: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CacheSku", + modelProperties: { + name: { + serializedName: "name", type: { name: "String" } @@ -1430,85 +1456,83 @@ export const Restriction: msRest.CompositeMapper = { } }; -export const ResourceSku: msRest.CompositeMapper = { - serializedName: "ResourceSku", +export const StorageTargetsResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ResourceSku", + className: "StorageTargetsResult", modelProperties: { - resourceType: { - readOnly: true, - serializedName: "resourceType", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - capabilities: { - serializedName: "capabilities", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ResourceSkuCapabilities" + className: "StorageTarget" } } } - }, - locations: { - readOnly: true, - serializedName: "locations", + } + } + } +}; + +export const NamespaceJunction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NamespaceJunction", + modelProperties: { + namespacePath: { + serializedName: "namespacePath", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "String" } }, - locationInfo: { - serializedName: "locationInfo", + targetPath: { + serializedName: "targetPath", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourceSkuLocationInfo" - } - } + name: "String" } }, - name: { - serializedName: "name", + nfsExport: { + serializedName: "nfsExport", type: { name: "String" } }, - restrictions: { - serializedName: "restrictions", + nfsAccessPolicy: { + defaultValue: "default", + serializedName: "nfsAccessPolicy", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Restriction" - } - } + name: "String" } } } } }; -export const UsageModelDisplay: msRest.CompositeMapper = { - serializedName: "UsageModel_display", +export const Nfs3Target: coreClient.CompositeMapper = { type: { name: "Composite", - className: "UsageModelDisplay", + className: "Nfs3Target", modelProperties: { - description: { - serializedName: "description", + target: { + constraints: { + Pattern: new RegExp("^[-.,0-9a-zA-Z]+$") + }, + serializedName: "target", + type: { + name: "String" + } + }, + usageModel: { + serializedName: "usageModel", type: { name: "String" } @@ -1517,27 +1541,13 @@ export const UsageModelDisplay: msRest.CompositeMapper = { } }; -export const UsageModel: msRest.CompositeMapper = { - serializedName: "UsageModel", +export const ClfsTarget: coreClient.CompositeMapper = { type: { name: "Composite", - className: "UsageModel", + className: "ClfsTarget", modelProperties: { - display: { - serializedName: "display", - type: { - name: "Composite", - className: "UsageModelDisplay" - } - }, - modelName: { - serializedName: "modelName", - type: { - name: "String" - } - }, - targetType: { - serializedName: "targetType", + target: { + serializedName: "target", type: { name: "String" } @@ -1546,142 +1556,154 @@ export const UsageModel: msRest.CompositeMapper = { } }; -export const ApiOperationListResult: msRest.CompositeMapper = { - serializedName: "ApiOperationListResult", +export const UnknownTarget: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ApiOperationListResult", + className: "UnknownTarget", modelProperties: { - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - value: { - serializedName: "", + attributes: { + serializedName: "attributes", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ApiOperation" - } - } + name: "Dictionary", + value: { type: { name: "String" } } } } } } }; -export const ResourceSkusResult: msRest.CompositeMapper = { - serializedName: "ResourceSkusResult", +export const BlobNfsTarget: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ResourceSkusResult", + className: "BlobNfsTarget", modelProperties: { - nextLink: { - serializedName: "nextLink", + target: { + serializedName: "target", type: { name: "String" } }, - value: { - readOnly: true, - serializedName: "", + usageModel: { + serializedName: "usageModel", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourceSku" - } - } + name: "String" } } } } }; -export const UsageModelsResult: msRest.CompositeMapper = { - serializedName: "UsageModelsResult", +export const StorageTargetResource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "UsageModelsResult", + className: "StorageTargetResource", modelProperties: { - nextLink: { - serializedName: "nextLink", + name: { + constraints: { + Pattern: new RegExp("^[-0-9a-zA-Z_]{1,80}$") + }, + serializedName: "name", + readOnly: true, type: { name: "String" } }, - value: { - serializedName: "", + id: { + serializedName: "id", + readOnly: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "UsageModel" - } - } + name: "String" } - } - } - } -}; - -export const CachesListResult: msRest.CompositeMapper = { - serializedName: "CachesListResult", - type: { - name: "Composite", - className: "CachesListResult", - modelProperties: { - nextLink: { - serializedName: "nextLink", + }, + type: { + serializedName: "type", + readOnly: true, type: { name: "String" } }, - value: { - serializedName: "", + location: { + serializedName: "location", + readOnly: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Cache" - } - } + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" } } } } }; -export const StorageTargetsResult: msRest.CompositeMapper = { - serializedName: "StorageTargetsResult", +export const StorageTarget: coreClient.CompositeMapper = { type: { name: "Composite", - className: "StorageTargetsResult", + className: "StorageTarget", modelProperties: { - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - value: { - serializedName: "", + ...StorageTargetResource.type.modelProperties, + junctions: { + serializedName: "properties.junctions", type: { name: "Sequence", element: { type: { name: "Composite", - className: "StorageTarget" + className: "NamespaceJunction" } } } + }, + targetType: { + serializedName: "properties.targetType", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + state: { + serializedName: "properties.state", + type: { + name: "String" + } + }, + nfs3: { + serializedName: "properties.nfs3", + type: { + name: "Composite", + className: "Nfs3Target" + } + }, + clfs: { + serializedName: "properties.clfs", + type: { + name: "Composite", + className: "ClfsTarget" + } + }, + unknown: { + serializedName: "properties.unknown", + type: { + name: "Composite", + className: "UnknownTarget" + } + }, + blobNfs: { + serializedName: "properties.blobNfs", + type: { + name: "Composite", + className: "BlobNfsTarget" + } } } } diff --git a/sdk/storagecache/arm-storagecache/src/models/operationsMappers.ts b/sdk/storagecache/arm-storagecache/src/models/operationsMappers.ts deleted file mode 100644 index c7bc36f65319..000000000000 --- a/sdk/storagecache/arm-storagecache/src/models/operationsMappers.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the 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 { - ApiOperation, - ApiOperationDisplay, - ApiOperationListResult, - ApiOperationPropertiesServiceSpecification, - CloudError, - MetricDimension, - MetricSpecification -} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/models/parameters.ts b/sdk/storagecache/arm-storagecache/src/models/parameters.ts index f59cdb795e2c..4754e14e32fc 100644 --- a/sdk/storagecache/arm-storagecache/src/models/parameters.ts +++ b/sdk/storagecache/arm-storagecache/src/models/parameters.ts @@ -3,106 +3,167 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + Cache as CacheMapper, + StorageTarget as StorageTargetMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-01-01", + isConstant: true, serializedName: "api-version", type: { name: "String" } } }; -export const cacheName: msRest.OperationURLParameter = { - parameterPath: "cacheName", + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { + serializedName: "nextLink", required: true, - serializedName: "cacheName", - constraints: { - Pattern: /^[-0-9a-zA-Z_]{1,80}$/ - }, type: { name: "String" } - } + }, + skipEncoding: true }; -export const location: msRest.OperationURLParameter = { - parameterPath: "location", + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", mapper: { + serializedName: "subscriptionId", required: true, - serializedName: "location", type: { name: "String" } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", + +export const location: OperationURLParameter = { + parameterPath: "location", mapper: { + serializedName: "location", required: true, - serializedName: "nextLink", type: { name: "String" } - }, - skipEncoding: true + } }; -export const operationId: msRest.OperationURLParameter = { + +export const operationId: OperationURLParameter = { parameterPath: "operationId", mapper: { - required: true, serializedName: "operationId", + required: true, type: { name: "String" } } }; -export const resourceGroupName: msRest.OperationURLParameter = { + +export const resourceGroupName: OperationURLParameter = { parameterPath: "resourceGroupName", mapper: { - required: true, serializedName: "resourceGroupName", + required: true, type: { name: "String" } } }; -export const storageTargetName: msRest.OperationURLParameter = { - parameterPath: "storageTargetName", + +export const cacheName: OperationURLParameter = { + parameterPath: "cacheName", mapper: { - required: true, - serializedName: "storageTargetName", constraints: { - Pattern: /^[-0-9a-zA-Z_]{1,80}$/ + Pattern: new RegExp("^[-0-9a-zA-Z_]{1,80}$") }, + serializedName: "cacheName", + required: true, type: { name: "String" } } }; -export const subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const cache: OperationParameter = { + parameterPath: ["options", "cache"], + mapper: CacheMapper +}; + +export const storageTargetName: OperationURLParameter = { + parameterPath: "storageTargetName", + mapper: { + constraints: { + Pattern: new RegExp("^[-0-9a-zA-Z_]{1,80}$") + }, + serializedName: "storageTargetName", required: true, - serializedName: "subscriptionId", type: { name: "String" } } }; + +export const force: OperationQueryParameter = { + parameterPath: ["options", "force"], + mapper: { + serializedName: "force", + type: { + name: "String" + } + } +}; + +export const storagetarget: OperationParameter = { + parameterPath: ["options", "storagetarget"], + mapper: StorageTargetMapper +}; diff --git a/sdk/storagecache/arm-storagecache/src/models/storageTargetsMappers.ts b/sdk/storagecache/arm-storagecache/src/models/storageTargetsMappers.ts deleted file mode 100644 index ef6ef98db327..000000000000 --- a/sdk/storagecache/arm-storagecache/src/models/storageTargetsMappers.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the 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 { - BaseResource, - BlobNfsTarget, - Cache, - CacheActiveDirectorySettings, - CacheActiveDirectorySettingsCredentials, - CacheDirectorySettings, - CacheEncryptionSettings, - CacheHealth, - CacheIdentity, - CacheNetworkSettings, - CacheSecuritySettings, - CacheSku, - CacheUpgradeStatus, - CacheUsernameDownloadSettings, - CacheUsernameDownloadSettingsCredentials, - ClfsTarget, - CloudError, - Condition, - KeyVaultKeyReference, - KeyVaultKeyReferenceSourceVault, - NamespaceJunction, - Nfs3Target, - NfsAccessPolicy, - NfsAccessRule, - StorageTarget, - StorageTargetResource, - StorageTargetsResult, - SystemData, - UnknownTarget -} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/models/usageModelsMappers.ts b/sdk/storagecache/arm-storagecache/src/models/usageModelsMappers.ts deleted file mode 100644 index 2693d7cf34c6..000000000000 --- a/sdk/storagecache/arm-storagecache/src/models/usageModelsMappers.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the 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 { - CloudError, - UsageModel, - UsageModelDisplay, - UsageModelsResult -} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts b/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts index 08840b3e109a..c3951b4ac34a 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts @@ -3,25 +3,28 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/ascOperationsMappers"; +import { AscOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { + AscOperationsGetOptionalParams, + AscOperationsGetResponse +} from "../models"; -/** Class representing a AscOperations. */ -export class AscOperations { - private readonly client: StorageCacheManagementClientContext; +/** Class containing AscOperations operations. */ +export class AscOperationsImpl implements AscOperations { + private readonly client: StorageCacheManagementClient; /** - * Create a AscOperations. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class AscOperations class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } @@ -29,51 +32,26 @@ export class AscOperations { * Gets the status of an asynchronous operation for the Azure HPC Cache * @param location The name of the region used to look up the operation. * @param operationId The operation id which uniquely identifies the asynchronous operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(location: string, operationId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param location The name of the region used to look up the operation. - * @param operationId The operation id which uniquely identifies the asynchronous operation. - * @param callback The callback - */ - get(location: string, operationId: string, callback: msRest.ServiceCallback): void; - /** - * @param location The name of the region used to look up the operation. - * @param operationId The operation id which uniquely identifies the asynchronous operation. - * @param options The optional parameters - * @param callback The callback - */ - get(location: string, operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(location: string, operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + location: string, + operationId: string, + options?: AscOperationsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - location, - operationId, - options - }, - getOperationSpec, - callback) as Promise; + { location, operationId, options }, + getOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.location, - Parameters.operationId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.AscOperation @@ -82,5 +60,13 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.location, + Parameters.operationId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/caches.ts b/sdk/storagecache/arm-storagecache/src/operations/caches.ts index e305fdff225d..8c54767cbeb2 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/caches.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/caches.ts @@ -3,450 +3,823 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/cachesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Caches } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + Cache, + CachesListNextOptionalParams, + CachesListOptionalParams, + CachesListByResourceGroupNextOptionalParams, + CachesListByResourceGroupOptionalParams, + CachesListResponse, + CachesListByResourceGroupResponse, + CachesDeleteOptionalParams, + CachesGetOptionalParams, + CachesGetResponse, + CachesCreateOrUpdateOptionalParams, + CachesCreateOrUpdateResponse, + CachesUpdateOptionalParams, + CachesUpdateResponse, + CachesDebugInfoOptionalParams, + CachesFlushOptionalParams, + CachesStartOptionalParams, + CachesStopOptionalParams, + CachesUpgradeFirmwareOptionalParams, + CachesListNextResponse, + CachesListByResourceGroupNextResponse +} from "../models"; -/** Class representing a Caches. */ -export class Caches { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing Caches operations. */ +export class CachesImpl implements Caches { + private readonly client: StorageCacheManagementClient; /** - * Create a Caches. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Caches class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** * Returns all Caches the user has access to under a subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: CachesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - listOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: CachesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: CachesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Returns all Caches the user has access to under a resource group. * @param resourceGroupName Target resource group. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Target resource group. - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Target resource group. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public listByResourceGroup( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( resourceGroupName, + continuationToken, options - }, - listByResourceGroupOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } } - /** - * Schedules a Cache for deletion. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } } /** - * Returns a Cache. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - get(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param callback The callback + * Returns all Caches the user has access to under a subscription. + * @param options The options parameters. */ - get(resourceGroupName: string, cacheName: string, callback: msRest.ServiceCallback): void; + private _list( + options?: CachesListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** + * Returns all Caches the user has access to under a resource group. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(resourceGroupName: string, cacheName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByResourceGroup( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - cacheName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); } /** - * Create or update a Cache. + * Schedules a Cache for deletion. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, cacheName: string, options?: Models.CachesCreateOrUpdateOptionalParams): Promise { - return this.beginCreateOrUpdate(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginDelete( + resourceGroupName: string, + cacheName: string, + options?: CachesDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Update a Cache instance. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - update(resourceGroupName: string, cacheName: string, options?: Models.CachesUpdateOptionalParams): Promise; - /** + * Schedules a Cache for deletion. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param callback The callback + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - update(resourceGroupName: string, cacheName: string, callback: msRest.ServiceCallback): void; + async beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); + } + /** + * Returns a Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param options The optional parameters - * @param callback The callback + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - update(resourceGroupName: string, cacheName: string, options: Models.CachesUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, cacheName: string, options?: Models.CachesUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + cacheName: string, + options?: CachesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - cacheName, - options - }, - updateOperationSpec, - callback) as Promise; + { resourceGroupName, cacheName, options }, + getOperationSpec + ); } /** - * Tells a Cache to write generate debug info for support to process. + * Create or update a Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - debugInfo(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDebugInfo(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + async beginCreateOrUpdate( + resourceGroupName: string, + cacheName: string, + options?: CachesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CachesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will - * see errors returned until the flush is complete. + * Create or update a Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - flush(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginFlush(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); } /** - * Tells a Stopped state Cache to transition to Active state. + * Update a Cache instance. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - start(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginStart(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + update( + resourceGroupName: string, + cacheName: string, + options?: CachesUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, options }, + updateOperationSpec + ); } /** - * Tells an Active Cache to transition to Stopped state. + * Tells a Cache to write generate debug info for support to process. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - stop(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginStop(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + async beginDebugInfo( + resourceGroupName: string, + cacheName: string, + options?: CachesDebugInfoOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + debugInfoOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** - * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no - * effect. + * Tells a Cache to write generate debug info for support to process. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - upgradeFirmware(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginUpgradeFirmware(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + async beginDebugInfoAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesDebugInfoOptionalParams + ): Promise { + const poller = await this.beginDebugInfo( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); } /** - * Schedules a Cache for deletion. + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see + * errors returned until the flush is complete. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginDeleteMethod(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginDeleteMethodOperationSpec, - options); + async beginFlush( + resourceGroupName: string, + cacheName: string, + options?: CachesFlushOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + flushOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** - * Create or update a Cache. + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see + * errors returned until the flush is complete. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginCreateOrUpdate(resourceGroupName: string, cacheName: string, options?: Models.CachesBeginCreateOrUpdateOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginCreateOrUpdateOperationSpec, - options); + async beginFlushAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesFlushOptionalParams + ): Promise { + const poller = await this.beginFlush(resourceGroupName, cacheName, options); + return poller.pollUntilDone(); } /** - * Tells a Cache to write generate debug info for support to process. + * Tells a Stopped state Cache to transition to Active state. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginDebugInfo(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginDebugInfoOperationSpec, - options); + async beginStart( + resourceGroupName: string, + cacheName: string, + options?: CachesStartOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + startOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** - * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will - * see errors returned until the flush is complete. + * Tells a Stopped state Cache to transition to Active state. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginFlush(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginFlushOperationSpec, - options); + async beginStartAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesStartOptionalParams + ): Promise { + const poller = await this.beginStart(resourceGroupName, cacheName, options); + return poller.pollUntilDone(); } /** - * Tells a Stopped state Cache to transition to Active state. + * Tells an Active Cache to transition to Stopped state. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginStart(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginStartOperationSpec, - options); + async beginStop( + resourceGroupName: string, + cacheName: string, + options?: CachesStopOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + stopOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** * Tells an Active Cache to transition to Stopped state. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginStop(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginStopOperationSpec, - options); + async beginStopAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesStopOptionalParams + ): Promise { + const poller = await this.beginStop(resourceGroupName, cacheName, options); + return poller.pollUntilDone(); } /** - * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no - * effect. + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginUpgradeFirmware(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginUpgradeFirmwareOperationSpec, - options); + async beginUpgradeFirmware( + resourceGroupName: string, + cacheName: string, + options?: CachesUpgradeFirmwareOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + upgradeFirmwareOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** - * Returns all Caches the user has access to under a subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + async beginUpgradeFirmwareAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesUpgradeFirmwareOptionalParams + ): Promise { + const poller = await this.beginUpgradeFirmware( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: CachesListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } /** - * Returns all Caches the user has access to under a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListByResourceGroupNext + * @param resourceGroupName Target resource group. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. */ - listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: CachesListByResourceGroupNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByResourceGroupNextOperationSpec, - callback) as Promise; + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.CachesListResult @@ -455,22 +828,15 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.CachesListResult @@ -479,55 +845,42 @@ const listByResourceGroupOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, - Parameters.cacheName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + httpMethod: "DELETE", responses: { - 200: { - bodyMapper: Mappers.Cache - }, + 200: {}, + 201: {}, + 202: {}, + 204: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const updateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "cache" - ], - mapper: Mappers.Cache - }, + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Cache @@ -536,185 +889,171 @@ const updateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.cacheName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.cacheName ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + httpMethod: "PUT", responses: { - 200: {}, - 202: {}, - 204: {}, + 200: { + bodyMapper: Mappers.Cache + }, + 201: { + bodyMapper: Mappers.Cache + }, + 202: { + bodyMapper: Mappers.Cache + }, + 204: { + bodyMapper: Mappers.Cache + }, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + requestBody: Parameters.cache, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "cache" - ], - mapper: Mappers.Cache - }, + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.Cache }, - 201: { - bodyMapper: Mappers.Cache - }, - 202: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginDebugInfoOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo", + requestBody: Parameters.cache, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const debugInfoOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo", + httpMethod: "POST", responses: { 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginFlushOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const flushOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush", + httpMethod: "POST", responses: { 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginStartOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const startOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start", + httpMethod: "POST", responses: { 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginStopOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const stopOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop", + httpMethod: "POST", responses: { 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginUpgradeFirmwareOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const upgradeFirmwareOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade", + httpMethod: "POST", responses: { + 200: {}, 201: {}, 202: {}, 204: {}, @@ -722,22 +1061,19 @@ const beginUpgradeFirmwareOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.CachesListResult @@ -746,22 +1082,18 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.CachesListResult @@ -770,5 +1102,13 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/index.ts b/sdk/storagecache/arm-storagecache/src/operations/index.ts index e855b3e0869e..b254cecd4236 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/index.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/index.ts @@ -3,8 +3,7 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./operations"; @@ -13,3 +12,4 @@ export * from "./usageModels"; export * from "./ascOperations"; export * from "./caches"; export * from "./storageTargets"; +export * from "./storageTargetOperations"; diff --git a/sdk/storagecache/arm-storagecache/src/operations/operations.ts b/sdk/storagecache/arm-storagecache/src/operations/operations.ts index 5310858388ae..0c23b36dc4fa 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/operations.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/operations.ts @@ -3,92 +3,109 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { + ApiOperation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; -/** Class representing a Operations. */ -export class Operations { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: StorageCacheManagementClient; /** - * Create a Operations. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** * Lists all of the available Resource Provider operations. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - listOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Lists all of the available Resource Provider operations. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.StorageCache/operations", httpMethod: "GET", - path: "providers/Microsoft.StorageCache/operations", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ApiOperationListResult @@ -97,22 +114,14 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ApiOperationListResult @@ -121,5 +130,8 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/skus.ts b/sdk/storagecache/arm-storagecache/src/operations/skus.ts index 1a932a055c28..9f7d458638b1 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/skus.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/skus.ts @@ -3,95 +3,107 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/skusMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Skus } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { + ResourceSku, + SkusListNextOptionalParams, + SkusListOptionalParams, + SkusListResponse, + SkusListNextResponse +} from "../models"; -/** Class representing a Skus. */ -export class Skus { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing Skus operations. */ +export class SkusImpl implements Skus { + private readonly client: StorageCacheManagementClient; /** - * Create a Skus. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Skus class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** * Get the list of StorageCache.Cache SKUs available to this subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: SkusListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: SkusListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: SkusListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Get the list of StorageCache.Cache SKUs available to this subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list(options?: SkusListOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: SkusListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ResourceSkusResult @@ -100,22 +112,14 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ResourceSkusResult @@ -124,5 +128,12 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/storageTargetOperations.ts b/sdk/storagecache/arm-storagecache/src/operations/storageTargetOperations.ts new file mode 100644 index 000000000000..a2bd1f3e72ff --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operations/storageTargetOperations.ts @@ -0,0 +1,489 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { StorageTargetOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + StorageTargetFlushOptionalParams, + StorageTargetSuspendOptionalParams, + StorageTargetResumeOptionalParams, + StorageTargetInvalidateOptionalParams +} from "../models"; + +/** Class containing StorageTargetOperations operations. */ +export class StorageTargetOperationsImpl implements StorageTargetOperations { + private readonly client: StorageCacheManagementClient; + + /** + * Initialize a new instance of the class StorageTargetOperations class. + * @param client Reference to the service client + */ + constructor(client: StorageCacheManagementClient) { + this.client = client; + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to + * this storage target's namespace will return errors until the flush operation completes. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginFlush( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetFlushOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + flushOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to + * this storage target's namespace will return errors until the flush operation completes. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginFlushAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetFlushOptionalParams + ): Promise { + const poller = await this.beginFlush( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Suspends client access to a storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginSuspend( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetSuspendOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + suspendOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Suspends client access to a storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginSuspendAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetSuspendOptionalParams + ): Promise { + const poller = await this.beginSuspend( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Resumes client access to a previously suspended storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginResume( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetResumeOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + resumeOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Resumes client access to a previously suspended storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginResumeAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetResumeOptionalParams + ): Promise { + const poller = await this.beginResume( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Invalidate all cached data for a storage target. Cached files are discarded and fetched from the + * back end on the next request. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginInvalidate( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetInvalidateOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + invalidateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Invalidate all cached data for a storage target. Cached files are discarded and fetched from the + * back end on the next request. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginInvalidateAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetInvalidateOptionalParams + ): Promise { + const poller = await this.beginInvalidate( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const flushOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const suspendOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const resumeOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const invalidateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/invalidate", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagecache/arm-storagecache/src/operations/storageTargets.ts b/sdk/storagecache/arm-storagecache/src/operations/storageTargets.ts index 28e5eb568ea3..1a250281900d 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/storageTargets.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/storageTargets.ts @@ -3,373 +3,547 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/storageTargetsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { StorageTargets } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + StorageTarget, + StorageTargetsListByCacheNextOptionalParams, + StorageTargetsListByCacheOptionalParams, + StorageTargetsDnsRefreshOptionalParams, + StorageTargetsListByCacheResponse, + StorageTargetsDeleteOptionalParams, + StorageTargetsGetOptionalParams, + StorageTargetsGetResponse, + StorageTargetsCreateOrUpdateOptionalParams, + StorageTargetsCreateOrUpdateResponse, + StorageTargetsListByCacheNextResponse +} from "../models"; -/** Class representing a StorageTargets. */ -export class StorageTargets { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing StorageTargets operations. */ +export class StorageTargetsImpl implements StorageTargets { + private readonly client: StorageCacheManagementClient; /** - * Create a StorageTargets. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class StorageTargets class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** - * Tells a storage target to refresh its DNS information. + * Returns a list of Storage Targets for the specified Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - dnsRefresh(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDnsRefresh(resourceGroupName,cacheName,storageTargetName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + public listByCache( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByCachePagingAll( + resourceGroupName, + cacheName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByCachePagingPage( + resourceGroupName, + cacheName, + options + ); + } + }; } - /** - * Returns a list of Storage Targets for the specified Cache. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - listByCache(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param callback The callback - */ - listByCache(resourceGroupName: string, cacheName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param options The optional parameters - * @param callback The callback - */ - listByCache(resourceGroupName: string, cacheName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByCache(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + private async *listByCachePagingPage( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): AsyncIterableIterator { + let result = await this._listByCache(resourceGroupName, cacheName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByCacheNext( resourceGroupName, cacheName, + continuationToken, options - }, - listByCacheOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByCachePagingAll( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByCachePagingPage( + resourceGroupName, + cacheName, + options + )) { + yield* page; + } } /** - * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache - * is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is - * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be - * flushed before the Storage Target will be deleted. + * Tells a storage target to refresh its DNS information. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,cacheName,storageTargetName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + async beginDnsRefresh( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDnsRefreshOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + dnsRefreshOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** - * Returns a Storage Target from a Cache. + * Tells a storage target to refresh its DNS information. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise; + async beginDnsRefreshAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDnsRefreshOptionalParams + ): Promise { + const poller = await this.beginDnsRefresh( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } + /** + * Returns a list of Storage Targets for the specified Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param storageTargetName Name of Storage Target. - * @param callback The callback + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - get(resourceGroupName: string, cacheName: string, storageTargetName: string, callback: msRest.ServiceCallback): void; + private _listByCache( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, options }, + listByCacheOperationSpec + ); + } + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is + * down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is + * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be + * flushed before the Storage Target will be deleted. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(resourceGroupName: string, cacheName: string, storageTargetName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - cacheName, - storageTargetName, - options - }, - getOperationSpec, - callback) as Promise; + async beginDelete( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is - * down or unhealthy, the actual creation/modification of the Storage Target may be delayed until - * the Cache is healthy again. + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is + * down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is + * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be + * flushed before the Storage Target will be deleted. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: Models.StorageTargetsCreateOrUpdateOptionalParams): Promise { - return this.beginCreateOrUpdate(resourceGroupName,cacheName,storageTargetName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); } /** - * Tells a storage target to refresh its DNS information. + * Returns a Storage Target from a Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginDnsRefresh(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - storageTargetName, - options - }, - beginDnsRefreshOperationSpec, - options); + get( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, storageTargetName, options }, + getOperationSpec + ); } /** - * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache - * is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is - * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be - * flushed before the Storage Target will be deleted. + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down + * or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache + * is healthy again. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginDeleteMethod(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - storageTargetName, - options - }, - beginDeleteMethodOperationSpec, - options); + async beginCreateOrUpdate( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageTargetsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = 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 = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is - * down or unhealthy, the actual creation/modification of the Storage Target may be delayed until - * the Cache is healthy again. + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down + * or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache + * is healthy again. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginCreateOrUpdate(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: Models.StorageTargetsBeginCreateOrUpdateOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - storageTargetName, - options - }, - beginCreateOrUpdateOperationSpec, - options); + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); } /** - * Returns a list of Storage Targets for the specified Cache. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByCacheNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByCacheNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListByCacheNext + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param nextLink The nextLink from the previous successful call to the ListByCache method. + * @param options The options parameters. */ - listByCacheNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByCacheNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByCacheNext( + resourceGroupName: string, + cacheName: string, + nextLink: string, + options?: StorageTargetsListByCacheNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByCacheNextOperationSpec, - callback) as Promise; + { resourceGroupName, cacheName, nextLink, options }, + listByCacheNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listByCacheOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const dnsRefreshOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh", + httpMethod: "POST", responses: { - 200: { - bodyMapper: Mappers.StorageTargetsResult - }, + 200: {}, + 201: {}, + 202: {}, + 204: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName, Parameters.storageTargetName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listByCacheOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets", + httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.StorageTarget + bodyMapper: Mappers.StorageTargetsResult }, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginDnsRefreshOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, - Parameters.cacheName, - Parameters.storageTargetName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceGroupName, + Parameters.cacheName ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", + httpMethod: "DELETE", responses: { 200: {}, + 201: {}, 202: {}, + 204: {}, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", + queryParameters: [Parameters.apiVersion, Parameters.force], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName, Parameters.storageTargetName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", + httpMethod: "GET", responses: { - 200: {}, - 202: {}, - 204: {}, + 200: { + bodyMapper: Mappers.StorageTarget + }, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName, Parameters.storageTargetName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "storagetarget" - ], - mapper: Mappers.StorageTarget - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.StorageTarget @@ -377,27 +551,32 @@ const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { 201: { bodyMapper: Mappers.StorageTarget }, - 202: {}, + 202: { + bodyMapper: Mappers.StorageTarget + }, + 204: { + bodyMapper: Mappers.StorageTarget + }, default: { bodyMapper: Mappers.CloudError } }, + requestBody: Parameters.storagetarget, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const listByCacheNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByCacheNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.StorageTargetsResult @@ -406,5 +585,14 @@ const listByCacheNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/usageModels.ts b/sdk/storagecache/arm-storagecache/src/operations/usageModels.ts index 17029293a4bd..a0f0a8f02d60 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/usageModels.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/usageModels.ts @@ -3,95 +3,110 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/usageModelsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { UsageModels } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { + UsageModel, + UsageModelsListNextOptionalParams, + UsageModelsListOptionalParams, + UsageModelsListResponse, + UsageModelsListNextResponse +} from "../models"; -/** Class representing a UsageModels. */ -export class UsageModels { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing UsageModels operations. */ +export class UsageModelsImpl implements UsageModels { + private readonly client: StorageCacheManagementClient; /** - * Create a UsageModels. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class UsageModels class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** * Get the list of Cache Usage Models available to this subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: UsageModelsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: UsageModelsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: UsageModelsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Get the list of Cache Usage Models available to this subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list( + options?: UsageModelsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: UsageModelsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.UsageModelsResult @@ -100,22 +115,14 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.UsageModelsResult @@ -124,5 +131,12 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/ascOperations.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/ascOperations.ts new file mode 100644 index 000000000000..95356add12e8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/ascOperations.ts @@ -0,0 +1,27 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + AscOperationsGetOptionalParams, + AscOperationsGetResponse +} from "../models"; + +/** Interface representing a AscOperations. */ +export interface AscOperations { + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @param options The options parameters. + */ + get( + location: string, + operationId: string, + options?: AscOperationsGetOptionalParams + ): Promise; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/caches.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/caches.ts new file mode 100644 index 000000000000..200ea3798b68 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/caches.ts @@ -0,0 +1,245 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + Cache, + CachesListOptionalParams, + CachesListByResourceGroupOptionalParams, + CachesDeleteOptionalParams, + CachesGetOptionalParams, + CachesGetResponse, + CachesCreateOrUpdateOptionalParams, + CachesCreateOrUpdateResponse, + CachesUpdateOptionalParams, + CachesUpdateResponse, + CachesDebugInfoOptionalParams, + CachesFlushOptionalParams, + CachesStartOptionalParams, + CachesStopOptionalParams, + CachesUpgradeFirmwareOptionalParams +} from "../models"; + +/// +/** Interface representing a Caches. */ +export interface Caches { + /** + * Returns all Caches the user has access to under a subscription. + * @param options The options parameters. + */ + list(options?: CachesListOptionalParams): PagedAsyncIterableIterator; + /** + * Returns all Caches the user has access to under a resource group. + * @param resourceGroupName Target resource group. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Schedules a Cache for deletion. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + cacheName: string, + options?: CachesDeleteOptionalParams + ): Promise, void>>; + /** + * Schedules a Cache for deletion. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesDeleteOptionalParams + ): Promise; + /** + * Returns a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + cacheName: string, + options?: CachesGetOptionalParams + ): Promise; + /** + * Create or update a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + cacheName: string, + options?: CachesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CachesCreateOrUpdateResponse + > + >; + /** + * Create or update a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a Cache instance. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + cacheName: string, + options?: CachesUpdateOptionalParams + ): Promise; + /** + * Tells a Cache to write generate debug info for support to process. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginDebugInfo( + resourceGroupName: string, + cacheName: string, + options?: CachesDebugInfoOptionalParams + ): Promise, void>>; + /** + * Tells a Cache to write generate debug info for support to process. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginDebugInfoAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesDebugInfoOptionalParams + ): Promise; + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see + * errors returned until the flush is complete. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginFlush( + resourceGroupName: string, + cacheName: string, + options?: CachesFlushOptionalParams + ): Promise, void>>; + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see + * errors returned until the flush is complete. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginFlushAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesFlushOptionalParams + ): Promise; + /** + * Tells a Stopped state Cache to transition to Active state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginStart( + resourceGroupName: string, + cacheName: string, + options?: CachesStartOptionalParams + ): Promise, void>>; + /** + * Tells a Stopped state Cache to transition to Active state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginStartAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesStartOptionalParams + ): Promise; + /** + * Tells an Active Cache to transition to Stopped state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginStop( + resourceGroupName: string, + cacheName: string, + options?: CachesStopOptionalParams + ): Promise, void>>; + /** + * Tells an Active Cache to transition to Stopped state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginStopAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesStopOptionalParams + ): Promise; + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginUpgradeFirmware( + resourceGroupName: string, + cacheName: string, + options?: CachesUpgradeFirmwareOptionalParams + ): Promise, void>>; + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginUpgradeFirmwareAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesUpgradeFirmwareOptionalParams + ): Promise; +} diff --git a/sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/index.ts similarity index 51% rename from sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts rename to sdk/storagecache/arm-storagecache/src/operationsInterfaces/index.ts index 7f2558513f41..b254cecd4236 100644 --- a/sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/index.ts @@ -6,8 +6,10 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - AscOperation, - CloudError, - ErrorResponse -} from "../models/mappers"; +export * from "./operations"; +export * from "./skus"; +export * from "./usageModels"; +export * from "./ascOperations"; +export * from "./caches"; +export * from "./storageTargets"; +export * from "./storageTargetOperations"; diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/operations.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..b8cab468f6e6 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ApiOperation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available Resource Provider operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/skus.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/skus.ts new file mode 100644 index 000000000000..4955941f6443 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/skus.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ResourceSku, SkusListOptionalParams } from "../models"; + +/// +/** Interface representing a Skus. */ +export interface Skus { + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * @param options The options parameters. + */ + list( + options?: SkusListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargetOperations.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargetOperations.ts new file mode 100644 index 000000000000..051b2c455f09 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargetOperations.ts @@ -0,0 +1,135 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + StorageTargetFlushOptionalParams, + StorageTargetSuspendOptionalParams, + StorageTargetResumeOptionalParams, + StorageTargetInvalidateOptionalParams +} from "../models"; + +/** Interface representing a StorageTargetOperations. */ +export interface StorageTargetOperations { + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to + * this storage target's namespace will return errors until the flush operation completes. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginFlush( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetFlushOptionalParams + ): Promise, void>>; + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to + * this storage target's namespace will return errors until the flush operation completes. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginFlushAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetFlushOptionalParams + ): Promise; + /** + * Suspends client access to a storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginSuspend( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetSuspendOptionalParams + ): Promise, void>>; + /** + * Suspends client access to a storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginSuspendAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetSuspendOptionalParams + ): Promise; + /** + * Resumes client access to a previously suspended storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginResume( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetResumeOptionalParams + ): Promise, void>>; + /** + * Resumes client access to a previously suspended storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginResumeAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetResumeOptionalParams + ): Promise; + /** + * Invalidate all cached data for a storage target. Cached files are discarded and fetched from the + * back end on the next request. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginInvalidate( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetInvalidateOptionalParams + ): Promise, void>>; + /** + * Invalidate all cached data for a storage target. Cached files are discarded and fetched from the + * back end on the next request. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginInvalidateAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetInvalidateOptionalParams + ): Promise; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargets.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargets.ts new file mode 100644 index 000000000000..0f7e85ddc7ff --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargets.ts @@ -0,0 +1,150 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + StorageTarget, + StorageTargetsListByCacheOptionalParams, + StorageTargetsDnsRefreshOptionalParams, + StorageTargetsDeleteOptionalParams, + StorageTargetsGetOptionalParams, + StorageTargetsGetResponse, + StorageTargetsCreateOrUpdateOptionalParams, + StorageTargetsCreateOrUpdateResponse +} from "../models"; + +/// +/** Interface representing a StorageTargets. */ +export interface StorageTargets { + /** + * Returns a list of Storage Targets for the specified Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + listByCache( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): PagedAsyncIterableIterator; + /** + * Tells a storage target to refresh its DNS information. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginDnsRefresh( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDnsRefreshOptionalParams + ): Promise, void>>; + /** + * Tells a storage target to refresh its DNS information. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginDnsRefreshAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDnsRefreshOptionalParams + ): Promise; + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is + * down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is + * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be + * flushed before the Storage Target will be deleted. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDeleteOptionalParams + ): Promise, void>>; + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is + * down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is + * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be + * flushed before the Storage Target will be deleted. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDeleteOptionalParams + ): Promise; + /** + * Returns a Storage Target from a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsGetOptionalParams + ): Promise; + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down + * or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache + * is healthy again. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageTargetsCreateOrUpdateResponse + > + >; + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down + * or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache + * is healthy again. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsCreateOrUpdateOptionalParams + ): Promise; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/usageModels.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/usageModels.ts new file mode 100644 index 000000000000..b07e9c06165d --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/usageModels.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { UsageModel, UsageModelsListOptionalParams } from "../models"; + +/// +/** Interface representing a UsageModels. */ +export interface UsageModels { + /** + * Get the list of Cache Usage Models available to this subscription. + * @param options The options parameters. + */ + list( + options?: UsageModelsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts b/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts index cb15178503bf..022847a4de73 100644 --- a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts +++ b/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts @@ -3,50 +3,102 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { StorageCacheManagementClientContext } from "./storageCacheManagementClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + OperationsImpl, + SkusImpl, + UsageModelsImpl, + AscOperationsImpl, + CachesImpl, + StorageTargetsImpl, + StorageTargetOperationsImpl +} from "./operations"; +import { + Operations, + Skus, + UsageModels, + AscOperations, + Caches, + StorageTargets, + StorageTargetOperations +} from "./operationsInterfaces"; +import { StorageCacheManagementClientOptionalParams } from "./models"; - -class StorageCacheManagementClient extends StorageCacheManagementClientContext { - // Operation groups - operations: operations.Operations; - skus: operations.Skus; - usageModels: operations.UsageModels; - ascOperations: operations.AscOperations; - caches: operations.Caches; - storageTargets: operations.StorageTargets; +export class StorageCacheManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; /** * Initializes a new instance of the StorageCacheManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. - * @param [options] The parameter options + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure subscription. + * The subscription ID forms part of the URI for every service call. + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.StorageCacheManagementClientOptions) { - super(credentials, subscriptionId, options); - this.operations = new operations.Operations(this); - this.skus = new operations.Skus(this); - this.usageModels = new operations.UsageModels(this); - this.ascOperations = new operations.AscOperations(this); - this.caches = new operations.Caches(this); - this.storageTargets = new operations.StorageTargets(this); - } -} + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: StorageCacheManagementClientOptionalParams + ) { + 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: StorageCacheManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; -// Operation Specifications + const packageDetails = `azsdk-js-arm-storagecache/5.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; -export { - StorageCacheManagementClient, - StorageCacheManagementClientContext, - Models as StorageCacheManagementModels, - Mappers as StorageCacheManagementMappers -}; -export * from "./operations"; + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-01-01"; + this.operations = new OperationsImpl(this); + this.skus = new SkusImpl(this); + this.usageModels = new UsageModelsImpl(this); + this.ascOperations = new AscOperationsImpl(this); + this.caches = new CachesImpl(this); + this.storageTargets = new StorageTargetsImpl(this); + this.storageTargetOperations = new StorageTargetOperationsImpl(this); + } + + operations: Operations; + skus: Skus; + usageModels: UsageModels; + ascOperations: AscOperations; + caches: Caches; + storageTargets: StorageTargets; + storageTargetOperations: StorageTargetOperations; +} diff --git a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClientContext.ts b/sdk/storagecache/arm-storagecache/src/storageCacheManagementClientContext.ts deleted file mode 100644 index 563563daa716..000000000000 --- a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClientContext.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the 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 Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-storagecache"; -const packageVersion = "4.0.0"; - -export class StorageCacheManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the StorageCacheManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.StorageCacheManagementClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2021-03-01'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/storagecache/arm-storagecache/test/sampleTest.ts b/sdk/storagecache/arm-storagecache/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/storagecache/arm-storagecache/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/storagecache/arm-storagecache/tsconfig.json b/sdk/storagecache/arm-storagecache/tsconfig.json index 422b584abd5e..6e3251194117 100644 --- a/sdk/storagecache/arm-storagecache/tsconfig.json +++ b/sdk/storagecache/arm-storagecache/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,9 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", + "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/storagecache/ci.yml b/sdk/storagecache/ci.yml new file mode 100644 index 000000000000..328dae2c003b --- /dev/null +++ b/sdk/storagecache/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/storagecache/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/storagecache/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storagecache + Artifacts: + - name: azure-arm-storagecache + safeName: azurearmstoragecache + \ No newline at end of file