diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index a726c0b3e298..347e44f10c8b 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -202,6 +202,7 @@ specifiers: '@rush-temp/arm-servicemap': file:./projects/arm-servicemap.tgz '@rush-temp/arm-servicenetworking': file:./projects/arm-servicenetworking.tgz '@rush-temp/arm-signalr': file:./projects/arm-signalr.tgz + '@rush-temp/arm-sphere': file:./projects/arm-sphere.tgz '@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 @@ -553,6 +554,7 @@ dependencies: '@rush-temp/arm-servicemap': file:projects/arm-servicemap.tgz '@rush-temp/arm-servicenetworking': file:projects/arm-servicenetworking.tgz '@rush-temp/arm-signalr': file:projects/arm-signalr.tgz + '@rush-temp/arm-sphere': file:projects/arm-sphere.tgz '@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 @@ -4887,7 +4889,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.2.0-dev.20230718 + typescript: 5.2.0-dev.20230724 dev: false /duplexer3/0.1.5: @@ -10399,8 +10401,8 @@ packages: hasBin: true dev: false - /typescript/5.2.0-dev.20230718: - resolution: {integrity: sha512-ED1Vm+2UzdbtKui+0lVswEuAX94fQXeoghXyy/+aTNers8X/WB81r5sFg6nA4e43nVQ2MP/Qsa7/XJRFuHR+Cg==} + /typescript/5.2.0-dev.20230724: + resolution: {integrity: sha512-imp5MKTFe3BmE+opYLWqglHjPJ3HQtmwcFX0zYKhky/m/ncUpMqnVnjZSoncvTkKGI8s4Ng88LqOEgvLa4brFg==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -16855,6 +16857,34 @@ packages: - supports-color dev: false + file:projects/arm-sphere.tgz: + resolution: {integrity: sha512-AG1TnkRlX+xjtHiSY8ZXbSMwIU851MT5D8t2JaTdSYLNnR80bTK+kv4voDnWHfqcKM1hprW3gMokU1nWWiaIlw==, tarball: file:projects/arm-sphere.tgz} + name: '@rush-temp/arm-sphere' + version: 0.0.0 + dependencies: + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.36.2_@types+node@14.18.53 + '@rollup/plugin-commonjs': 24.1.0_rollup@2.79.1 + '@rollup/plugin-json': 6.0.0_rollup@2.79.1 + '@rollup/plugin-multi-entry': 6.0.0_rollup@2.79.1 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.1 + '@types/chai': 4.3.5 + '@types/node': 14.18.53 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 16.3.1 + mkdirp: 2.1.6 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.79.1 + rollup-plugin-sourcemaps: 0.6.3_sq65t46yqtx5h7g66skj5bmgcy + tslib: 2.6.0 + typescript: 5.0.4 + uglify-js: 3.17.4 + transitivePeerDependencies: + - supports-color + dev: false + file:projects/arm-sql.tgz: resolution: {integrity: sha512-EpSU2v4ZtF6cBet3xtDZP6CVKFpIueokt1QWq2L94nDbejTY0apqrB5ld7Y1wMFd2eCjkWdyOemcoMU3aiEpng==, tarball: file:projects/arm-sql.tgz} name: '@rush-temp/arm-sql' @@ -19657,7 +19687,7 @@ packages: dev: false file:projects/keyvault-keys.tgz: - resolution: {integrity: sha512-WSic9Y9eP/zlGJD8V6BrEIfi7uGDFOnaLeDlmMVU3vjONQdCwbSO+yFsNzKkO6bc+Im+XYwhaOSlDXLJuoknQQ==, tarball: file:projects/keyvault-keys.tgz} + resolution: {integrity: sha512-Tq9MBQ2oG6WBa4vesnoNLItYCWDfFUzeq1LtMg+0RbImo55Z0SO+6anZRHn61Q9wZ4LaIj8ZdmWN2rCZmTrl0g==, tarball: file:projects/keyvault-keys.tgz} name: '@rush-temp/keyvault-keys' version: 0.0.0 dependencies: @@ -21545,7 +21575,7 @@ packages: dev: false file:projects/storage-file-share.tgz: - resolution: {integrity: sha512-RpThRihEhcpL4GBB9uvgjdYuHrsgy5h+I3kAfC3w5PKwJrFdwRHD/T6jj9lFU4XJMY7qWpXB9VTHZwYzBk5iDg==, tarball: file:projects/storage-file-share.tgz} + resolution: {integrity: sha512-RBBA/3/edoGRXf3UXRKbIhEPsydPcNuzE4iAJwoCL+EmFayR37M44zG7/Fcj9k8JLUI9Os+GcPVGn9zuLNr9Yw==, tarball: file:projects/storage-file-share.tgz} name: '@rush-temp/storage-file-share' version: 0.0.0 dependencies: diff --git a/rush.json b/rush.json index 7ce6c8bd4412..a1a0f0475d66 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -2039,6 +2039,11 @@ "packageName": "@azure/arm-quantum", "projectFolder": "sdk/quantum/arm-quantum", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-sphere", + "projectFolder": "sdk/sphere/arm-sphere", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/CHANGELOG.md b/sdk/sphere/arm-sphere/CHANGELOG.md new file mode 100644 index 000000000000..79c9f1a76eab --- /dev/null +++ b/sdk/sphere/arm-sphere/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-07-24) + +The package of @azure/arm-sphere is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/sphere/arm-sphere/LICENSE b/sdk/sphere/arm-sphere/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/sphere/arm-sphere/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/README.md b/sdk/sphere/arm-sphere/README.md new file mode 100644 index 000000000000..60f65850399c --- /dev/null +++ b/sdk/sphere/arm-sphere/README.md @@ -0,0 +1,109 @@ +# AzureSphereManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzureSphereManagement client. + +Azure Sphere resource management API. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-sphere) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-sphere?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-sphere` package + +Install the AzureSphereManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-sphere +``` + +### Create and authenticate a `AzureSphereManagementClient` + +To create a client object to access the AzureSphereManagement API, you will need the `endpoint` of your AzureSphereManagement resource and a `credential`. The AzureSphereManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your AzureSphereManagement resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to AzureSphereManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { AzureSphereManagementClient } = require("@azure/arm-sphere"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new AzureSphereManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new AzureSphereManagementClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### AzureSphereManagementClient + +`AzureSphereManagementClient` is the primary interface for developers using the AzureSphereManagement client library. Explore the methods on this client object to understand the different features of the AzureSphereManagement service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fsphere%2Farm-sphere%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/sphere/arm-sphere/_meta.json b/sdk/sphere/arm-sphere/_meta.json new file mode 100644 index 000000000000..24b762a02d6e --- /dev/null +++ b/sdk/sphere/arm-sphere/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "ed9bde6a3db71b84fdba076ba0546213bcce56ee", + "readme": "specification/sphere/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/sphere/resource-manager/readme.md --use=@autorest/typescript@^6.0.4", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.1", + "use": "@autorest/typescript@^6.0.4" +} \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/api-extractor.json b/sdk/sphere/arm-sphere/api-extractor.json new file mode 100644 index 000000000000..f4e5a0e21fc0 --- /dev/null +++ b/sdk/sphere/arm-sphere/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-sphere.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/package.json b/sdk/sphere/arm-sphere/package.json new file mode 100644 index 000000000000..19221d78686a --- /dev/null +++ b/sdk/sphere/arm-sphere/package.json @@ -0,0 +1,115 @@ +{ + "name": "@azure/arm-sphere", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for AzureSphereManagementClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=14.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.3", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-sphere.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "@rollup/plugin-commonjs": "^24.0.0", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-multi-entry": "^6.0.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^2.1.2", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~5.0.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "dotenv": "^16.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^14.0.0", + "@azure/dev-tool": "^1.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/azureSphereManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/sphere/arm-sphere" +} \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/review/arm-sphere.api.md b/sdk/sphere/arm-sphere/review/arm-sphere.api.md new file mode 100644 index 000000000000..29c567afdcc5 --- /dev/null +++ b/sdk/sphere/arm-sphere/review/arm-sphere.api.md @@ -0,0 +1,1112 @@ +## API Report File for "@azure/arm-sphere" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export type ActionType = string; + +// @public +export type AllowCrashDumpCollection = string; + +// @public (undocumented) +export class AzureSphereManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AzureSphereManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + catalogs: Catalogs; + // (undocumented) + certificates: Certificates; + // (undocumented) + deployments: Deployments; + // (undocumented) + deviceGroups: DeviceGroups; + // (undocumented) + devices: Devices; + // (undocumented) + images: Images; + // (undocumented) + operations: Operations; + // (undocumented) + products: Products; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface AzureSphereManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type CapabilityType = string; + +// @public +export interface Catalog extends TrackedResource { + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface CatalogListResult { + nextLink?: string; + value: Catalog[]; +} + +// @public +export interface Catalogs { + beginCreateOrUpdate(resourceGroupName: string, catalogName: string, resource: Catalog, options?: CatalogsCreateOrUpdateOptionalParams): Promise, CatalogsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, resource: Catalog, options?: CatalogsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, catalogName: string, options?: CatalogsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, catalogName: string, options?: CatalogsDeleteOptionalParams): Promise; + countDevices(resourceGroupName: string, catalogName: string, options?: CatalogsCountDevicesOptionalParams): Promise; + get(resourceGroupName: string, catalogName: string, options?: CatalogsGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: CatalogsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: CatalogsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + listDeployments(resourceGroupName: string, catalogName: string, options?: CatalogsListDeploymentsOptionalParams): PagedAsyncIterableIterator; + listDeviceGroups(resourceGroupName: string, catalogName: string, listDeviceGroupsRequest: ListDeviceGroupsRequest, options?: CatalogsListDeviceGroupsOptionalParams): PagedAsyncIterableIterator; + listDeviceInsights(resourceGroupName: string, catalogName: string, options?: CatalogsListDeviceInsightsOptionalParams): PagedAsyncIterableIterator; + listDevices(resourceGroupName: string, catalogName: string, options?: CatalogsListDevicesOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, catalogName: string, properties: CatalogUpdate, options?: CatalogsUpdateOptionalParams): Promise; +} + +// @public +export interface CatalogsCountDevicesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsCountDevicesResponse = CountDeviceResponse; + +// @public +export interface CatalogsCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface CatalogsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CatalogsCreateOrUpdateResponse = Catalog; + +// @public +export interface CatalogsDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface CatalogsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CatalogsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsGetResponse = Catalog; + +// @public +export interface CatalogsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsListByResourceGroupNextResponse = CatalogListResult; + +// @public +export interface CatalogsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsListByResourceGroupResponse = CatalogListResult; + +// @public +export interface CatalogsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsListBySubscriptionNextResponse = CatalogListResult; + +// @public +export interface CatalogsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsListBySubscriptionResponse = CatalogListResult; + +// @public +export interface CatalogsListDeploymentsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsListDeploymentsNextResponse = DeploymentListResult; + +// @public +export interface CatalogsListDeploymentsOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export type CatalogsListDeploymentsResponse = DeploymentListResult; + +// @public +export interface CatalogsListDeviceGroupsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsListDeviceGroupsNextResponse = DeviceGroupListResult; + +// @public +export interface CatalogsListDeviceGroupsOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export type CatalogsListDeviceGroupsResponse = DeviceGroupListResult; + +// @public +export interface CatalogsListDeviceInsightsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsListDeviceInsightsNextResponse = PagedDeviceInsight; + +// @public +export interface CatalogsListDeviceInsightsOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export type CatalogsListDeviceInsightsResponse = PagedDeviceInsight; + +// @public +export interface CatalogsListDevicesNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsListDevicesNextResponse = DeviceListResult; + +// @public +export interface CatalogsListDevicesOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export type CatalogsListDevicesResponse = DeviceListResult; + +// @public +export interface CatalogsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CatalogsUpdateResponse = Catalog; + +// @public +export interface CatalogUpdate { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface Certificate extends ProxyResource { + readonly certificate?: string; + readonly expiryUtc?: Date; + readonly notBeforeUtc?: Date; + readonly provisioningState?: ProvisioningState; + readonly status?: CertificateStatus; + readonly subject?: string; + readonly thumbprint?: string; +} + +// @public +export interface CertificateChainResponse { + readonly certificateChain?: string; +} + +// @public +export interface CertificateListResult { + nextLink?: string; + value: Certificate[]; +} + +// @public +export interface CertificateProperties { + readonly certificate?: string; + readonly expiryUtc?: Date; + readonly notBeforeUtc?: Date; + readonly provisioningState?: ProvisioningState; + readonly status?: CertificateStatus; + readonly subject?: string; + readonly thumbprint?: string; +} + +// @public +export interface Certificates { + get(resourceGroupName: string, catalogName: string, serialNumber: string, options?: CertificatesGetOptionalParams): Promise; + listByCatalog(resourceGroupName: string, catalogName: string, options?: CertificatesListByCatalogOptionalParams): PagedAsyncIterableIterator; + retrieveCertChain(resourceGroupName: string, catalogName: string, serialNumber: string, options?: CertificatesRetrieveCertChainOptionalParams): Promise; + retrieveProofOfPossessionNonce(resourceGroupName: string, catalogName: string, serialNumber: string, proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams): Promise; +} + +// @public +export interface CertificatesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CertificatesGetResponse = Certificate; + +// @public +export interface CertificatesListByCatalogNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CertificatesListByCatalogNextResponse = CertificateListResult; + +// @public +export interface CertificatesListByCatalogOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export type CertificatesListByCatalogResponse = CertificateListResult; + +// @public +export interface CertificatesRetrieveCertChainOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CertificatesRetrieveCertChainResponse = CertificateChainResponse; + +// @public +export interface CertificatesRetrieveProofOfPossessionNonceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CertificatesRetrieveProofOfPossessionNonceResponse = ProofOfPossessionNonceResponse; + +// @public +export type CertificateStatus = string; + +// @public +export interface ClaimDevicesRequest { + deviceIdentifiers: string[]; +} + +// @public +export interface CountDeviceResponse extends CountElementsResponse { +} + +// @public +export interface CountElementsResponse { + value: number; +} + +// @public +export type CreatedByType = string; + +// @public +export interface Deployment extends ProxyResource { + deployedImages?: Image_2[]; + readonly deploymentDateUtc?: Date; + deploymentId?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface DeploymentListResult { + nextLink?: string; + value: Deployment[]; +} + +// @public +export interface Deployments { + beginCreateOrUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, resource: Deployment, options?: DeploymentsCreateOrUpdateOptionalParams): Promise, DeploymentsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, resource: Deployment, options?: DeploymentsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsDeleteOptionalParams): Promise; + get(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deploymentName: string, options?: DeploymentsGetOptionalParams): Promise; + listByDeviceGroup(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeploymentsListByDeviceGroupOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DeploymentsCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface DeploymentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DeploymentsCreateOrUpdateResponse = Deployment; + +// @public +export interface DeploymentsDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface DeploymentsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface DeploymentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentsGetResponse = Deployment; + +// @public +export interface DeploymentsListByDeviceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentsListByDeviceGroupNextResponse = DeploymentListResult; + +// @public +export interface DeploymentsListByDeviceGroupOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export type DeploymentsListByDeviceGroupResponse = DeploymentListResult; + +// @public +export interface Device extends ProxyResource { + readonly chipSku?: string; + deviceId?: string; + readonly lastAvailableOsVersion?: string; + readonly lastInstalledOsVersion?: string; + readonly lastOsUpdateUtc?: Date; + readonly lastUpdateRequestUtc?: Date; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface DeviceGroup extends ProxyResource { + allowCrashDumpsCollection?: AllowCrashDumpCollection; + description?: string; + readonly hasDeployment?: boolean; + osFeedType?: OSFeedType; + readonly provisioningState?: ProvisioningState; + regionalDataBoundary?: RegionalDataBoundary; + updatePolicy?: UpdatePolicy; +} + +// @public +export interface DeviceGroupListResult { + nextLink?: string; + value: DeviceGroup[]; +} + +// @public +export interface DeviceGroups { + beginClaimDevices(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, claimDevicesRequest: ClaimDevicesRequest, options?: DeviceGroupsClaimDevicesOptionalParams): Promise, DeviceGroupsClaimDevicesResponse>>; + beginClaimDevicesAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, claimDevicesRequest: ClaimDevicesRequest, options?: DeviceGroupsClaimDevicesOptionalParams): Promise; + beginCreateOrUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, resource: DeviceGroup, options?: DeviceGroupsCreateOrUpdateOptionalParams): Promise, DeviceGroupsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, resource: DeviceGroup, options?: DeviceGroupsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, properties: DeviceGroupUpdate, options?: DeviceGroupsUpdateOptionalParams): Promise, DeviceGroupsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, properties: DeviceGroupUpdate, options?: DeviceGroupsUpdateOptionalParams): Promise; + countDevices(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsCountDevicesOptionalParams): Promise; + get(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DeviceGroupsGetOptionalParams): Promise; + listByProduct(resourceGroupName: string, catalogName: string, productName: string, options?: DeviceGroupsListByProductOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DeviceGroupsClaimDevicesHeaders { + retryAfter?: number; +} + +// @public +export interface DeviceGroupsClaimDevicesOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DeviceGroupsClaimDevicesResponse = DeviceGroupsClaimDevicesHeaders; + +// @public +export interface DeviceGroupsCountDevicesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeviceGroupsCountDevicesResponse = CountDeviceResponse; + +// @public +export interface DeviceGroupsCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface DeviceGroupsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DeviceGroupsCreateOrUpdateResponse = DeviceGroup; + +// @public +export interface DeviceGroupsDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface DeviceGroupsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface DeviceGroupsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeviceGroupsGetResponse = DeviceGroup; + +// @public +export interface DeviceGroupsListByProductNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeviceGroupsListByProductNextResponse = DeviceGroupListResult; + +// @public +export interface DeviceGroupsListByProductOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export type DeviceGroupsListByProductResponse = DeviceGroupListResult; + +// @public +export interface DeviceGroupsUpdateHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface DeviceGroupsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DeviceGroupsUpdateResponse = DeviceGroup; + +// @public +export interface DeviceGroupUpdate { + allowCrashDumpsCollection?: AllowCrashDumpCollection; + description?: string; + osFeedType?: OSFeedType; + regionalDataBoundary?: RegionalDataBoundary; + updatePolicy?: UpdatePolicy; +} + +// @public +export interface DeviceInsight { + description: string; + deviceId: string; + endTimestampUtc: Date; + eventCategory: string; + eventClass: string; + eventCount: number; + eventType: string; + startTimestampUtc: Date; +} + +// @public +export interface DeviceListResult { + nextLink?: string; + value: Device[]; +} + +// @public +export interface DevicePatchProperties { + deviceGroupId: string; +} + +// @public +export interface Devices { + beginCreateOrUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, resource: Device, options?: DevicesCreateOrUpdateOptionalParams): Promise, DevicesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, resource: Device, options?: DevicesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesDeleteOptionalParams): Promise; + beginGenerateCapabilityImage(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, options?: DevicesGenerateCapabilityImageOptionalParams): Promise, DevicesGenerateCapabilityImageResponse>>; + beginGenerateCapabilityImageAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, options?: DevicesGenerateCapabilityImageOptionalParams): Promise; + beginUpdate(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, properties: DeviceUpdate, options?: DevicesUpdateOptionalParams): Promise, DevicesUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, properties: DeviceUpdate, options?: DevicesUpdateOptionalParams): Promise; + get(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, deviceName: string, options?: DevicesGetOptionalParams): Promise; + listByDeviceGroup(resourceGroupName: string, catalogName: string, productName: string, deviceGroupName: string, options?: DevicesListByDeviceGroupOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DevicesCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface DevicesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DevicesCreateOrUpdateResponse = Device; + +// @public +export interface DevicesDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface DevicesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface DevicesGenerateCapabilityImageHeaders { + retryAfter?: number; +} + +// @public +export interface DevicesGenerateCapabilityImageOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DevicesGenerateCapabilityImageResponse = SignedCapabilityImageResponse; + +// @public +export interface DevicesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DevicesGetResponse = Device; + +// @public +export interface DevicesListByDeviceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DevicesListByDeviceGroupNextResponse = DeviceListResult; + +// @public +export interface DevicesListByDeviceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DevicesListByDeviceGroupResponse = DeviceListResult; + +// @public +export interface DevicesUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface DevicesUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type DevicesUpdateResponse = Device; + +// @public +export interface DeviceUpdate { + deviceGroupId?: string; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface GenerateCapabilityImageRequest { + capabilities: CapabilityType[]; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +interface Image_2 extends ProxyResource { + readonly componentId?: string; + readonly description?: string; + image?: string; + imageId?: string; + readonly imageName?: string; + readonly imageType?: ImageType; + readonly provisioningState?: ProvisioningState; + regionalDataBoundary?: RegionalDataBoundary; + readonly uri?: string; +} +export { Image_2 as Image } + +// @public +export interface ImageListResult { + nextLink?: string; + value: Image_2[]; +} + +// @public +export interface Images { + beginCreateOrUpdate(resourceGroupName: string, catalogName: string, imageName: string, resource: Image_2, options?: ImagesCreateOrUpdateOptionalParams): Promise, ImagesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, imageName: string, resource: Image_2, options?: ImagesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesDeleteOptionalParams): Promise; + get(resourceGroupName: string, catalogName: string, imageName: string, options?: ImagesGetOptionalParams): Promise; + listByCatalog(resourceGroupName: string, catalogName: string, options?: ImagesListByCatalogOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ImagesCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface ImagesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ImagesCreateOrUpdateResponse = Image_2; + +// @public +export interface ImagesDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface ImagesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ImagesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ImagesGetResponse = Image_2; + +// @public +export interface ImagesListByCatalogNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ImagesListByCatalogNextResponse = ImageListResult; + +// @public +export interface ImagesListByCatalogOptionalParams extends coreClient.OperationOptions { + filter?: string; + maxpagesize?: number; + skip?: number; + top?: number; +} + +// @public +export type ImagesListByCatalogResponse = ImageListResult; + +// @public +export type ImageType = string; + +// @public +export interface ImageUploadRequestBody { + // (undocumented) + images: string; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownAllowCrashDumpCollection { + Disabled = "Disabled", + Enabled = "Enabled" +} + +// @public +export enum KnownCapabilityType { + ApplicationDevelopment = "ApplicationDevelopment", + FieldServicing = "FieldServicing" +} + +// @public +export enum KnownCertificateStatus { + Active = "Active", + Expired = "Expired", + Inactive = "Inactive", + Revoked = "Revoked" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownImageType { + Applications = "Applications", + BaseSystemUpdateManifest = "BaseSystemUpdateManifest", + BootManifest = "BootManifest", + CustomerBoardConfig = "CustomerBoardConfig", + CustomerUpdateManifest = "CustomerUpdateManifest", + FirmwareUpdateManifest = "FirmwareUpdateManifest", + FwConfig = "FwConfig", + InvalidImageType = "InvalidImageType", + ManifestSet = "ManifestSet", + NormalWorldDtb = "NormalWorldDtb", + NormalWorldKernel = "NormalWorldKernel", + NormalWorldLoader = "NormalWorldLoader", + Nwfs = "Nwfs", + OneBl = "OneBl", + Other = "Other", + PlutonRuntime = "PlutonRuntime", + Policy = "Policy", + RecoveryManifest = "RecoveryManifest", + RootFs = "RootFs", + SecurityMonitor = "SecurityMonitor", + Services = "Services", + TrustedKeystore = "TrustedKeystore", + UpdateCertStore = "UpdateCertStore", + WifiFirmware = "WifiFirmware" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownOSFeedType { + Retail = "Retail", + RetailEval = "RetailEval" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Deleting = "Deleting", + Failed = "Failed", + Provisioning = "Provisioning", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownRegionalDataBoundary { + EU = "EU", + None = "None" +} + +// @public +export enum KnownUpdatePolicy { + No3RdPartyAppUpdates = "No3rdPartyAppUpdates", + UpdateAll = "UpdateAll" +} + +// @public +export interface ListDeviceGroupsRequest { + deviceGroupName?: string; +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationListResult { + readonly nextLink?: string; + readonly value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export type Origin = string; + +// @public +export type OSFeedType = string; + +// @public +export interface PagedDeviceInsight { + nextLink?: string; + value: DeviceInsight[]; +} + +// @public +export interface Product extends ProxyResource { + description?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface ProductListResult { + nextLink?: string; + value: Product[]; +} + +// @public +export interface Products { + beginCreateOrUpdate(resourceGroupName: string, catalogName: string, productName: string, resource: Product, options?: ProductsCreateOrUpdateOptionalParams): Promise, ProductsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, resource: Product, options?: ProductsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, catalogName: string, productName: string, properties: ProductUpdate, options?: ProductsUpdateOptionalParams): Promise, ProductsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, catalogName: string, productName: string, properties: ProductUpdate, options?: ProductsUpdateOptionalParams): Promise; + countDevices(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsCountDevicesOptionalParams): Promise; + get(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsGetOptionalParams): Promise; + listByCatalog(resourceGroupName: string, catalogName: string, options?: ProductsListByCatalogOptionalParams): PagedAsyncIterableIterator; + listGenerateDefaultDeviceGroups(resourceGroupName: string, catalogName: string, productName: string, options?: ProductsGenerateDefaultDeviceGroupsOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ProductsCountDevicesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProductsCountDevicesResponse = CountDeviceResponse; + +// @public +export interface ProductsCreateOrUpdateHeaders { + retryAfter?: number; +} + +// @public +export interface ProductsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ProductsCreateOrUpdateResponse = Product; + +// @public +export interface ProductsDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface ProductsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ProductsGenerateDefaultDeviceGroupsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProductsGenerateDefaultDeviceGroupsNextResponse = DeviceGroupListResult; + +// @public +export interface ProductsGenerateDefaultDeviceGroupsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProductsGenerateDefaultDeviceGroupsResponse = DeviceGroupListResult; + +// @public +export interface ProductsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProductsGetResponse = Product; + +// @public +export interface ProductsListByCatalogNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProductsListByCatalogNextResponse = ProductListResult; + +// @public +export interface ProductsListByCatalogOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProductsListByCatalogResponse = ProductListResult; + +// @public +export interface ProductsUpdateHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface ProductsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ProductsUpdateResponse = Product; + +// @public +export interface ProductUpdate { + description?: string; +} + +// @public +export interface ProofOfPossessionNonceRequest { + proofOfPossessionNonce: string; +} + +// @public +export interface ProofOfPossessionNonceResponse extends CertificateProperties { +} + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export type RegionalDataBoundary = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SignedCapabilityImageResponse { + readonly image?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type UpdatePolicy = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/sphere/arm-sphere/rollup.config.js b/sdk/sphere/arm-sphere/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/sphere/arm-sphere/rollup.config.js @@ -0,0 +1,122 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/sphere/arm-sphere/sample.env b/sdk/sphere/arm-sphere/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/sphere/arm-sphere/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/sphere/arm-sphere/src/azureSphereManagementClient.ts b/sdk/sphere/arm-sphere/src/azureSphereManagementClient.ts new file mode 100644 index 000000000000..1061bc49fbb8 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/azureSphereManagementClient.ts @@ -0,0 +1,172 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { + OperationsImpl, + CatalogsImpl, + CertificatesImpl, + ImagesImpl, + ProductsImpl, + DeviceGroupsImpl, + DeploymentsImpl, + DevicesImpl +} from "./operations"; +import { + Operations, + Catalogs, + Certificates, + Images, + Products, + DeviceGroups, + Deployments, + Devices +} from "./operationsInterfaces"; +import { AzureSphereManagementClientOptionalParams } from "./models"; + +export class AzureSphereManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the AzureSphereManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: AzureSphereManagementClientOptionalParams + ) { + 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: AzureSphereManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-sphere/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-09-01-preview"; + this.operations = new OperationsImpl(this); + this.catalogs = new CatalogsImpl(this); + this.certificates = new CertificatesImpl(this); + this.images = new ImagesImpl(this); + this.products = new ProductsImpl(this); + this.deviceGroups = new DeviceGroupsImpl(this); + this.deployments = new DeploymentsImpl(this); + this.devices = new DevicesImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + catalogs: Catalogs; + certificates: Certificates; + images: Images; + products: Products; + deviceGroups: DeviceGroups; + deployments: Deployments; + devices: Devices; +} diff --git a/sdk/sphere/arm-sphere/src/index.ts b/sdk/sphere/arm-sphere/src/index.ts new file mode 100644 index 000000000000..d8f3c1953bf7 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { AzureSphereManagementClient } from "./azureSphereManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/sphere/arm-sphere/src/lroImpl.ts b/sdk/sphere/arm-sphere/src/lroImpl.ts new file mode 100644 index 000000000000..dd803cd5e28c --- /dev/null +++ b/sdk/sphere/arm-sphere/src/lroImpl.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; +} diff --git a/sdk/sphere/arm-sphere/src/models/index.ts b/sdk/sphere/arm-sphere/src/models/index.ts new file mode 100644 index 000000000000..ac42dcf70669 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/models/index.ts @@ -0,0 +1,1534 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** + * List of operations supported by the resource provider + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Operation[]; + /** + * URL to get the next set of operation list results (if there are any). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: Origin; + /** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionType?: ActionType; +} + +/** Localized display information for this particular operation. */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** The response of a Catalog list operation. */ +export interface CatalogListResult { + /** The Catalog items on this page */ + value: Catalog[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** The type used for update operations of the Catalog. */ +export interface CatalogUpdate { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** The response of a Certificate list operation. */ +export interface CertificateListResult { + /** The Certificate items on this page */ + value: Certificate[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** The properties of certificate */ +export interface CertificateProperties { + /** + * The certificate as a UTF-8 encoded base 64 string. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly certificate?: string; + /** + * The certificate status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: CertificateStatus; + /** + * The certificate subject. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly subject?: string; + /** + * The certificate thumbprint. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly thumbprint?: string; + /** + * The certificate expiry date. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiryUtc?: Date; + /** + * The certificate not before date. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly notBeforeUtc?: Date; + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** The certificate chain response. */ +export interface CertificateChainResponse { + /** + * The certificate chain. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly certificateChain?: string; +} + +/** Request for the proof of possession nonce */ +export interface ProofOfPossessionNonceRequest { + /** The proof of possession nonce */ + proofOfPossessionNonce: string; +} + +/** Response of the count for elements. */ +export interface CountElementsResponse { + /** Number of children resources in parent resource. */ + value: number; +} + +/** The response of a Image list operation. */ +export interface ImageListResult { + /** The Image items on this page */ + value: Image[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** The response of a Deployment list operation. */ +export interface DeploymentListResult { + /** The Deployment items on this page */ + value: Deployment[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Request of the action to list device groups for a catalog. */ +export interface ListDeviceGroupsRequest { + /** Device Group name. */ + deviceGroupName?: string; +} + +/** The response of a DeviceGroup list operation. */ +export interface DeviceGroupListResult { + /** The DeviceGroup items on this page */ + value: DeviceGroup[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Paged collection of DeviceInsight items */ +export interface PagedDeviceInsight { + /** The DeviceInsight items on this page */ + value: DeviceInsight[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Device insight report. */ +export interface DeviceInsight { + /** Device ID */ + deviceId: string; + /** Event description */ + description: string; + /** Event start timestamp */ + startTimestampUtc: Date; + /** Event end timestamp */ + endTimestampUtc: Date; + /** Event category */ + eventCategory: string; + /** Event class */ + eventClass: string; + /** Event type */ + eventType: string; + /** Event count */ + eventCount: number; +} + +/** The response of a Device list operation. */ +export interface DeviceListResult { + /** The Device items on this page */ + value: Device[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** The response of a Product list operation. */ +export interface ProductListResult { + /** The Product items on this page */ + value: Product[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** The type used for update operations of the Product. */ +export interface ProductUpdate { + /** Description of the product */ + description?: string; +} + +/** The type used for update operations of the DeviceGroup. */ +export interface DeviceGroupUpdate { + /** Description of the device group. */ + description?: string; + /** Operating system feed type of the device group. */ + osFeedType?: OSFeedType; + /** Update policy of the device group. */ + updatePolicy?: UpdatePolicy; + /** Flag to define if the user allows for crash dump collection. */ + allowCrashDumpsCollection?: AllowCrashDumpCollection; + /** Regional data boundary for the device group. */ + regionalDataBoundary?: RegionalDataBoundary; +} + +/** Request to the action call to bulk claim devices. */ +export interface ClaimDevicesRequest { + /** Device identifiers of the devices to be claimed. */ + deviceIdentifiers: string[]; +} + +/** The type used for update operations of the Device. */ +export interface DeviceUpdate { + /** Device group id */ + deviceGroupId?: string; +} + +/** Request of the action to create a signed device capability image */ +export interface GenerateCapabilityImageRequest { + /** List of capabilities to create */ + capabilities: CapabilityType[]; +} + +/** Signed device capability image response */ +export interface SignedCapabilityImageResponse { + /** + * The signed device capability image as a UTF-8 encoded base 64 string. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly image?: string; +} + +/** The properties of device patch */ +export interface DevicePatchProperties { + /** Device group id */ + deviceGroupId: string; +} + +/** Image upload request body. */ +export interface ImageUploadRequestBody { + /** . */ + images: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +/** Result of the action to generate a proof of possession nonce */ +export interface ProofOfPossessionNonceResponse extends CertificateProperties {} + +/** Response to the action call for count devices in a catalog. */ +export interface CountDeviceResponse extends CountElementsResponse {} + +/** An Azure Sphere catalog */ +export interface Catalog extends TrackedResource { + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** An certificate resource belonging to a catalog resource. */ +export interface Certificate extends ProxyResource { + /** + * The certificate as a UTF-8 encoded base 64 string. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly certificate?: string; + /** + * The certificate status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: CertificateStatus; + /** + * The certificate subject. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly subject?: string; + /** + * The certificate thumbprint. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly thumbprint?: string; + /** + * The certificate expiry date. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiryUtc?: Date; + /** + * The certificate not before date. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly notBeforeUtc?: Date; + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** An image resource belonging to a catalog resource. */ +export interface Image extends ProxyResource { + /** Image as a UTF-8 encoded base 64 string on image create. This field contains the image URI on image reads. */ + image?: string; + /** Image ID */ + imageId?: string; + /** + * Image name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly imageName?: string; + /** Regional data boundary for an image */ + regionalDataBoundary?: RegionalDataBoundary; + /** + * Location the image + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly uri?: string; + /** + * The image description. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** + * The image component id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly componentId?: string; + /** + * The image type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly imageType?: ImageType; + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** An deployment resource belonging to a device group resource. */ +export interface Deployment extends ProxyResource { + /** Deployment ID */ + deploymentId?: string; + /** Images deployed */ + deployedImages?: Image[]; + /** + * Deployment date UTC + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deploymentDateUtc?: Date; + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** An device group resource belonging to a product resource. */ +export interface DeviceGroup extends ProxyResource { + /** Description of the device group. */ + description?: string; + /** Operating system feed type of the device group. */ + osFeedType?: OSFeedType; + /** Update policy of the device group. */ + updatePolicy?: UpdatePolicy; + /** Flag to define if the user allows for crash dump collection. */ + allowCrashDumpsCollection?: AllowCrashDumpCollection; + /** Regional data boundary for the device group. */ + regionalDataBoundary?: RegionalDataBoundary; + /** + * Deployment status for the device group. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly hasDeployment?: boolean; + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** An device resource belonging to a device group resource. */ +export interface Device extends ProxyResource { + /** Device ID */ + deviceId?: string; + /** + * SKU of the chip + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly chipSku?: string; + /** + * OS version available for installation when update requested + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastAvailableOsVersion?: string; + /** + * OS version running on device when update requested + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastInstalledOsVersion?: string; + /** + * Time when update requested and new OS version available + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastOsUpdateUtc?: Date; + /** + * Time when update was last requested + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdateRequestUtc?: Date; + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** An product resource belonging to a catalog resource. */ +export interface Product extends ProxyResource { + /** Description of the product */ + description?: string; + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** Defines headers for Catalogs_createOrUpdate operation. */ +export interface CatalogsCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Catalogs_delete operation. */ +export interface CatalogsDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for Images_createOrUpdate operation. */ +export interface ImagesCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Images_delete operation. */ +export interface ImagesDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for Products_createOrUpdate operation. */ +export interface ProductsCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Products_update operation. */ +export interface ProductsUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for Products_delete operation. */ +export interface ProductsDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for DeviceGroups_createOrUpdate operation. */ +export interface DeviceGroupsCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for DeviceGroups_update operation. */ +export interface DeviceGroupsUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for DeviceGroups_delete operation. */ +export interface DeviceGroupsDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for DeviceGroups_claimDevices operation. */ +export interface DeviceGroupsClaimDevicesHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Deployments_createOrUpdate operation. */ +export interface DeploymentsCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Deployments_delete operation. */ +export interface DeploymentsDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for Devices_createOrUpdate operation. */ +export interface DevicesCreateOrUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Devices_update operation. */ +export interface DevicesUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for Devices_delete operation. */ +export interface DevicesDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for Devices_generateCapabilityImage operation. */ +export interface DevicesGenerateCapabilityImageHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** User */ + User = "user", + /** System */ + System = "system", + /** UserSystem */ + UserSystem = "user,system" +} + +/** + * Defines values for Origin. \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user** \ + * **system** \ + * **user,system** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + /** Internal */ + Internal = "Internal" +} + +/** + * Defines values for ActionType. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal** + */ +export type ActionType = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** The resource is being provisioned */ + Provisioning = "Provisioning", + /** The resource is being updated */ + Updating = "Updating", + /** The resource is being deleted */ + Deleting = "Deleting", + /** The resource create request has been accepted */ + Accepted = "Accepted" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **Provisioning**: The resource is being provisioned \ + * **Updating**: The resource is being updated \ + * **Deleting**: The resource is being deleted \ + * **Accepted**: The resource create request has been accepted + */ +export type ProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link CertificateStatus} that the service accepts. */ +export enum KnownCertificateStatus { + /** Certificate is active */ + Active = "Active", + /** Certificate is inactive */ + Inactive = "Inactive", + /** Certificate has expired */ + Expired = "Expired", + /** Certificate has been revoked */ + Revoked = "Revoked" +} + +/** + * Defines values for CertificateStatus. \ + * {@link KnownCertificateStatus} can be used interchangeably with CertificateStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Active**: Certificate is active \ + * **Inactive**: Certificate is inactive \ + * **Expired**: Certificate has expired \ + * **Revoked**: Certificate has been revoked + */ +export type CertificateStatus = string; + +/** Known values of {@link RegionalDataBoundary} that the service accepts. */ +export enum KnownRegionalDataBoundary { + /** No data boundary */ + None = "None", + /** EU data boundary */ + EU = "EU" +} + +/** + * Defines values for RegionalDataBoundary. \ + * {@link KnownRegionalDataBoundary} can be used interchangeably with RegionalDataBoundary, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None**: No data boundary \ + * **EU**: EU data boundary + */ +export type RegionalDataBoundary = string; + +/** Known values of {@link ImageType} that the service accepts. */ +export enum KnownImageType { + /** Invalid image. */ + InvalidImageType = "InvalidImageType", + /** One Bl image type */ + OneBl = "OneBl", + /** Pluton image type */ + PlutonRuntime = "PlutonRuntime", + /** Wifi firmware image type */ + WifiFirmware = "WifiFirmware", + /** Security monitor image type */ + SecurityMonitor = "SecurityMonitor", + /** Normal world loader image type */ + NormalWorldLoader = "NormalWorldLoader", + /** Normal world dtb image type */ + NormalWorldDtb = "NormalWorldDtb", + /** Normal world kernel image type */ + NormalWorldKernel = "NormalWorldKernel", + /** Root FS image type */ + RootFs = "RootFs", + /** Services image type */ + Services = "Services", + /** Applications image type */ + Applications = "Applications", + /** FW config image type */ + FwConfig = "FwConfig", + /** Boot manifest image type */ + BootManifest = "BootManifest", + /** Nwfs image type */ + Nwfs = "Nwfs", + /** Trusted key store image type */ + TrustedKeystore = "TrustedKeystore", + /** Policy image type */ + Policy = "Policy", + /** Customer board config image type */ + CustomerBoardConfig = "CustomerBoardConfig", + /** Update certificate store image type */ + UpdateCertStore = "UpdateCertStore", + /** Base system update manifest image type */ + BaseSystemUpdateManifest = "BaseSystemUpdateManifest", + /** Firmware update manifest image type */ + FirmwareUpdateManifest = "FirmwareUpdateManifest", + /** Customer update manifest image type */ + CustomerUpdateManifest = "CustomerUpdateManifest", + /** Recovery manifest image type */ + RecoveryManifest = "RecoveryManifest", + /** manifest set image type */ + ManifestSet = "ManifestSet", + /** Other image type */ + Other = "Other" +} + +/** + * Defines values for ImageType. \ + * {@link KnownImageType} can be used interchangeably with ImageType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InvalidImageType**: Invalid image. \ + * **OneBl**: One Bl image type \ + * **PlutonRuntime**: Pluton image type \ + * **WifiFirmware**: Wifi firmware image type \ + * **SecurityMonitor**: Security monitor image type \ + * **NormalWorldLoader**: Normal world loader image type \ + * **NormalWorldDtb**: Normal world dtb image type \ + * **NormalWorldKernel**: Normal world kernel image type \ + * **RootFs**: Root FS image type \ + * **Services**: Services image type \ + * **Applications**: Applications image type \ + * **FwConfig**: FW config image type \ + * **BootManifest**: Boot manifest image type \ + * **Nwfs**: Nwfs image type \ + * **TrustedKeystore**: Trusted key store image type \ + * **Policy**: Policy image type \ + * **CustomerBoardConfig**: Customer board config image type \ + * **UpdateCertStore**: Update certificate store image type \ + * **BaseSystemUpdateManifest**: Base system update manifest image type \ + * **FirmwareUpdateManifest**: Firmware update manifest image type \ + * **CustomerUpdateManifest**: Customer update manifest image type \ + * **RecoveryManifest**: Recovery manifest image type \ + * **ManifestSet**: manifest set image type \ + * **Other**: Other image type + */ +export type ImageType = string; + +/** Known values of {@link OSFeedType} that the service accepts. */ +export enum KnownOSFeedType { + /** Retail OS feed type. */ + Retail = "Retail", + /** Retail evaluation OS feed type. */ + RetailEval = "RetailEval" +} + +/** + * Defines values for OSFeedType. \ + * {@link KnownOSFeedType} can be used interchangeably with OSFeedType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Retail**: Retail OS feed type. \ + * **RetailEval**: Retail evaluation OS feed type. + */ +export type OSFeedType = string; + +/** Known values of {@link UpdatePolicy} that the service accepts. */ +export enum KnownUpdatePolicy { + /** Update all policy. */ + UpdateAll = "UpdateAll", + /** No update for 3rd party app policy. */ + No3RdPartyAppUpdates = "No3rdPartyAppUpdates" +} + +/** + * Defines values for UpdatePolicy. \ + * {@link KnownUpdatePolicy} can be used interchangeably with UpdatePolicy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **UpdateAll**: Update all policy. \ + * **No3rdPartyAppUpdates**: No update for 3rd party app policy. + */ +export type UpdatePolicy = string; + +/** Known values of {@link AllowCrashDumpCollection} that the service accepts. */ +export enum KnownAllowCrashDumpCollection { + /** Crash dump collection enabled */ + Enabled = "Enabled", + /** Crash dump collection disabled */ + Disabled = "Disabled" +} + +/** + * Defines values for AllowCrashDumpCollection. \ + * {@link KnownAllowCrashDumpCollection} can be used interchangeably with AllowCrashDumpCollection, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enabled**: Crash dump collection enabled \ + * **Disabled**: Crash dump collection disabled + */ +export type AllowCrashDumpCollection = string; + +/** Known values of {@link CapabilityType} that the service accepts. */ +export enum KnownCapabilityType { + /** Application development capability */ + ApplicationDevelopment = "ApplicationDevelopment", + /** Field servicing capability */ + FieldServicing = "FieldServicing" +} + +/** + * Defines values for CapabilityType. \ + * {@link KnownCapabilityType} can be used interchangeably with CapabilityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ApplicationDevelopment**: Application development capability \ + * **FieldServicing**: Field servicing capability + */ +export type CapabilityType = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface CatalogsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type CatalogsListBySubscriptionResponse = CatalogListResult; + +/** Optional parameters. */ +export interface CatalogsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type CatalogsListByResourceGroupResponse = CatalogListResult; + +/** Optional parameters. */ +export interface CatalogsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type CatalogsGetResponse = Catalog; + +/** Optional parameters. */ +export interface CatalogsCreateOrUpdateOptionalParams + 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 CatalogsCreateOrUpdateResponse = Catalog; + +/** Optional parameters. */ +export interface CatalogsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type CatalogsUpdateResponse = Catalog; + +/** Optional parameters. */ +export interface CatalogsDeleteOptionalParams + 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 CatalogsCountDevicesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the countDevices operation. */ +export type CatalogsCountDevicesResponse = CountDeviceResponse; + +/** Optional parameters. */ +export interface CatalogsListDeploymentsOptionalParams + extends coreClient.OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Contains response data for the listDeployments operation. */ +export type CatalogsListDeploymentsResponse = DeploymentListResult; + +/** Optional parameters. */ +export interface CatalogsListDeviceGroupsOptionalParams + extends coreClient.OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Contains response data for the listDeviceGroups operation. */ +export type CatalogsListDeviceGroupsResponse = DeviceGroupListResult; + +/** Optional parameters. */ +export interface CatalogsListDeviceInsightsOptionalParams + extends coreClient.OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Contains response data for the listDeviceInsights operation. */ +export type CatalogsListDeviceInsightsResponse = PagedDeviceInsight; + +/** Optional parameters. */ +export interface CatalogsListDevicesOptionalParams + extends coreClient.OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Contains response data for the listDevices operation. */ +export type CatalogsListDevicesResponse = DeviceListResult; + +/** Optional parameters. */ +export interface CatalogsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type CatalogsListBySubscriptionNextResponse = CatalogListResult; + +/** Optional parameters. */ +export interface CatalogsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type CatalogsListByResourceGroupNextResponse = CatalogListResult; + +/** Optional parameters. */ +export interface CatalogsListDeploymentsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDeploymentsNext operation. */ +export type CatalogsListDeploymentsNextResponse = DeploymentListResult; + +/** Optional parameters. */ +export interface CatalogsListDeviceGroupsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDeviceGroupsNext operation. */ +export type CatalogsListDeviceGroupsNextResponse = DeviceGroupListResult; + +/** Optional parameters. */ +export interface CatalogsListDeviceInsightsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDeviceInsightsNext operation. */ +export type CatalogsListDeviceInsightsNextResponse = PagedDeviceInsight; + +/** Optional parameters. */ +export interface CatalogsListDevicesNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listDevicesNext operation. */ +export type CatalogsListDevicesNextResponse = DeviceListResult; + +/** Optional parameters. */ +export interface CertificatesListByCatalogOptionalParams + extends coreClient.OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Contains response data for the listByCatalog operation. */ +export type CertificatesListByCatalogResponse = CertificateListResult; + +/** Optional parameters. */ +export interface CertificatesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type CertificatesGetResponse = Certificate; + +/** Optional parameters. */ +export interface CertificatesRetrieveCertChainOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the retrieveCertChain operation. */ +export type CertificatesRetrieveCertChainResponse = CertificateChainResponse; + +/** Optional parameters. */ +export interface CertificatesRetrieveProofOfPossessionNonceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the retrieveProofOfPossessionNonce operation. */ +export type CertificatesRetrieveProofOfPossessionNonceResponse = ProofOfPossessionNonceResponse; + +/** Optional parameters. */ +export interface CertificatesListByCatalogNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCatalogNext operation. */ +export type CertificatesListByCatalogNextResponse = CertificateListResult; + +/** Optional parameters. */ +export interface ImagesListByCatalogOptionalParams + extends coreClient.OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Contains response data for the listByCatalog operation. */ +export type ImagesListByCatalogResponse = ImageListResult; + +/** Optional parameters. */ +export interface ImagesGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ImagesGetResponse = Image; + +/** Optional parameters. */ +export interface ImagesCreateOrUpdateOptionalParams + 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 ImagesCreateOrUpdateResponse = Image; + +/** Optional parameters. */ +export interface ImagesDeleteOptionalParams + 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 ImagesListByCatalogNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCatalogNext operation. */ +export type ImagesListByCatalogNextResponse = ImageListResult; + +/** Optional parameters. */ +export interface ProductsListByCatalogOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCatalog operation. */ +export type ProductsListByCatalogResponse = ProductListResult; + +/** Optional parameters. */ +export interface ProductsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ProductsGetResponse = Product; + +/** Optional parameters. */ +export interface ProductsCreateOrUpdateOptionalParams + 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 ProductsCreateOrUpdateResponse = Product; + +/** Optional parameters. */ +export interface ProductsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type ProductsUpdateResponse = Product; + +/** Optional parameters. */ +export interface ProductsDeleteOptionalParams + 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 ProductsCountDevicesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the countDevices operation. */ +export type ProductsCountDevicesResponse = CountDeviceResponse; + +/** Optional parameters. */ +export interface ProductsGenerateDefaultDeviceGroupsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the generateDefaultDeviceGroups operation. */ +export type ProductsGenerateDefaultDeviceGroupsResponse = DeviceGroupListResult; + +/** Optional parameters. */ +export interface ProductsListByCatalogNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCatalogNext operation. */ +export type ProductsListByCatalogNextResponse = ProductListResult; + +/** Optional parameters. */ +export interface ProductsGenerateDefaultDeviceGroupsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the generateDefaultDeviceGroupsNext operation. */ +export type ProductsGenerateDefaultDeviceGroupsNextResponse = DeviceGroupListResult; + +/** Optional parameters. */ +export interface DeviceGroupsListByProductOptionalParams + extends coreClient.OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Contains response data for the listByProduct operation. */ +export type DeviceGroupsListByProductResponse = DeviceGroupListResult; + +/** Optional parameters. */ +export interface DeviceGroupsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type DeviceGroupsGetResponse = DeviceGroup; + +/** Optional parameters. */ +export interface DeviceGroupsCreateOrUpdateOptionalParams + 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 DeviceGroupsCreateOrUpdateResponse = DeviceGroup; + +/** Optional parameters. */ +export interface DeviceGroupsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type DeviceGroupsUpdateResponse = DeviceGroup; + +/** Optional parameters. */ +export interface DeviceGroupsDeleteOptionalParams + 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 DeviceGroupsClaimDevicesOptionalParams + 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 claimDevices operation. */ +export type DeviceGroupsClaimDevicesResponse = DeviceGroupsClaimDevicesHeaders; + +/** Optional parameters. */ +export interface DeviceGroupsCountDevicesOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the countDevices operation. */ +export type DeviceGroupsCountDevicesResponse = CountDeviceResponse; + +/** Optional parameters. */ +export interface DeviceGroupsListByProductNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByProductNext operation. */ +export type DeviceGroupsListByProductNextResponse = DeviceGroupListResult; + +/** Optional parameters. */ +export interface DeploymentsListByDeviceGroupOptionalParams + extends coreClient.OperationOptions { + /** Filter the result list using the given expression */ + filter?: string; + /** The number of result items to return. */ + top?: number; + /** The number of result items to skip. */ + skip?: number; + /** The maximum number of result items per page. */ + maxpagesize?: number; +} + +/** Contains response data for the listByDeviceGroup operation. */ +export type DeploymentsListByDeviceGroupResponse = DeploymentListResult; + +/** Optional parameters. */ +export interface DeploymentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type DeploymentsGetResponse = Deployment; + +/** Optional parameters. */ +export interface DeploymentsCreateOrUpdateOptionalParams + 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 DeploymentsCreateOrUpdateResponse = Deployment; + +/** Optional parameters. */ +export interface DeploymentsDeleteOptionalParams + 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 DeploymentsListByDeviceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByDeviceGroupNext operation. */ +export type DeploymentsListByDeviceGroupNextResponse = DeploymentListResult; + +/** Optional parameters. */ +export interface DevicesListByDeviceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByDeviceGroup operation. */ +export type DevicesListByDeviceGroupResponse = DeviceListResult; + +/** Optional parameters. */ +export interface DevicesGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type DevicesGetResponse = Device; + +/** Optional parameters. */ +export interface DevicesCreateOrUpdateOptionalParams + 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 DevicesCreateOrUpdateResponse = Device; + +/** Optional parameters. */ +export interface DevicesUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type DevicesUpdateResponse = Device; + +/** Optional parameters. */ +export interface DevicesDeleteOptionalParams + 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 DevicesGenerateCapabilityImageOptionalParams + 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 generateCapabilityImage operation. */ +export type DevicesGenerateCapabilityImageResponse = SignedCapabilityImageResponse; + +/** Optional parameters. */ +export interface DevicesListByDeviceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByDeviceGroupNext operation. */ +export type DevicesListByDeviceGroupNextResponse = DeviceListResult; + +/** Optional parameters. */ +export interface AzureSphereManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/sphere/arm-sphere/src/models/mappers.ts b/sdk/sphere/arm-sphere/src/models/mappers.ts new file mode 100644 index 000000000000..56968e79b870 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/models/mappers.ts @@ -0,0 +1,1562 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String" + } + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const CatalogListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CatalogListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Catalog" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const CatalogUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CatalogUpdate", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const CertificateListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CertificateListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Certificate" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const CertificateProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CertificateProperties", + modelProperties: { + certificate: { + serializedName: "certificate", + readOnly: true, + type: { + name: "String" + } + }, + status: { + serializedName: "status", + readOnly: true, + type: { + name: "String" + } + }, + subject: { + serializedName: "subject", + readOnly: true, + type: { + name: "String" + } + }, + thumbprint: { + serializedName: "thumbprint", + readOnly: true, + type: { + name: "String" + } + }, + expiryUtc: { + serializedName: "expiryUtc", + readOnly: true, + type: { + name: "DateTime" + } + }, + notBeforeUtc: { + serializedName: "notBeforeUtc", + readOnly: true, + type: { + name: "DateTime" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const CertificateChainResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CertificateChainResponse", + modelProperties: { + certificateChain: { + serializedName: "certificateChain", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProofOfPossessionNonceRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProofOfPossessionNonceRequest", + modelProperties: { + proofOfPossessionNonce: { + serializedName: "proofOfPossessionNonce", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const CountElementsResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CountElementsResponse", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Number" + } + } + } + } +}; + +export const ImageListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImageListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Image" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DeploymentListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Deployment" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ListDeviceGroupsRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ListDeviceGroupsRequest", + modelProperties: { + deviceGroupName: { + serializedName: "deviceGroupName", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceGroupListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceGroupListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceGroup" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const PagedDeviceInsight: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PagedDeviceInsight", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DeviceInsight" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceInsight: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceInsight", + modelProperties: { + deviceId: { + serializedName: "deviceId", + required: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + required: true, + type: { + name: "String" + } + }, + startTimestampUtc: { + serializedName: "startTimestampUtc", + required: true, + type: { + name: "DateTime" + } + }, + endTimestampUtc: { + serializedName: "endTimestampUtc", + required: true, + type: { + name: "DateTime" + } + }, + eventCategory: { + serializedName: "eventCategory", + required: true, + type: { + name: "String" + } + }, + eventClass: { + serializedName: "eventClass", + required: true, + type: { + name: "String" + } + }, + eventType: { + serializedName: "eventType", + required: true, + type: { + name: "String" + } + }, + eventCount: { + serializedName: "eventCount", + required: true, + type: { + name: "Number" + } + } + } + } +}; + +export const DeviceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Device" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ProductListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProductListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Product" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ProductUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProductUpdate", + modelProperties: { + description: { + serializedName: "properties.description", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceGroupUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceGroupUpdate", + modelProperties: { + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + osFeedType: { + serializedName: "properties.osFeedType", + type: { + name: "String" + } + }, + updatePolicy: { + serializedName: "properties.updatePolicy", + type: { + name: "String" + } + }, + allowCrashDumpsCollection: { + serializedName: "properties.allowCrashDumpsCollection", + type: { + name: "String" + } + }, + regionalDataBoundary: { + serializedName: "properties.regionalDataBoundary", + type: { + name: "String" + } + } + } + } +}; + +export const ClaimDevicesRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClaimDevicesRequest", + modelProperties: { + deviceIdentifiers: { + serializedName: "deviceIdentifiers", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const DeviceUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceUpdate", + modelProperties: { + deviceGroupId: { + serializedName: "properties.deviceGroupId", + type: { + name: "String" + } + } + } + } +}; + +export const GenerateCapabilityImageRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GenerateCapabilityImageRequest", + modelProperties: { + capabilities: { + serializedName: "capabilities", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const SignedCapabilityImageResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SignedCapabilityImageResponse", + modelProperties: { + image: { + serializedName: "image", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DevicePatchProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DevicePatchProperties", + modelProperties: { + deviceGroupId: { + serializedName: "deviceGroupId", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ImageUploadRequestBody: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImageUploadRequestBody", + modelProperties: { + images: { + serializedName: "images", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const ProofOfPossessionNonceResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProofOfPossessionNonceResponse", + modelProperties: { + ...CertificateProperties.type.modelProperties + } + } +}; + +export const CountDeviceResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CountDeviceResponse", + modelProperties: { + ...CountElementsResponse.type.modelProperties + } + } +}; + +export const Catalog: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Catalog", + modelProperties: { + ...TrackedResource.type.modelProperties, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Certificate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Certificate", + modelProperties: { + ...ProxyResource.type.modelProperties, + certificate: { + serializedName: "properties.certificate", + readOnly: true, + type: { + name: "String" + } + }, + status: { + serializedName: "properties.status", + readOnly: true, + type: { + name: "String" + } + }, + subject: { + serializedName: "properties.subject", + readOnly: true, + type: { + name: "String" + } + }, + thumbprint: { + serializedName: "properties.thumbprint", + readOnly: true, + type: { + name: "String" + } + }, + expiryUtc: { + serializedName: "properties.expiryUtc", + readOnly: true, + type: { + name: "DateTime" + } + }, + notBeforeUtc: { + serializedName: "properties.notBeforeUtc", + readOnly: true, + type: { + name: "DateTime" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Image: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Image", + modelProperties: { + ...ProxyResource.type.modelProperties, + image: { + serializedName: "properties.image", + type: { + name: "String" + } + }, + imageId: { + serializedName: "properties.imageId", + type: { + name: "String" + } + }, + imageName: { + serializedName: "properties.imageName", + readOnly: true, + type: { + name: "String" + } + }, + regionalDataBoundary: { + serializedName: "properties.regionalDataBoundary", + type: { + name: "String" + } + }, + uri: { + serializedName: "properties.uri", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "properties.description", + readOnly: true, + type: { + name: "String" + } + }, + componentId: { + serializedName: "properties.componentId", + readOnly: true, + type: { + name: "String" + } + }, + imageType: { + serializedName: "properties.imageType", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Deployment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Deployment", + modelProperties: { + ...ProxyResource.type.modelProperties, + deploymentId: { + serializedName: "properties.deploymentId", + type: { + name: "String" + } + }, + deployedImages: { + serializedName: "properties.deployedImages", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Image" + } + } + } + }, + deploymentDateUtc: { + serializedName: "properties.deploymentDateUtc", + readOnly: true, + type: { + name: "DateTime" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DeviceGroup: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceGroup", + modelProperties: { + ...ProxyResource.type.modelProperties, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + osFeedType: { + serializedName: "properties.osFeedType", + type: { + name: "String" + } + }, + updatePolicy: { + serializedName: "properties.updatePolicy", + type: { + name: "String" + } + }, + allowCrashDumpsCollection: { + serializedName: "properties.allowCrashDumpsCollection", + type: { + name: "String" + } + }, + regionalDataBoundary: { + serializedName: "properties.regionalDataBoundary", + type: { + name: "String" + } + }, + hasDeployment: { + serializedName: "properties.hasDeployment", + readOnly: true, + type: { + name: "Boolean" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Device: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Device", + modelProperties: { + ...ProxyResource.type.modelProperties, + deviceId: { + serializedName: "properties.deviceId", + type: { + name: "String" + } + }, + chipSku: { + serializedName: "properties.chipSku", + readOnly: true, + type: { + name: "String" + } + }, + lastAvailableOsVersion: { + serializedName: "properties.lastAvailableOsVersion", + readOnly: true, + type: { + name: "String" + } + }, + lastInstalledOsVersion: { + serializedName: "properties.lastInstalledOsVersion", + readOnly: true, + type: { + name: "String" + } + }, + lastOsUpdateUtc: { + serializedName: "properties.lastOsUpdateUtc", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastUpdateRequestUtc: { + serializedName: "properties.lastUpdateRequestUtc", + readOnly: true, + type: { + name: "DateTime" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Product: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Product", + modelProperties: { + ...ProxyResource.type.modelProperties, + description: { + serializedName: "properties.description", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const CatalogsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CatalogsCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const CatalogsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CatalogsDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const ImagesCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImagesCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const ImagesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ImagesDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const ProductsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProductsCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const ProductsUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProductsUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const ProductsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProductsDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceGroupsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceGroupsCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const DeviceGroupsUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceGroupsUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceGroupsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceGroupsDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const DeviceGroupsClaimDevicesHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeviceGroupsClaimDevicesHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const DeploymentsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentsCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const DeploymentsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentsDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const DevicesCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DevicesCreateOrUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const DevicesUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DevicesUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const DevicesDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DevicesDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const DevicesGenerateCapabilityImageHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DevicesGenerateCapabilityImageHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; diff --git a/sdk/sphere/arm-sphere/src/models/parameters.ts b/sdk/sphere/arm-sphere/src/models/parameters.ts new file mode 100644 index 000000000000..7fdb5fccf114 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/models/parameters.ts @@ -0,0 +1,321 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + Catalog as CatalogMapper, + CatalogUpdate as CatalogUpdateMapper, + ListDeviceGroupsRequest as ListDeviceGroupsRequestMapper, + ProofOfPossessionNonceRequest as ProofOfPossessionNonceRequestMapper, + Image as ImageMapper, + Product as ProductMapper, + ProductUpdate as ProductUpdateMapper, + DeviceGroup as DeviceGroupMapper, + DeviceGroupUpdate as DeviceGroupUpdateMapper, + ClaimDevicesRequest as ClaimDevicesRequestMapper, + Deployment as DeploymentMapper, + Device as DeviceMapper, + DeviceUpdate as DeviceUpdateMapper, + GenerateCapabilityImageRequest as GenerateCapabilityImageRequestMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-09-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const catalogName: OperationURLParameter = { + parameterPath: "catalogName", + mapper: { + constraints: { + Pattern: new RegExp("^[A-Za-z0-9_-]{1,50}$") + }, + serializedName: "catalogName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const resource: OperationParameter = { + parameterPath: "resource", + mapper: CatalogMapper +}; + +export const properties: OperationParameter = { + parameterPath: "properties", + mapper: CatalogUpdateMapper +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; + +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], + mapper: { + serializedName: "$top", + type: { + name: "Number" + } + } +}; + +export const skip: OperationQueryParameter = { + parameterPath: ["options", "skip"], + mapper: { + serializedName: "$skip", + type: { + name: "Number" + } + } +}; + +export const maxpagesize: OperationQueryParameter = { + parameterPath: ["options", "maxpagesize"], + mapper: { + serializedName: "$maxpagesize", + type: { + name: "Number" + } + } +}; + +export const listDeviceGroupsRequest: OperationParameter = { + parameterPath: "listDeviceGroupsRequest", + mapper: ListDeviceGroupsRequestMapper +}; + +export const serialNumber: OperationURLParameter = { + parameterPath: "serialNumber", + mapper: { + serializedName: "serialNumber", + required: true, + type: { + name: "String" + } + } +}; + +export const proofOfPossessionNonceRequest: OperationParameter = { + parameterPath: "proofOfPossessionNonceRequest", + mapper: ProofOfPossessionNonceRequestMapper +}; + +export const imageName: OperationURLParameter = { + parameterPath: "imageName", + mapper: { + serializedName: "imageName", + required: true, + type: { + name: "String" + } + } +}; + +export const resource1: OperationParameter = { + parameterPath: "resource", + mapper: ImageMapper +}; + +export const productName: OperationURLParameter = { + parameterPath: "productName", + mapper: { + constraints: { + Pattern: new RegExp( + "^[\\w][\\w\\s]{1,48}[\\w]$|^\\.default$|^\\.unassigned$" + ) + }, + serializedName: "productName", + required: true, + type: { + name: "String" + } + } +}; + +export const resource2: OperationParameter = { + parameterPath: "resource", + mapper: ProductMapper +}; + +export const properties1: OperationParameter = { + parameterPath: "properties", + mapper: ProductUpdateMapper +}; + +export const deviceGroupName: OperationURLParameter = { + parameterPath: "deviceGroupName", + mapper: { + constraints: { + Pattern: new RegExp( + "^[A-Za-z0-9]{1,2}$|^[A-Za-z0-9][A-Za-z0-9\\s]{1,48}[A-Za-z0-9]$|^\\.default$|^\\.unassigned$" + ) + }, + serializedName: "deviceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const resource3: OperationParameter = { + parameterPath: "resource", + mapper: DeviceGroupMapper +}; + +export const properties2: OperationParameter = { + parameterPath: "properties", + mapper: DeviceGroupUpdateMapper +}; + +export const claimDevicesRequest: OperationParameter = { + parameterPath: "claimDevicesRequest", + mapper: ClaimDevicesRequestMapper +}; + +export const deploymentName: OperationURLParameter = { + parameterPath: "deploymentName", + mapper: { + serializedName: "deploymentName", + required: true, + type: { + name: "String" + } + } +}; + +export const resource4: OperationParameter = { + parameterPath: "resource", + mapper: DeploymentMapper +}; + +export const deviceName: OperationURLParameter = { + parameterPath: "deviceName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9-]{128}$") + }, + serializedName: "deviceName", + required: true, + type: { + name: "String" + } + } +}; + +export const resource5: OperationParameter = { + parameterPath: "resource", + mapper: DeviceMapper +}; + +export const properties3: OperationParameter = { + parameterPath: "properties", + mapper: DeviceUpdateMapper +}; + +export const generateDeviceCapabilityRequest: OperationParameter = { + parameterPath: "generateDeviceCapabilityRequest", + mapper: GenerateCapabilityImageRequestMapper +}; diff --git a/sdk/sphere/arm-sphere/src/operations/catalogs.ts b/sdk/sphere/arm-sphere/src/operations/catalogs.ts new file mode 100644 index 000000000000..77e26d868f47 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/catalogs.ts @@ -0,0 +1,1390 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Catalogs } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureSphereManagementClient } from "../azureSphereManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + Catalog, + CatalogsListBySubscriptionNextOptionalParams, + CatalogsListBySubscriptionOptionalParams, + CatalogsListBySubscriptionResponse, + CatalogsListByResourceGroupNextOptionalParams, + CatalogsListByResourceGroupOptionalParams, + CatalogsListByResourceGroupResponse, + Deployment, + CatalogsListDeploymentsNextOptionalParams, + CatalogsListDeploymentsOptionalParams, + CatalogsListDeploymentsResponse, + DeviceGroup, + ListDeviceGroupsRequest, + CatalogsListDeviceGroupsNextOptionalParams, + CatalogsListDeviceGroupsOptionalParams, + CatalogsListDeviceGroupsResponse, + DeviceInsight, + CatalogsListDeviceInsightsNextOptionalParams, + CatalogsListDeviceInsightsOptionalParams, + CatalogsListDeviceInsightsResponse, + Device, + CatalogsListDevicesNextOptionalParams, + CatalogsListDevicesOptionalParams, + CatalogsListDevicesResponse, + CatalogsGetOptionalParams, + CatalogsGetResponse, + CatalogsCreateOrUpdateOptionalParams, + CatalogsCreateOrUpdateResponse, + CatalogUpdate, + CatalogsUpdateOptionalParams, + CatalogsUpdateResponse, + CatalogsDeleteOptionalParams, + CatalogsCountDevicesOptionalParams, + CatalogsCountDevicesResponse, + CatalogsListBySubscriptionNextResponse, + CatalogsListByResourceGroupNextResponse, + CatalogsListDeploymentsNextResponse, + CatalogsListDeviceGroupsNextResponse, + CatalogsListDeviceInsightsNextResponse, + CatalogsListDevicesNextResponse +} from "../models"; + +/// +/** Class containing Catalogs operations. */ +export class CatalogsImpl implements Catalogs { + private readonly client: AzureSphereManagementClient; + + /** + * Initialize a new instance of the class Catalogs class. + * @param client Reference to the service client + */ + constructor(client: AzureSphereManagementClient) { + this.client = client; + } + + /** + * List Catalog resources by subscription ID + * @param options The options parameters. + */ + public listBySubscription( + options?: CatalogsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: CatalogsListBySubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CatalogsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionPagingAll( + options?: CatalogsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * List Catalog resources by resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: CatalogsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: CatalogsListByResourceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CatalogsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: CatalogsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Lists deployments for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + public listDeployments( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeploymentsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDeploymentsPagingAll( + resourceGroupName, + catalogName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listDeploymentsPagingPage( + resourceGroupName, + catalogName, + options, + settings + ); + } + }; + } + + private async *listDeploymentsPagingPage( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeploymentsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CatalogsListDeploymentsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listDeployments( + resourceGroupName, + catalogName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listDeploymentsNext( + resourceGroupName, + catalogName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listDeploymentsPagingAll( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeploymentsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDeploymentsPagingPage( + resourceGroupName, + catalogName, + options + )) { + yield* page; + } + } + + /** + * List the device groups for the catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param listDeviceGroupsRequest List device groups for catalog. + * @param options The options parameters. + */ + public listDeviceGroups( + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options?: CatalogsListDeviceGroupsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDeviceGroupsPagingAll( + resourceGroupName, + catalogName, + listDeviceGroupsRequest, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listDeviceGroupsPagingPage( + resourceGroupName, + catalogName, + listDeviceGroupsRequest, + options, + settings + ); + } + }; + } + + private async *listDeviceGroupsPagingPage( + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options?: CatalogsListDeviceGroupsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CatalogsListDeviceGroupsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listDeviceGroups( + resourceGroupName, + catalogName, + listDeviceGroupsRequest, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listDeviceGroupsNext( + resourceGroupName, + catalogName, + listDeviceGroupsRequest, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listDeviceGroupsPagingAll( + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options?: CatalogsListDeviceGroupsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDeviceGroupsPagingPage( + resourceGroupName, + catalogName, + listDeviceGroupsRequest, + options + )) { + yield* page; + } + } + + /** + * Lists device insights for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + public listDeviceInsights( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeviceInsightsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDeviceInsightsPagingAll( + resourceGroupName, + catalogName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listDeviceInsightsPagingPage( + resourceGroupName, + catalogName, + options, + settings + ); + } + }; + } + + private async *listDeviceInsightsPagingPage( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeviceInsightsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CatalogsListDeviceInsightsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listDeviceInsights( + resourceGroupName, + catalogName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listDeviceInsightsNext( + resourceGroupName, + catalogName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listDeviceInsightsPagingAll( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeviceInsightsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDeviceInsightsPagingPage( + resourceGroupName, + catalogName, + options + )) { + yield* page; + } + } + + /** + * Lists devices for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + public listDevices( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDevicesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listDevicesPagingAll( + resourceGroupName, + catalogName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listDevicesPagingPage( + resourceGroupName, + catalogName, + options, + settings + ); + } + }; + } + + private async *listDevicesPagingPage( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDevicesOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CatalogsListDevicesResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listDevices(resourceGroupName, catalogName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listDevicesNext( + resourceGroupName, + catalogName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listDevicesPagingAll( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDevicesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listDevicesPagingPage( + resourceGroupName, + catalogName, + options + )) { + yield* page; + } + } + + /** + * List Catalog resources by subscription ID + * @param options The options parameters. + */ + private _listBySubscription( + options?: CatalogsListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * List Catalog resources by resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: CatalogsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Get a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + options?: CatalogsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, options }, + getOperationSpec + ); + } + + /** + * Create a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + resource: Catalog, + options?: CatalogsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + CatalogsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, catalogName, resource, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + CatalogsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + resource: Catalog, + options?: CatalogsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + catalogName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + catalogName: string, + properties: CatalogUpdate, + options?: CatalogsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, properties, options }, + updateOperationSpec + ); + } + + /** + * Delete a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + catalogName: string, + options?: CatalogsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, catalogName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + options?: CatalogsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + catalogName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Counts devices in catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + countDevices( + resourceGroupName: string, + catalogName: string, + options?: CatalogsCountDevicesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, options }, + countDevicesOperationSpec + ); + } + + /** + * Lists deployments for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + private _listDeployments( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeploymentsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, options }, + listDeploymentsOperationSpec + ); + } + + /** + * List the device groups for the catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param listDeviceGroupsRequest List device groups for catalog. + * @param options The options parameters. + */ + private _listDeviceGroups( + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options?: CatalogsListDeviceGroupsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, listDeviceGroupsRequest, options }, + listDeviceGroupsOperationSpec + ); + } + + /** + * Lists device insights for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + private _listDeviceInsights( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeviceInsightsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, options }, + listDeviceInsightsOperationSpec + ); + } + + /** + * Lists devices for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + private _listDevices( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDevicesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, options }, + listDevicesOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: CatalogsListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: CatalogsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } + + /** + * ListDeploymentsNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param nextLink The nextLink from the previous successful call to the ListDeployments method. + * @param options The options parameters. + */ + private _listDeploymentsNext( + resourceGroupName: string, + catalogName: string, + nextLink: string, + options?: CatalogsListDeploymentsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, nextLink, options }, + listDeploymentsNextOperationSpec + ); + } + + /** + * ListDeviceGroupsNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param listDeviceGroupsRequest List device groups for catalog. + * @param nextLink The nextLink from the previous successful call to the ListDeviceGroups method. + * @param options The options parameters. + */ + private _listDeviceGroupsNext( + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + nextLink: string, + options?: CatalogsListDeviceGroupsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + catalogName, + listDeviceGroupsRequest, + nextLink, + options + }, + listDeviceGroupsNextOperationSpec + ); + } + + /** + * ListDeviceInsightsNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param nextLink The nextLink from the previous successful call to the ListDeviceInsights method. + * @param options The options parameters. + */ + private _listDeviceInsightsNext( + resourceGroupName: string, + catalogName: string, + nextLink: string, + options?: CatalogsListDeviceInsightsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, nextLink, options }, + listDeviceInsightsNextOperationSpec + ); + } + + /** + * ListDevicesNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param nextLink The nextLink from the previous successful call to the ListDevices method. + * @param options The options parameters. + */ + private _listDevicesNext( + resourceGroupName: string, + catalogName: string, + nextLink: string, + options?: CatalogsListDevicesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, nextLink, options }, + listDevicesNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CatalogListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CatalogListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Catalog + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Catalog + }, + 201: { + bodyMapper: Mappers.Catalog + }, + 202: { + bodyMapper: Mappers.Catalog + }, + 204: { + bodyMapper: Mappers.Catalog + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Catalog + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.properties, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const countDevicesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/countDevices", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CountDeviceResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeploymentsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeployments", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeploymentListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skip, + Parameters.maxpagesize + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeviceGroupsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceGroups", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroupListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.listDeviceGroupsRequest, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skip, + Parameters.maxpagesize + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listDeviceInsightsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDeviceInsights", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.PagedDeviceInsight + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skip, + Parameters.maxpagesize + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDevicesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/listDevices", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeviceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skip, + Parameters.maxpagesize + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CatalogListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CatalogListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeploymentsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDeviceGroupsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroupListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listDeviceInsightsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PagedDeviceInsight + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listDevicesNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/sphere/arm-sphere/src/operations/certificates.ts b/sdk/sphere/arm-sphere/src/operations/certificates.ts new file mode 100644 index 000000000000..9467a20302ef --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/certificates.ts @@ -0,0 +1,354 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Certificates } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureSphereManagementClient } from "../azureSphereManagementClient"; +import { + Certificate, + CertificatesListByCatalogNextOptionalParams, + CertificatesListByCatalogOptionalParams, + CertificatesListByCatalogResponse, + CertificatesGetOptionalParams, + CertificatesGetResponse, + CertificatesRetrieveCertChainOptionalParams, + CertificatesRetrieveCertChainResponse, + ProofOfPossessionNonceRequest, + CertificatesRetrieveProofOfPossessionNonceOptionalParams, + CertificatesRetrieveProofOfPossessionNonceResponse, + CertificatesListByCatalogNextResponse +} from "../models"; + +/// +/** Class containing Certificates operations. */ +export class CertificatesImpl implements Certificates { + private readonly client: AzureSphereManagementClient; + + /** + * Initialize a new instance of the class Certificates class. + * @param client Reference to the service client + */ + constructor(client: AzureSphereManagementClient) { + this.client = client; + } + + /** + * List Certificate resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + public listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: CertificatesListByCatalogOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByCatalogPagingAll( + resourceGroupName, + catalogName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByCatalogPagingPage( + resourceGroupName, + catalogName, + options, + settings + ); + } + }; + } + + private async *listByCatalogPagingPage( + resourceGroupName: string, + catalogName: string, + options?: CertificatesListByCatalogOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CertificatesListByCatalogResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByCatalog( + resourceGroupName, + catalogName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByCatalogNext( + resourceGroupName, + catalogName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByCatalogPagingAll( + resourceGroupName: string, + catalogName: string, + options?: CertificatesListByCatalogOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByCatalogPagingPage( + resourceGroupName, + catalogName, + options + )) { + yield* page; + } + } + + /** + * List Certificate resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + private _listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: CertificatesListByCatalogOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, options }, + listByCatalogOperationSpec + ); + } + + /** + * Get a Certificate + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param serialNumber Serial number of the certificate. Use '.default' to get current active + * certificate. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options?: CertificatesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, serialNumber, options }, + getOperationSpec + ); + } + + /** + * Retrieves cert chain. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param serialNumber Serial number of the certificate. Use '.default' to get current active + * certificate. + * @param options The options parameters. + */ + retrieveCertChain( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options?: CertificatesRetrieveCertChainOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, serialNumber, options }, + retrieveCertChainOperationSpec + ); + } + + /** + * Gets the proof of possession nonce. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param serialNumber Serial number of the certificate. Use '.default' to get current active + * certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body + * @param options The options parameters. + */ + retrieveProofOfPossessionNonce( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, + options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + catalogName, + serialNumber, + proofOfPossessionNonceRequest, + options + }, + retrieveProofOfPossessionNonceOperationSpec + ); + } + + /** + * ListByCatalogNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param nextLink The nextLink from the previous successful call to the ListByCatalog method. + * @param options The options parameters. + */ + private _listByCatalogNext( + resourceGroupName: string, + catalogName: string, + nextLink: string, + options?: CertificatesListByCatalogNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, nextLink, options }, + listByCatalogNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByCatalogOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CertificateListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skip, + Parameters.maxpagesize + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Certificate + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.serialNumber + ], + headerParameters: [Parameters.accept], + serializer +}; +const retrieveCertChainOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CertificateChainResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.serialNumber + ], + headerParameters: [Parameters.accept], + serializer +}; +const retrieveProofOfPossessionNonceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ProofOfPossessionNonceResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.proofOfPossessionNonceRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.serialNumber + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listByCatalogNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CertificateListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/sphere/arm-sphere/src/operations/deployments.ts b/sdk/sphere/arm-sphere/src/operations/deployments.ts new file mode 100644 index 000000000000..4b1802b9bcc4 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/deployments.ts @@ -0,0 +1,609 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Deployments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureSphereManagementClient } from "../azureSphereManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + Deployment, + DeploymentsListByDeviceGroupNextOptionalParams, + DeploymentsListByDeviceGroupOptionalParams, + DeploymentsListByDeviceGroupResponse, + DeploymentsGetOptionalParams, + DeploymentsGetResponse, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsCreateOrUpdateResponse, + DeploymentsDeleteOptionalParams, + DeploymentsListByDeviceGroupNextResponse +} from "../models"; + +/// +/** Class containing Deployments operations. */ +export class DeploymentsImpl implements Deployments { + private readonly client: AzureSphereManagementClient; + + /** + * Initialize a new instance of the class Deployments class. + * @param client Reference to the service client + */ + constructor(client: AzureSphereManagementClient) { + this.client = client; + } + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and + * cannot be used for product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + public listByDeviceGroup( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeploymentsListByDeviceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByDeviceGroupPagingAll( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByDeviceGroupPagingPage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options, + settings + ); + } + }; + } + + private async *listByDeviceGroupPagingPage( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeploymentsListByDeviceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DeploymentsListByDeviceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByDeviceGroup( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByDeviceGroupNext( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByDeviceGroupPagingAll( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeploymentsListByDeviceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByDeviceGroupPagingPage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options + )) { + yield* page; + } + } + + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and + * cannot be used for product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + private _listByDeviceGroup( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeploymentsListByDeviceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, deviceGroupName, options }, + listByDeviceGroupOperationSpec + ); + } + + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + options + }, + getOperationSpec + ); + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + resource: Deployment, + options?: DeploymentsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeploymentsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + resource, + options + }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + DeploymentsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + resource: Deployment, + options?: DeploymentsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + options + }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deploymentName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListByDeviceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param nextLink The nextLink from the previous successful call to the ListByDeviceGroup method. + * @param options The options parameters. + */ + private _listByDeviceGroupNext( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + nextLink: string, + options?: DeploymentsListByDeviceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + nextLink, + options + }, + listByDeviceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByDeviceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skip, + Parameters.maxpagesize + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Deployment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName, + Parameters.deploymentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Deployment + }, + 201: { + bodyMapper: Mappers.Deployment + }, + 202: { + bodyMapper: Mappers.Deployment + }, + 204: { + bodyMapper: Mappers.Deployment + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName, + Parameters.deploymentName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName, + Parameters.deploymentName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByDeviceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/sphere/arm-sphere/src/operations/deviceGroups.ts b/sdk/sphere/arm-sphere/src/operations/deviceGroups.ts new file mode 100644 index 000000000000..1c5048a414c5 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/deviceGroups.ts @@ -0,0 +1,912 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { DeviceGroups } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureSphereManagementClient } from "../azureSphereManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + DeviceGroup, + DeviceGroupsListByProductNextOptionalParams, + DeviceGroupsListByProductOptionalParams, + DeviceGroupsListByProductResponse, + DeviceGroupsGetOptionalParams, + DeviceGroupsGetResponse, + DeviceGroupsCreateOrUpdateOptionalParams, + DeviceGroupsCreateOrUpdateResponse, + DeviceGroupUpdate, + DeviceGroupsUpdateOptionalParams, + DeviceGroupsUpdateResponse, + DeviceGroupsDeleteOptionalParams, + ClaimDevicesRequest, + DeviceGroupsClaimDevicesOptionalParams, + DeviceGroupsClaimDevicesResponse, + DeviceGroupsCountDevicesOptionalParams, + DeviceGroupsCountDevicesResponse, + DeviceGroupsListByProductNextResponse +} from "../models"; + +/// +/** Class containing DeviceGroups operations. */ +export class DeviceGroupsImpl implements DeviceGroups { + private readonly client: AzureSphereManagementClient; + + /** + * Initialize a new instance of the class DeviceGroups class. + * @param client Reference to the service client + */ + constructor(client: AzureSphereManagementClient) { + this.client = client; + } + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + public listByProduct( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: DeviceGroupsListByProductOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByProductPagingAll( + resourceGroupName, + catalogName, + productName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByProductPagingPage( + resourceGroupName, + catalogName, + productName, + options, + settings + ); + } + }; + } + + private async *listByProductPagingPage( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: DeviceGroupsListByProductOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DeviceGroupsListByProductResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByProduct( + resourceGroupName, + catalogName, + productName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByProductNext( + resourceGroupName, + catalogName, + productName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByProductPagingAll( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: DeviceGroupsListByProductOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByProductPagingPage( + resourceGroupName, + catalogName, + productName, + options + )) { + yield* page; + } + } + + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + private _listByProduct( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: DeviceGroupsListByProductOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, options }, + listByProductOperationSpec + ); + } + + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, deviceGroupName, options }, + getOperationSpec + ); + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + resource: DeviceGroup, + options?: DeviceGroupsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeviceGroupsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + resource, + options + }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + DeviceGroupsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + resource: DeviceGroup, + options?: DeviceGroupsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + properties: DeviceGroupUpdate, + options?: DeviceGroupsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeviceGroupsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + properties, + options + }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + DeviceGroupsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + properties: DeviceGroupUpdate, + options?: DeviceGroupsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + properties, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options + }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when + * bulk claiming devices to a catalog only. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @param options The options parameters. + */ + async beginClaimDevices( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + claimDevicesRequest: ClaimDevicesRequest, + options?: DeviceGroupsClaimDevicesOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeviceGroupsClaimDevicesResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + claimDevicesRequest, + options + }, + spec: claimDevicesOperationSpec + }); + const poller = await createHttpPoller< + DeviceGroupsClaimDevicesResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when + * bulk claiming devices to a catalog only. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @param options The options parameters. + */ + async beginClaimDevicesAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + claimDevicesRequest: ClaimDevicesRequest, + options?: DeviceGroupsClaimDevicesOptionalParams + ): Promise { + const poller = await this.beginClaimDevices( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + claimDevicesRequest, + options + ); + return poller.pollUntilDone(); + } + + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + countDevices( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsCountDevicesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, deviceGroupName, options }, + countDevicesOperationSpec + ); + } + + /** + * ListByProductNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param nextLink The nextLink from the previous successful call to the ListByProduct method. + * @param options The options parameters. + */ + private _listByProductNext( + resourceGroupName: string, + catalogName: string, + productName: string, + nextLink: string, + options?: DeviceGroupsListByProductNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, nextLink, options }, + listByProductNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByProductOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroupListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skip, + Parameters.maxpagesize + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroup + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroup + }, + 201: { + bodyMapper: Mappers.DeviceGroup + }, + 202: { + bodyMapper: Mappers.DeviceGroup + }, + 204: { + bodyMapper: Mappers.DeviceGroup + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroup + }, + 201: { + bodyMapper: Mappers.DeviceGroup + }, + 202: { + bodyMapper: Mappers.DeviceGroup + }, + 204: { + bodyMapper: Mappers.DeviceGroup + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.properties2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const claimDevicesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices", + httpMethod: "POST", + responses: { + 200: { + headersMapper: Mappers.DeviceGroupsClaimDevicesHeaders + }, + 201: { + headersMapper: Mappers.DeviceGroupsClaimDevicesHeaders + }, + 202: { + headersMapper: Mappers.DeviceGroupsClaimDevicesHeaders + }, + 204: { + headersMapper: Mappers.DeviceGroupsClaimDevicesHeaders + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.claimDevicesRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const countDevicesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CountDeviceResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByProductNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroupListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/sphere/arm-sphere/src/operations/devices.ts b/sdk/sphere/arm-sphere/src/operations/devices.ts new file mode 100644 index 000000000000..a9b8ecc0d08c --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/devices.ts @@ -0,0 +1,918 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Devices } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureSphereManagementClient } from "../azureSphereManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + Device, + DevicesListByDeviceGroupNextOptionalParams, + DevicesListByDeviceGroupOptionalParams, + DevicesListByDeviceGroupResponse, + DevicesGetOptionalParams, + DevicesGetResponse, + DevicesCreateOrUpdateOptionalParams, + DevicesCreateOrUpdateResponse, + DeviceUpdate, + DevicesUpdateOptionalParams, + DevicesUpdateResponse, + DevicesDeleteOptionalParams, + GenerateCapabilityImageRequest, + DevicesGenerateCapabilityImageOptionalParams, + DevicesGenerateCapabilityImageResponse, + DevicesListByDeviceGroupNextResponse +} from "../models"; + +/// +/** Class containing Devices operations. */ +export class DevicesImpl implements Devices { + private readonly client: AzureSphereManagementClient; + + /** + * Initialize a new instance of the class Devices class. + * @param client Reference to the service client + */ + constructor(client: AzureSphereManagementClient) { + this.client = client; + } + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and + * cannot be used for product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + public listByDeviceGroup( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DevicesListByDeviceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByDeviceGroupPagingAll( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByDeviceGroupPagingPage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options, + settings + ); + } + }; + } + + private async *listByDeviceGroupPagingPage( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DevicesListByDeviceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: DevicesListByDeviceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByDeviceGroup( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByDeviceGroupNext( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByDeviceGroupPagingAll( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DevicesListByDeviceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByDeviceGroupPagingPage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + options + )) { + yield* page; + } + } + + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and + * cannot be used for product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + private _listByDeviceGroup( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DevicesListByDeviceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, deviceGroupName, options }, + listByDeviceGroupOperationSpec + ); + } + + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device + * does not belong to a device group and product. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + options + }, + getOperationSpec + ); + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a + * device to the catalog only. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + resource: Device, + options?: DevicesCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DevicesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + resource, + options + }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + DevicesCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a + * device to the catalog only. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + resource: Device, + options?: DevicesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a + * device to the catalog level. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + properties: DeviceUpdate, + options?: DevicesUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DevicesUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + properties, + options + }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + DevicesUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a + * device to the catalog level. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + properties: DeviceUpdate, + options?: DevicesUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + properties, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a Device + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + options + }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a Device + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group + * and product names to generate the image for a device that does not belong to a specific device group + * and product. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @param options The options parameters. + */ + async beginGenerateCapabilityImage( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, + options?: DevicesGenerateCapabilityImageOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DevicesGenerateCapabilityImageResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + options + }, + spec: generateCapabilityImageOperationSpec + }); + const poller = await createHttpPoller< + DevicesGenerateCapabilityImageResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group + * and product names to generate the image for a device that does not belong to a specific device group + * and product. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @param options The options parameters. + */ + async beginGenerateCapabilityImageAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, + options?: DevicesGenerateCapabilityImageOptionalParams + ): Promise { + const poller = await this.beginGenerateCapabilityImage( + resourceGroupName, + catalogName, + productName, + deviceGroupName, + deviceName, + generateDeviceCapabilityRequest, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListByDeviceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param nextLink The nextLink from the previous successful call to the ListByDeviceGroup method. + * @param options The options parameters. + */ + private _listByDeviceGroupNext( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + nextLink: string, + options?: DevicesListByDeviceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + catalogName, + productName, + deviceGroupName, + nextLink, + options + }, + listByDeviceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByDeviceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Device + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName, + Parameters.deviceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Device + }, + 201: { + bodyMapper: Mappers.Device + }, + 202: { + bodyMapper: Mappers.Device + }, + 204: { + bodyMapper: Mappers.Device + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource5, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName, + Parameters.deviceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Device + }, + 201: { + bodyMapper: Mappers.Device + }, + 202: { + bodyMapper: Mappers.Device + }, + 204: { + bodyMapper: Mappers.Device + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.properties3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName, + Parameters.deviceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName, + Parameters.deviceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const generateCapabilityImageOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.SignedCapabilityImageResponse + }, + 201: { + bodyMapper: Mappers.SignedCapabilityImageResponse + }, + 202: { + bodyMapper: Mappers.SignedCapabilityImageResponse + }, + 204: { + bodyMapper: Mappers.SignedCapabilityImageResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.generateDeviceCapabilityRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName, + Parameters.deviceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listByDeviceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName, + Parameters.deviceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/sphere/arm-sphere/src/operations/images.ts b/sdk/sphere/arm-sphere/src/operations/images.ts new file mode 100644 index 000000000000..ce13fe3874dd --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/images.ts @@ -0,0 +1,508 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Images } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureSphereManagementClient } from "../azureSphereManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + Image, + ImagesListByCatalogNextOptionalParams, + ImagesListByCatalogOptionalParams, + ImagesListByCatalogResponse, + ImagesGetOptionalParams, + ImagesGetResponse, + ImagesCreateOrUpdateOptionalParams, + ImagesCreateOrUpdateResponse, + ImagesDeleteOptionalParams, + ImagesListByCatalogNextResponse +} from "../models"; + +/// +/** Class containing Images operations. */ +export class ImagesImpl implements Images { + private readonly client: AzureSphereManagementClient; + + /** + * Initialize a new instance of the class Images class. + * @param client Reference to the service client + */ + constructor(client: AzureSphereManagementClient) { + this.client = client; + } + + /** + * List Image resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + public listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: ImagesListByCatalogOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByCatalogPagingAll( + resourceGroupName, + catalogName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByCatalogPagingPage( + resourceGroupName, + catalogName, + options, + settings + ); + } + }; + } + + private async *listByCatalogPagingPage( + resourceGroupName: string, + catalogName: string, + options?: ImagesListByCatalogOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ImagesListByCatalogResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByCatalog( + resourceGroupName, + catalogName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByCatalogNext( + resourceGroupName, + catalogName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByCatalogPagingAll( + resourceGroupName: string, + catalogName: string, + options?: ImagesListByCatalogOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByCatalogPagingPage( + resourceGroupName, + catalogName, + options + )) { + yield* page; + } + } + + /** + * List Image resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + private _listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: ImagesListByCatalogOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, options }, + listByCatalogOperationSpec + ); + } + + /** + * Get a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, imageName, options }, + getOperationSpec + ); + } + + /** + * Create a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + imageName: string, + resource: Image, + options?: ImagesCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ImagesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, catalogName, imageName, resource, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + ImagesCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + imageName: string, + resource: Image, + options?: ImagesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + catalogName, + imageName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, catalogName, imageName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + catalogName, + imageName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListByCatalogNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param nextLink The nextLink from the previous successful call to the ListByCatalog method. + * @param options The options parameters. + */ + private _listByCatalogNext( + resourceGroupName: string, + catalogName: string, + nextLink: string, + options?: ImagesListByCatalogNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, nextLink, options }, + listByCatalogNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByCatalogOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ImageListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.top, + Parameters.skip, + Parameters.maxpagesize + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Image + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.imageName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Image + }, + 201: { + bodyMapper: Mappers.Image + }, + 202: { + bodyMapper: Mappers.Image + }, + 204: { + bodyMapper: Mappers.Image + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.imageName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.imageName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByCatalogNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ImageListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/sphere/arm-sphere/src/operations/index.ts b/sdk/sphere/arm-sphere/src/operations/index.ts new file mode 100644 index 000000000000..eaa8abdeac3f --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./catalogs"; +export * from "./certificates"; +export * from "./images"; +export * from "./products"; +export * from "./deviceGroups"; +export * from "./deployments"; +export * from "./devices"; diff --git a/sdk/sphere/arm-sphere/src/operations/operations.ts b/sdk/sphere/arm-sphere/src/operations/operations.ts new file mode 100644 index 000000000000..252696ba6ae2 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureSphereManagementClient } from "../azureSphereManagementClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: AzureSphereManagementClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: AzureSphereManagementClient) { + this.client = client; + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List the operations for the provider + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.AzureSphere/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/sphere/arm-sphere/src/operations/products.ts b/sdk/sphere/arm-sphere/src/operations/products.ts new file mode 100644 index 000000000000..cf347a997744 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operations/products.ts @@ -0,0 +1,884 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Products } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureSphereManagementClient } from "../azureSphereManagementClient"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + Product, + ProductsListByCatalogNextOptionalParams, + ProductsListByCatalogOptionalParams, + ProductsListByCatalogResponse, + DeviceGroup, + ProductsGenerateDefaultDeviceGroupsNextOptionalParams, + ProductsGenerateDefaultDeviceGroupsOptionalParams, + ProductsGenerateDefaultDeviceGroupsResponse, + ProductsGetOptionalParams, + ProductsGetResponse, + ProductsCreateOrUpdateOptionalParams, + ProductsCreateOrUpdateResponse, + ProductUpdate, + ProductsUpdateOptionalParams, + ProductsUpdateResponse, + ProductsDeleteOptionalParams, + ProductsCountDevicesOptionalParams, + ProductsCountDevicesResponse, + ProductsListByCatalogNextResponse, + ProductsGenerateDefaultDeviceGroupsNextResponse +} from "../models"; + +/// +/** Class containing Products operations. */ +export class ProductsImpl implements Products { + private readonly client: AzureSphereManagementClient; + + /** + * Initialize a new instance of the class Products class. + * @param client Reference to the service client + */ + constructor(client: AzureSphereManagementClient) { + this.client = client; + } + + /** + * List Product resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + public listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: ProductsListByCatalogOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByCatalogPagingAll( + resourceGroupName, + catalogName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByCatalogPagingPage( + resourceGroupName, + catalogName, + options, + settings + ); + } + }; + } + + private async *listByCatalogPagingPage( + resourceGroupName: string, + catalogName: string, + options?: ProductsListByCatalogOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ProductsListByCatalogResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByCatalog( + resourceGroupName, + catalogName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByCatalogNext( + resourceGroupName, + catalogName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByCatalogPagingAll( + resourceGroupName: string, + catalogName: string, + options?: ProductsListByCatalogOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByCatalogPagingPage( + resourceGroupName, + catalogName, + options + )) { + yield* page; + } + } + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined + * values and cannot be used for product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + public listGenerateDefaultDeviceGroups( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGenerateDefaultDeviceGroupsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.generateDefaultDeviceGroupsPagingAll( + resourceGroupName, + catalogName, + productName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.generateDefaultDeviceGroupsPagingPage( + resourceGroupName, + catalogName, + productName, + options, + settings + ); + } + }; + } + + private async *generateDefaultDeviceGroupsPagingPage( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGenerateDefaultDeviceGroupsOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: ProductsGenerateDefaultDeviceGroupsResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._generateDefaultDeviceGroups( + resourceGroupName, + catalogName, + productName, + options + ); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._generateDefaultDeviceGroupsNext( + resourceGroupName, + catalogName, + productName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *generateDefaultDeviceGroupsPagingAll( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGenerateDefaultDeviceGroupsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.generateDefaultDeviceGroupsPagingPage( + resourceGroupName, + catalogName, + productName, + options + )) { + yield* page; + } + } + + /** + * List Product resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + private _listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: ProductsListByCatalogOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, options }, + listByCatalogOperationSpec + ); + } + + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, options }, + getOperationSpec + ); + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + resource: Product, + options?: ProductsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ProductsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, catalogName, productName, resource, options }, + spec: createOrUpdateOperationSpec + }); + const poller = await createHttpPoller< + ProductsCreateOrUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + resource: Product, + options?: ProductsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + catalogName, + productName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + properties: ProductUpdate, + options?: ProductsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ProductsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { + resourceGroupName, + catalogName, + productName, + properties, + options + }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + ProductsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + properties: ProductUpdate, + options?: ProductsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + catalogName, + productName, + properties, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name' + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, catalogName, productName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name' + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + catalogName, + productName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + countDevices( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsCountDevicesOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, options }, + countDevicesOperationSpec + ); + } + + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined + * values and cannot be used for product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + private _generateDefaultDeviceGroups( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGenerateDefaultDeviceGroupsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, options }, + generateDefaultDeviceGroupsOperationSpec + ); + } + + /** + * ListByCatalogNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param nextLink The nextLink from the previous successful call to the ListByCatalog method. + * @param options The options parameters. + */ + private _listByCatalogNext( + resourceGroupName: string, + catalogName: string, + nextLink: string, + options?: ProductsListByCatalogNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, nextLink, options }, + listByCatalogNextOperationSpec + ); + } + + /** + * GenerateDefaultDeviceGroupsNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param nextLink The nextLink from the previous successful call to the GenerateDefaultDeviceGroups + * method. + * @param options The options parameters. + */ + private _generateDefaultDeviceGroupsNext( + resourceGroupName: string, + catalogName: string, + productName: string, + nextLink: string, + options?: ProductsGenerateDefaultDeviceGroupsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, catalogName, productName, nextLink, options }, + generateDefaultDeviceGroupsNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByCatalogOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ProductListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Product + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Product + }, + 201: { + bodyMapper: Mappers.Product + }, + 202: { + bodyMapper: Mappers.Product + }, + 204: { + bodyMapper: Mappers.Product + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Product + }, + 201: { + bodyMapper: Mappers.Product + }, + 202: { + bodyMapper: Mappers.Product + }, + 204: { + bodyMapper: Mappers.Product + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.properties1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept], + serializer +}; +const countDevicesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CountDeviceResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept], + serializer +}; +const generateDefaultDeviceGroupsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroupListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByCatalogNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ProductListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName + ], + headerParameters: [Parameters.accept], + serializer +}; +const generateDefaultDeviceGroupsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeviceGroupListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.catalogName, + Parameters.productName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/catalogs.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/catalogs.ts new file mode 100644 index 000000000000..c0cf684db7c4 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/catalogs.ts @@ -0,0 +1,189 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + Catalog, + CatalogsListBySubscriptionOptionalParams, + CatalogsListByResourceGroupOptionalParams, + Deployment, + CatalogsListDeploymentsOptionalParams, + DeviceGroup, + ListDeviceGroupsRequest, + CatalogsListDeviceGroupsOptionalParams, + DeviceInsight, + CatalogsListDeviceInsightsOptionalParams, + Device, + CatalogsListDevicesOptionalParams, + CatalogsGetOptionalParams, + CatalogsGetResponse, + CatalogsCreateOrUpdateOptionalParams, + CatalogsCreateOrUpdateResponse, + CatalogUpdate, + CatalogsUpdateOptionalParams, + CatalogsUpdateResponse, + CatalogsDeleteOptionalParams, + CatalogsCountDevicesOptionalParams, + CatalogsCountDevicesResponse +} from "../models"; + +/// +/** Interface representing a Catalogs. */ +export interface Catalogs { + /** + * List Catalog resources by subscription ID + * @param options The options parameters. + */ + listBySubscription( + options?: CatalogsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * List Catalog resources by resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: CatalogsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists deployments for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + listDeployments( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeploymentsOptionalParams + ): PagedAsyncIterableIterator; + /** + * List the device groups for the catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param listDeviceGroupsRequest List device groups for catalog. + * @param options The options parameters. + */ + listDeviceGroups( + resourceGroupName: string, + catalogName: string, + listDeviceGroupsRequest: ListDeviceGroupsRequest, + options?: CatalogsListDeviceGroupsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists device insights for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + listDeviceInsights( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDeviceInsightsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists devices for catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + listDevices( + resourceGroupName: string, + catalogName: string, + options?: CatalogsListDevicesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + options?: CatalogsGetOptionalParams + ): Promise; + /** + * Create a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + resource: Catalog, + options?: CatalogsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + CatalogsCreateOrUpdateResponse + > + >; + /** + * Create a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + resource: Catalog, + options?: CatalogsCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + catalogName: string, + properties: CatalogUpdate, + options?: CatalogsUpdateOptionalParams + ): Promise; + /** + * Delete a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + catalogName: string, + options?: CatalogsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + options?: CatalogsDeleteOptionalParams + ): Promise; + /** + * Counts devices in catalog. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + countDevices( + resourceGroupName: string, + catalogName: string, + options?: CatalogsCountDevicesOptionalParams + ): Promise; +} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/certificates.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/certificates.ts new file mode 100644 index 000000000000..4748eb822288 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/certificates.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { + Certificate, + CertificatesListByCatalogOptionalParams, + CertificatesGetOptionalParams, + CertificatesGetResponse, + CertificatesRetrieveCertChainOptionalParams, + CertificatesRetrieveCertChainResponse, + ProofOfPossessionNonceRequest, + CertificatesRetrieveProofOfPossessionNonceOptionalParams, + CertificatesRetrieveProofOfPossessionNonceResponse +} from "../models"; + +/// +/** Interface representing a Certificates. */ +export interface Certificates { + /** + * List Certificate resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: CertificatesListByCatalogOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a Certificate + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param serialNumber Serial number of the certificate. Use '.default' to get current active + * certificate. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options?: CertificatesGetOptionalParams + ): Promise; + /** + * Retrieves cert chain. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param serialNumber Serial number of the certificate. Use '.default' to get current active + * certificate. + * @param options The options parameters. + */ + retrieveCertChain( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + options?: CertificatesRetrieveCertChainOptionalParams + ): Promise; + /** + * Gets the proof of possession nonce. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param serialNumber Serial number of the certificate. Use '.default' to get current active + * certificate. + * @param proofOfPossessionNonceRequest Proof of possession nonce request body + * @param options The options parameters. + */ + retrieveProofOfPossessionNonce( + resourceGroupName: string, + catalogName: string, + serialNumber: string, + proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, + options?: CertificatesRetrieveProofOfPossessionNonceOptionalParams + ): Promise; +} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/deployments.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/deployments.ts new file mode 100644 index 000000000000..1ada65c2b3ed --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/deployments.ts @@ -0,0 +1,144 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + Deployment, + DeploymentsListByDeviceGroupOptionalParams, + DeploymentsGetOptionalParams, + DeploymentsGetResponse, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsCreateOrUpdateResponse, + DeploymentsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a Deployments. */ +export interface Deployments { + /** + * List Deployment resources by DeviceGroup. '.default' and '.unassigned' are system defined values and + * cannot be used for product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + listByDeviceGroup( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeploymentsListByDeviceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsGetOptionalParams + ): Promise; + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + resource: Deployment, + options?: DeploymentsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeploymentsCreateOrUpdateResponse + > + >; + /** + * Create a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + resource: Deployment, + options?: DeploymentsCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a Deployment. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deploymentName Deployment name. Use .default for deployment creation and to get the current + * deployment for the associated device group. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deploymentName: string, + options?: DeploymentsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/deviceGroups.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/deviceGroups.ts new file mode 100644 index 000000000000..48e55661a6d5 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/deviceGroups.ts @@ -0,0 +1,233 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + DeviceGroup, + DeviceGroupsListByProductOptionalParams, + DeviceGroupsGetOptionalParams, + DeviceGroupsGetResponse, + DeviceGroupsCreateOrUpdateOptionalParams, + DeviceGroupsCreateOrUpdateResponse, + DeviceGroupUpdate, + DeviceGroupsUpdateOptionalParams, + DeviceGroupsUpdateResponse, + DeviceGroupsDeleteOptionalParams, + ClaimDevicesRequest, + DeviceGroupsClaimDevicesOptionalParams, + DeviceGroupsClaimDevicesResponse, + DeviceGroupsCountDevicesOptionalParams, + DeviceGroupsCountDevicesResponse +} from "../models"; + +/// +/** Interface representing a DeviceGroups. */ +export interface DeviceGroups { + /** + * List DeviceGroup resources by Product. '.default' and '.unassigned' are system defined values and + * cannot be used for product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + listByProduct( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: DeviceGroupsListByProductOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsGetOptionalParams + ): Promise; + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + resource: DeviceGroup, + options?: DeviceGroupsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeviceGroupsCreateOrUpdateResponse + > + >; + /** + * Create a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + resource: DeviceGroup, + options?: DeviceGroupsCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + properties: DeviceGroupUpdate, + options?: DeviceGroupsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeviceGroupsUpdateResponse + > + >; + /** + * Update a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + properties: DeviceGroupUpdate, + options?: DeviceGroupsUpdateOptionalParams + ): Promise; + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a DeviceGroup. '.default' and '.unassigned' are system defined values and cannot be used for + * product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsDeleteOptionalParams + ): Promise; + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when + * bulk claiming devices to a catalog only. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @param options The options parameters. + */ + beginClaimDevices( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + claimDevicesRequest: ClaimDevicesRequest, + options?: DeviceGroupsClaimDevicesOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DeviceGroupsClaimDevicesResponse + > + >; + /** + * Bulk claims the devices. Use '.unassigned' or '.default' for the device group and product names when + * bulk claiming devices to a catalog only. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param claimDevicesRequest Bulk claim devices request body. + * @param options The options parameters. + */ + beginClaimDevicesAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + claimDevicesRequest: ClaimDevicesRequest, + options?: DeviceGroupsClaimDevicesOptionalParams + ): Promise; + /** + * Counts devices in device group. '.default' and '.unassigned' are system defined values and cannot be + * used for product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + countDevices( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DeviceGroupsCountDevicesOptionalParams + ): Promise; +} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/devices.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/devices.ts new file mode 100644 index 000000000000..2c99efef98ac --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/devices.ts @@ -0,0 +1,235 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + Device, + DevicesListByDeviceGroupOptionalParams, + DevicesGetOptionalParams, + DevicesGetResponse, + DevicesCreateOrUpdateOptionalParams, + DevicesCreateOrUpdateResponse, + DeviceUpdate, + DevicesUpdateOptionalParams, + DevicesUpdateResponse, + DevicesDeleteOptionalParams, + GenerateCapabilityImageRequest, + DevicesGenerateCapabilityImageOptionalParams, + DevicesGenerateCapabilityImageResponse +} from "../models"; + +/// +/** Interface representing a Devices. */ +export interface Devices { + /** + * List Device resources by DeviceGroup. '.default' and '.unassigned' are system defined values and + * cannot be used for product or device group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param options The options parameters. + */ + listByDeviceGroup( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + options?: DevicesListByDeviceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a Device. Use '.unassigned' or '.default' for the device group and product names when a device + * does not belong to a device group and product. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesGetOptionalParams + ): Promise; + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a + * device to the catalog only. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + resource: Device, + options?: DevicesCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DevicesCreateOrUpdateResponse + > + >; + /** + * Create a Device. Use '.unassigned' or '.default' for the device group and product names to claim a + * device to the catalog only. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + resource: Device, + options?: DevicesCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a + * device to the catalog level. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + properties: DeviceUpdate, + options?: DevicesUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DevicesUpdateResponse + > + >; + /** + * Update a Device. Use '.unassigned' or '.default' for the device group and product names to move a + * device to the catalog level. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + properties: DeviceUpdate, + options?: DevicesUpdateOptionalParams + ): Promise; + /** + * Delete a Device + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a Device + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + options?: DevicesDeleteOptionalParams + ): Promise; + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group + * and product names to generate the image for a device that does not belong to a specific device group + * and product. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @param options The options parameters. + */ + beginGenerateCapabilityImage( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, + options?: DevicesGenerateCapabilityImageOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + DevicesGenerateCapabilityImageResponse + > + >; + /** + * Generates the capability image for the device. Use '.unassigned' or '.default' for the device group + * and product names to generate the image for a device that does not belong to a specific device group + * and product. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param deviceGroupName Name of device group. + * @param deviceName Device name + * @param generateDeviceCapabilityRequest Generate capability image request body. + * @param options The options parameters. + */ + beginGenerateCapabilityImageAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + deviceGroupName: string, + deviceName: string, + generateDeviceCapabilityRequest: GenerateCapabilityImageRequest, + options?: DevicesGenerateCapabilityImageOptionalParams + ): Promise; +} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/images.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/images.ts new file mode 100644 index 000000000000..d97d072be78b --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/images.ts @@ -0,0 +1,109 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + Image, + ImagesListByCatalogOptionalParams, + ImagesGetOptionalParams, + ImagesGetResponse, + ImagesCreateOrUpdateOptionalParams, + ImagesCreateOrUpdateResponse, + ImagesDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a Images. */ +export interface Images { + /** + * List Image resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: ImagesListByCatalogOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesGetOptionalParams + ): Promise; + /** + * Create a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + imageName: string, + resource: Image, + options?: ImagesCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ImagesCreateOrUpdateResponse + > + >; + /** + * Create a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + imageName: string, + resource: Image, + options?: ImagesCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a Image + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param imageName Image name. Use .default for image creation. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + imageName: string, + options?: ImagesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/index.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..eaa8abdeac3f --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/index.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./catalogs"; +export * from "./certificates"; +export * from "./images"; +export * from "./products"; +export * from "./deviceGroups"; +export * from "./deployments"; +export * from "./devices"; diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/operations.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..5cf5581845bd --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List the operations for the provider + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/sphere/arm-sphere/src/operationsInterfaces/products.ts b/sdk/sphere/arm-sphere/src/operationsInterfaces/products.ts new file mode 100644 index 000000000000..28e4b80a63e4 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/operationsInterfaces/products.ts @@ -0,0 +1,186 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + Product, + ProductsListByCatalogOptionalParams, + DeviceGroup, + ProductsGenerateDefaultDeviceGroupsOptionalParams, + ProductsGetOptionalParams, + ProductsGetResponse, + ProductsCreateOrUpdateOptionalParams, + ProductsCreateOrUpdateResponse, + ProductUpdate, + ProductsUpdateOptionalParams, + ProductsUpdateResponse, + ProductsDeleteOptionalParams, + ProductsCountDevicesOptionalParams, + ProductsCountDevicesResponse +} from "../models"; + +/// +/** Interface representing a Products. */ +export interface Products { + /** + * List Product resources by Catalog + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param options The options parameters. + */ + listByCatalog( + resourceGroupName: string, + catalogName: string, + options?: ProductsListByCatalogOptionalParams + ): PagedAsyncIterableIterator; + /** + * Generates default device groups for the product. '.default' and '.unassigned' are system defined + * values and cannot be used for product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + listGenerateDefaultDeviceGroups( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGenerateDefaultDeviceGroupsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a Product. '.default' and '.unassigned' are system defined values and cannot be used for product + * name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsGetOptionalParams + ): Promise; + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + resource: Product, + options?: ProductsCreateOrUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ProductsCreateOrUpdateResponse + > + >; + /** + * Create a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + resource: Product, + options?: ProductsCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + catalogName: string, + productName: string, + properties: ProductUpdate, + options?: ProductsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + ProductsUpdateResponse + > + >; + /** + * Update a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + properties: ProductUpdate, + options?: ProductsUpdateOptionalParams + ): Promise; + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name' + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a Product. '.default' and '.unassigned' are system defined values and cannot be used for + * product name' + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsDeleteOptionalParams + ): Promise; + /** + * Counts devices in product. '.default' and '.unassigned' are system defined values and cannot be used + * for product name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param catalogName Name of catalog + * @param productName Name of product. + * @param options The options parameters. + */ + countDevices( + resourceGroupName: string, + catalogName: string, + productName: string, + options?: ProductsCountDevicesOptionalParams + ): Promise; +} diff --git a/sdk/sphere/arm-sphere/src/pagingHelper.ts b/sdk/sphere/arm-sphere/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/sphere/arm-sphere/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/sphere/arm-sphere/test/sampleTest.ts b/sdk/sphere/arm-sphere/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/sphere/arm-sphere/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/sphere/arm-sphere/tsconfig.json b/sdk/sphere/arm-sphere/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/sphere/arm-sphere/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/sphere/ci.mgmt.yml b/sdk/sphere/ci.mgmt.yml new file mode 100644 index 000000000000..4a7656a65ea6 --- /dev/null +++ b/sdk/sphere/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/sphere/arm-sphere + - sdk/sphere/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/sphere/arm-sphere + - sdk/sphere/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: sphere + Artifacts: + - name: azure-arm-sphere + safeName: azurearmsphere + \ No newline at end of file