diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 8392806d2248..e6e5f57acd5a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -10,6 +10,7 @@ dependencies: '@rush-temp/arm-features': file:projects/arm-features.tgz '@rush-temp/arm-links': file:projects/arm-links.tgz '@rush-temp/arm-locks': file:projects/arm-locks.tgz + '@rush-temp/arm-managedapplications': file:projects/arm-managedapplications.tgz '@rush-temp/arm-policy': file:projects/arm-policy.tgz '@rush-temp/arm-resources': file:projects/arm-resources.tgz '@rush-temp/attestation': file:projects/attestation.tgz @@ -8551,6 +8552,26 @@ packages: integrity: sha512-Pbwm7icKOAqRDLs7DB00ERbjwjtOHOCWtyxLuzSvnu14uHgTS7Hdc25em9Zj2kIIn9Fqq2EGPytZkfq4BA2Ayg== tarball: file:projects/arm-locks.tgz version: 0.0.0 + file:projects/arm-managedapplications.tgz: + dependencies: + '@microsoft/api-extractor': 7.7.11 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + mkdirp: 1.0.4 + rollup: 1.32.1 + rollup-plugin-node-resolve: 3.4.0 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.0 + typescript: 4.2.4 + uglify-js: 3.13.10 + dev: false + name: '@rush-temp/arm-managedapplications' + resolution: + integrity: sha512-6g75qP/hVQl60mMmjJ9ZD/ZP8LjGQ73IGGLN8RaI8mOux0T7eor4PLvNtyf7H9s6hSVTjxbAb/JeBEPHY7TEBw== + tarball: file:projects/arm-managedapplications.tgz + version: 0.0.0 file:projects/arm-policy.tgz: dependencies: '@microsoft/api-extractor': 7.7.11 @@ -12152,6 +12173,7 @@ specifiers: '@rush-temp/arm-features': file:./projects/arm-features.tgz '@rush-temp/arm-links': file:./projects/arm-links.tgz '@rush-temp/arm-locks': file:./projects/arm-locks.tgz + '@rush-temp/arm-managedapplications': file:./projects/arm-managedapplications.tgz '@rush-temp/arm-policy': file:./projects/arm-policy.tgz '@rush-temp/arm-resources': file:./projects/arm-resources.tgz '@rush-temp/attestation': file:./projects/attestation.tgz diff --git a/rush.json b/rush.json index 1c5053707a22..08d3f1661997 100644 --- a/rush.json +++ b/rush.json @@ -818,6 +818,11 @@ "packageName": "@azure/arm-features", "projectFolder": "sdk/features/arm-features", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-managedapplications", + "projectFolder": "sdk/managedapplications/arm-managedapplications", + "versionPolicyName": "management" } ] } diff --git a/sdk/managedapplications/arm-managedapplications/CHANGELOG.md b/sdk/managedapplications/arm-managedapplications/CHANGELOG.md new file mode 100644 index 000000000000..f5d77aebf8a6 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/CHANGELOG.md @@ -0,0 +1,14 @@ +## 30.0.0-beta.1 (2021-07-15) + +This is the first preview for the new version of the `@azure/arm-managedapplications` package that follows the new [guidelines for TypeScript SDKs](https://azure.github.io/azure-sdk/typescript_introduction.html) for Azure services. + +While this package remains auto generated, the SDK generator itself has undergone changes to comply with the above guidelines in order to generate packages that are idiomatic to the JavaScript/TypeScript ecosystem and consistent with other packages for Azure services. For more on this, please see [State of the Azure SDK 2021](https://devblogs.microsoft.com/azure-sdk/state-of-the-azure-sdk-2021/). + +Please note that this version has breaking changes, all of which were made after careful consideration during the authoring of the guidelines and user studies. + +**Noteworthy changes and features** +- Authentication: The packages `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` are no longer supported. Use package [@azure/identity](https://www.npmjs.com/package/@azure/identity) instead. Select a credential from Azure Identity examples based on the authentication method of your choice. +- Callbacks: Method overloads that used callbacks have been removed and the use of promises is encouraged instead. +- List operations now return an iterable result that follows the `PagedAsyncIterableIterator` interface as opposed to the previous model where you had to make a new request using the link to the next page. +- Long running operations i.e. the methods whose names started with `begin` now return a poller object that gives you a better control over the operation. To get the final result like before use the corresponding method that will have the suffix `AndWait`. +- The SDK only supports ECMAScript 2015 (ES6) and beyond, all projects that referenced this SDK should be upgraded to use ES6. diff --git a/sdk/managedapplications/arm-managedapplications/LICENSE.txt b/sdk/managedapplications/arm-managedapplications/LICENSE similarity index 96% rename from sdk/managedapplications/arm-managedapplications/LICENSE.txt rename to sdk/managedapplications/arm-managedapplications/LICENSE index b73b4a1293c3..ccb63b166732 100644 --- a/sdk/managedapplications/arm-managedapplications/LICENSE.txt +++ b/sdk/managedapplications/arm-managedapplications/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 Microsoft +Copyright (c) 2021 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 @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +SOFTWARE. \ No newline at end of file diff --git a/sdk/managedapplications/arm-managedapplications/README.md b/sdk/managedapplications/arm-managedapplications/README.md index 9b9e2851fe5e..14a8711a52f3 100644 --- a/sdk/managedapplications/arm-managedapplications/README.md +++ b/sdk/managedapplications/arm-managedapplications/README.md @@ -1,98 +1,91 @@ -## Azure ManagedApplicationClient SDK for JavaScript +# Azure Application client library for JavaScript -This package contains an isomorphic SDK for ManagedApplicationClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Application client. + +ARM applications + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/managedapplications/arm-managedapplications) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-managedapplications) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-managedapplications) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments -- Node.js version 6.x.x or higher -- Browser JavaScript +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. -### How to Install +### Install the `@azure/arm-managedapplications` package + +Install the Azure Application client library for JavaScript with `npm`: ```bash npm install @azure/arm-managedapplications ``` -### How to use +### Create and authenticate a `ApplicationClient` + +To create a client object to access the Azure Application API, you will need the `endpoint` of your Azure Application resource and a `credential`. The Azure Application client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Application resource in the [Azure Portal][azure_portal]. -#### nodejs - Authentication, client creation and listOperations as an example written in TypeScript. +#### Using an Azure Active Directory Credential -##### Install @azure/ms-rest-nodeauth +You can authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. 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/ms-rest-nodeauth +npm install @azure/identity ``` -##### Sample code - -```typescript -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { ManagedApplicationClient, ManagedApplicationModels, ManagedApplicationMappers } from "@azure/arm-managedapplications"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new ManagedApplicationClient(creds, subscriptionId); - client.listOperations().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +You will also need to register a new AAD application and grant access to Azure Application 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`. + +```javascript +const { ApplicationClient } = require("@azure/arm-managedapplications"); +const { DefaultAzureCredential } = require("@azure/identity"); +const client = new ApplicationClient("", new DefaultAzureCredential()); ``` -#### browser - Authentication, client creation and listOperations as an example written in JavaScript. +## Key concepts -##### Install @azure/ms-rest-browserauth +### ApplicationClient -```bash -npm install @azure/ms-rest-browserauth -``` +`ApplicationClient` is the primary interface for developers using the Azure Application client library. Explore the methods on this client object to understand the different features of the Azure Application service that you can access. -##### Sample code - -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. - -- index.html -```html - - - - @azure/arm-managedapplications sample - - - - - - - - +## 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 +import { setLogLevel } from "@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/master/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/master/CONTRIBUTING.md) to learn more about how to build and test the code. + ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fmanagedapplications%2Farm-managedapplications%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/master/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/identity/identity#defaultazurecredential diff --git a/sdk/managedapplications/arm-managedapplications/_meta.json b/sdk/managedapplications/arm-managedapplications/_meta.json new file mode 100644 index 000000000000..2a37388e4c35 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "406474c3807f2dec010af72286f22aa7a9a54920", + "readme": "specification/resources/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --typescript-sdks-folder=/Users/zhangqiaoqiao/work/code/azure-sdk-for-js ../azure-rest-api-specs/specification/resources/resource-manager/readme.md --use=@autorest/typescript@6.0.0-beta.7", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-beta.7" +} \ No newline at end of file diff --git a/sdk/managedapplications/arm-managedapplications/api-extractor.json b/sdk/managedapplications/arm-managedapplications/api-extractor.json new file mode 100644 index 000000000000..5fb5b21b56f2 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./esm/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./esm/index.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/managedapplications/arm-managedapplications/package.json b/sdk/managedapplications/arm-managedapplications/package.json index 79861c572083..b619a09291d0 100644 --- a/sdk/managedapplications/arm-managedapplications/package.json +++ b/sdk/managedapplications/arm-managedapplications/package.json @@ -1,12 +1,20 @@ { "name": "@azure/arm-managedapplications", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "ManagedApplicationClient Library with typescript type definitions for node.js and browser.", - "version": "1.0.2", + "description": "A generated SDK for ApplicationClient.", + "version": "30.0.0-beta.1", + "engines": { + "node": ">=12.0.0" + }, "dependencies": { - "@azure/ms-rest-azure-js": "^1.3.2", - "@azure/ms-rest-js": "^1.8.1", - "tslib": "^1.9.3" + "@azure/core-lro": "^2.0.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.1.1", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, "keywords": [ "node", @@ -16,14 +24,20 @@ "isomorphic" ], "license": "MIT", - "main": "./dist/arm-managedapplications.js", - "module": "./esm/managedApplicationClient.js", - "types": "./esm/managedApplicationClient.d.ts", + "main": "./dist/index.js", + "module": "./esm/index.js", + "types": "./esm/index.d.ts", "devDependencies": { - "typescript": "^3.1.1", - "rollup": "^0.66.2", - "rollup-plugin-node-resolve": "^3.4.0", + "@microsoft/api-extractor": "7.7.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-node-resolve": "^3.4.0", + "typescript": "~4.2.0", "uglify-js": "^3.4.9" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/managedapplications/arm-managedapplications", @@ -45,14 +59,40 @@ "esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-managedapplications.js.map'\" -o ./dist/arm-managedapplications.min.js ./dist/arm-managedapplications.js", - "prepack": "npm install && npm run build" + "build": "tsc && rollup -c rollup.config.js && 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": "mkdirp ./review && api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "echo skipped", + "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": "echo skipped", + "prebuild": "echo skipped", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "echo skipped", + "unit-test:node": "echo skipped", + "unit-test:browser": "echo skipped", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "integration-test": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, "autoPublish": true -} +} \ No newline at end of file diff --git a/sdk/managedapplications/arm-managedapplications/review/arm-managedapplications.api.md b/sdk/managedapplications/arm-managedapplications/review/arm-managedapplications.api.md new file mode 100644 index 000000000000..fe411286aea9 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/review/arm-managedapplications.api.md @@ -0,0 +1,443 @@ +## API Report File for "@azure/arm-managedapplications" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export type Application = GenericResource & { + plan?: Plan; + kind: string; + managedResourceGroupId: string; + applicationDefinitionId?: string; + parameters?: Record; + readonly outputs?: Record; + readonly provisioningState?: ProvisioningState; +}; + +// @public +export interface ApplicationArtifact { + name?: string; + type?: ApplicationArtifactType; + uri?: string; +} + +// @public +export type ApplicationArtifactType = "Template" | "Custom"; + +// @public (undocumented) +export class ApplicationClient extends ApplicationClientContext { + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ApplicationClientOptionalParams); + // (undocumented) + applicationDefinitions: ApplicationDefinitions; + // (undocumented) + applications: Applications; + listOperations(options?: ApplicationClientListOperationsOptionalParams): PagedAsyncIterableIterator; + listOperationsNext(nextLink: string, options?: ApplicationClientListOperationsNextOptionalParams): PagedAsyncIterableIterator; + } + +// @public (undocumented) +export class ApplicationClientContext extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ApplicationClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface ApplicationClientListOperationsNextNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationClientListOperationsNextNextResponse = OperationListResult; + +// @public +export interface ApplicationClientListOperationsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationClientListOperationsNextResponse = OperationListResult; + +// @public +export interface ApplicationClientListOperationsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationClientListOperationsResponse = OperationListResult; + +// @public +export interface ApplicationClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type ApplicationDefinition = GenericResource & { + lockLevel: ApplicationLockLevel; + displayName?: string; + isEnabled?: string; + authorizations: ApplicationProviderAuthorization[]; + artifacts?: ApplicationArtifact[]; + description?: string; + packageFileUri?: string; + mainTemplate?: Record; + createUiDefinition?: Record; +}; + +// @public +export interface ApplicationDefinitionListResult { + nextLink?: string; + value?: ApplicationDefinition[]; +} + +// @public +export interface ApplicationDefinitions { + beginCreateOrUpdate(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateOptionalParams): Promise, ApplicationDefinitionsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateOptionalParams): Promise; + beginCreateOrUpdateById(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams): Promise, ApplicationDefinitionsCreateOrUpdateByIdResponse>>; + beginCreateOrUpdateByIdAndWait(resourceGroupName: string, applicationDefinitionName: string, parameters: ApplicationDefinition, options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams): Promise; + beginDelete(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteOptionalParams): Promise; + beginDeleteById(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteByIdOptionalParams): Promise, void>>; + beginDeleteByIdAndWait(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsDeleteByIdOptionalParams): Promise; + get(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsGetOptionalParams): Promise; + getById(resourceGroupName: string, applicationDefinitionName: string, options?: ApplicationDefinitionsGetByIdOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: ApplicationDefinitionsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listByResourceGroupNext(resourceGroupName: string, nextLink: string, options?: ApplicationDefinitionsListByResourceGroupNextOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ApplicationDefinitionsCreateOrUpdateByIdOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ApplicationDefinitionsCreateOrUpdateByIdResponse = ApplicationDefinition; + +// @public +export interface ApplicationDefinitionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ApplicationDefinitionsCreateOrUpdateResponse = ApplicationDefinition; + +// @public +export interface ApplicationDefinitionsDeleteByIdOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ApplicationDefinitionsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ApplicationDefinitionsGetByIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationDefinitionsGetByIdResponse = ApplicationDefinition; + +// @public +export interface ApplicationDefinitionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationDefinitionsGetResponse = ApplicationDefinition; + +// @public +export interface ApplicationDefinitionsListByResourceGroupNextNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationDefinitionsListByResourceGroupNextNextResponse = ApplicationDefinitionListResult; + +// @public +export interface ApplicationDefinitionsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationDefinitionsListByResourceGroupNextResponse = ApplicationDefinitionListResult; + +// @public +export interface ApplicationDefinitionsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationDefinitionsListByResourceGroupResponse = ApplicationDefinitionListResult; + +// @public +export interface ApplicationListResult { + nextLink?: string; + value?: Application[]; +} + +// @public +export type ApplicationLockLevel = "CanNotDelete" | "ReadOnly" | "None"; + +// @public +export type ApplicationPatchable = GenericResource & { + plan?: PlanPatchable; + kind?: string; + managedResourceGroupId?: string; + applicationDefinitionId?: string; + parameters?: Record; + readonly outputs?: Record; + readonly provisioningState?: ProvisioningState; +}; + +// @public +export interface ApplicationProviderAuthorization { + principalId: string; + roleDefinitionId: string; +} + +// @public +export interface Applications { + beginCreateOrUpdate(resourceGroupName: string, applicationName: string, parameters: Application, options?: ApplicationsCreateOrUpdateOptionalParams): Promise, ApplicationsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, applicationName: string, parameters: Application, options?: ApplicationsCreateOrUpdateOptionalParams): Promise; + beginCreateOrUpdateById(applicationId: string, parameters: Application, options?: ApplicationsCreateOrUpdateByIdOptionalParams): Promise, ApplicationsCreateOrUpdateByIdResponse>>; + beginCreateOrUpdateByIdAndWait(applicationId: string, parameters: Application, options?: ApplicationsCreateOrUpdateByIdOptionalParams): Promise; + beginDelete(resourceGroupName: string, applicationName: string, options?: ApplicationsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, applicationName: string, options?: ApplicationsDeleteOptionalParams): Promise; + beginDeleteById(applicationId: string, options?: ApplicationsDeleteByIdOptionalParams): Promise, void>>; + beginDeleteByIdAndWait(applicationId: string, options?: ApplicationsDeleteByIdOptionalParams): Promise; + get(resourceGroupName: string, applicationName: string, options?: ApplicationsGetOptionalParams): Promise; + getById(applicationId: string, options?: ApplicationsGetByIdOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: ApplicationsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listByResourceGroupNext(resourceGroupName: string, nextLink: string, options?: ApplicationsListByResourceGroupNextOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: ApplicationsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + listBySubscriptionNext(nextLink: string, options?: ApplicationsListBySubscriptionNextOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, applicationName: string, options?: ApplicationsUpdateOptionalParams): Promise; + updateById(applicationId: string, options?: ApplicationsUpdateByIdOptionalParams): Promise; +} + +// @public +export interface ApplicationsCreateOrUpdateByIdOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ApplicationsCreateOrUpdateByIdResponse = Application; + +// @public +export interface ApplicationsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ApplicationsCreateOrUpdateResponse = Application; + +// @public +export interface ApplicationsDeleteByIdOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ApplicationsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ApplicationsGetByIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationsGetByIdResponse = Application; + +// @public +export interface ApplicationsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationsGetResponse = Application; + +// @public +export interface ApplicationsListByResourceGroupNextNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationsListByResourceGroupNextNextResponse = ApplicationListResult; + +// @public +export interface ApplicationsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationsListByResourceGroupNextResponse = ApplicationListResult; + +// @public +export interface ApplicationsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationsListByResourceGroupResponse = ApplicationListResult; + +// @public +export interface ApplicationsListBySubscriptionNextNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationsListBySubscriptionNextNextResponse = ApplicationListResult; + +// @public +export interface ApplicationsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationsListBySubscriptionNextResponse = ApplicationListResult; + +// @public +export interface ApplicationsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApplicationsListBySubscriptionResponse = ApplicationListResult; + +// @public +export interface ApplicationsUpdateByIdOptionalParams extends coreClient.OperationOptions { + parameters?: Application; +} + +// @public +export type ApplicationsUpdateByIdResponse = Application; + +// @public +export interface ApplicationsUpdateOptionalParams extends coreClient.OperationOptions { + parameters?: ApplicationPatchable; +} + +// @public +export type ApplicationsUpdateResponse = Application; + +// @public +export interface ErrorResponse { + errorCode?: string; + errorMessage?: string; + httpStatus?: string; +} + +// @public +export type GenericResource = Resource & { + managedBy?: string; + sku?: Sku; + identity?: Identity; +}; + +// @public +export interface Identity { + readonly principalId?: string; + readonly tenantId?: string; + type?: "SystemAssigned"; +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Accepted = "Accepted", + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Created = "Created", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Ready = "Ready", + // (undocumented) + Running = "Running", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export interface Operation { + display?: OperationDisplay; + name?: string; +} + +// @public +export interface OperationDisplay { + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationListResult { + nextLink?: string; + value?: Operation[]; +} + +// @public +export interface Plan { + name: string; + product: string; + promotionCode?: string; + publisher: string; + version: string; +} + +// @public +export interface PlanPatchable { + name?: string; + product?: string; + promotionCode?: string; + publisher?: string; + version?: string; +} + +// @public +export type ProvisioningState = string; + +// @public +export interface Resource { + readonly id?: string; + location?: string; + readonly name?: string; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + +// @public +export interface Sku { + capacity?: number; + family?: string; + model?: string; + name: string; + size?: string; + tier?: string; +} + + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/managedapplications/arm-managedapplications/rollup.config.js b/sdk/managedapplications/arm-managedapplications/rollup.config.js index 24a2779acf2e..9be1955eb7f1 100644 --- a/sdk/managedapplications/arm-managedapplications/rollup.config.js +++ b/sdk/managedapplications/arm-managedapplications/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler /** - * @type {rollup.RollupFileOptions} + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. */ -const config = { - input: "./esm/managedApplicationClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-managedapplications.js", - format: "umd", - name: "Azure.ArmManagedapplications", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] }, - banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ module: true }), - sourcemaps() - ] + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false }; -export default config; +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/managedapplications/arm-managedapplications/src/applicationClient.ts b/sdk/managedapplications/arm-managedapplications/src/applicationClient.ts new file mode 100644 index 000000000000..3fceffa85d8a --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/applicationClient.ts @@ -0,0 +1,222 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 coreAuth from "@azure/core-auth"; +import "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ApplicationsImpl, ApplicationDefinitionsImpl } from "./operations"; +import { Applications, ApplicationDefinitions } from "./operationsInterfaces"; +import * as Parameters from "./models/parameters"; +import * as Mappers from "./models/mappers"; +import { ApplicationClientContext } from "./applicationClientContext"; +import { + ApplicationClientOptionalParams, + Operation, + ApplicationClientListOperationsNextOptionalParams, + ApplicationClientListOperationsOptionalParams, + ApplicationClientListOperationsNextNextOptionalParams, + ApplicationClientListOperationsResponse, + ApplicationClientListOperationsNextResponse, + ApplicationClientListOperationsNextNextResponse +} from "./models"; + +/// +export class ApplicationClient extends ApplicationClientContext { + /** + * Initializes a new instance of the ApplicationClient 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?: ApplicationClientOptionalParams + ) { + super(credentials, subscriptionId, options); + this.applications = new ApplicationsImpl(this); + this.applicationDefinitions = new ApplicationDefinitionsImpl(this); + } + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * @param options The options parameters. + */ + public listOperations( + options?: ApplicationClientListOperationsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listOperationsPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listOperationsPagingPage(options); + } + }; + } + + private async *listOperationsPagingPage( + options?: ApplicationClientListOperationsOptionalParams + ): AsyncIterableIterator { + let result = await this._listOperations(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listOperationsNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listOperationsPagingAll( + options?: ApplicationClientListOperationsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listOperationsPagingPage(options)) { + yield* page; + } + } + + /** + * ListOperationsNext + * @param nextLink The nextLink from the previous successful call to the ListOperations method. + * @param options The options parameters. + */ + public listOperationsNext( + nextLink: string, + options?: ApplicationClientListOperationsNextOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listOperationsNextPagingAll(nextLink, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listOperationsNextPagingPage(nextLink, options); + } + }; + } + + private async *listOperationsNextPagingPage( + nextLink: string, + options?: ApplicationClientListOperationsNextOptionalParams + ): AsyncIterableIterator { + let result = await this._listOperationsNext(nextLink, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listOperationsNextNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listOperationsNextPagingAll( + nextLink: string, + options?: ApplicationClientListOperationsNextOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listOperationsNextPagingPage( + nextLink, + options + )) { + yield* page; + } + } + + /** + * Lists all of the available Microsoft.Solutions REST API operations. + * @param options The options parameters. + */ + private _listOperations( + options?: ApplicationClientListOperationsOptionalParams + ): Promise { + return this.sendOperationRequest({ options }, listOperationsOperationSpec); + } + + /** + * ListOperationsNext + * @param nextLink The nextLink from the previous successful call to the ListOperations method. + * @param options The options parameters. + */ + private _listOperationsNext( + nextLink: string, + options?: ApplicationClientListOperationsNextOptionalParams + ): Promise { + return this.sendOperationRequest( + { nextLink, options }, + listOperationsNextOperationSpec + ); + } + + /** + * ListOperationsNextNext + * @param nextLink The nextLink from the previous successful call to the ListOperationsNext method. + * @param options The options parameters. + */ + private _listOperationsNextNext( + nextLink: string, + options?: ApplicationClientListOperationsNextNextOptionalParams + ): Promise { + return this.sendOperationRequest( + { nextLink, options }, + listOperationsNextNextOperationSpec + ); + } + + applications: Applications; + applicationDefinitions: ApplicationDefinitions; +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationsOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Solutions/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; +const listOperationsNextNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/managedapplications/arm-managedapplications/src/applicationClientContext.ts b/sdk/managedapplications/arm-managedapplications/src/applicationClientContext.ts new file mode 100644 index 000000000000..633869b07204 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/applicationClientContext.ts @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { ApplicationClientOptionalParams } from "./models"; + +export class ApplicationClientContext extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the ApplicationClientContext 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?: ApplicationClientOptionalParams + ) { + 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: ApplicationClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-managedapplications/30.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2018-06-01"; + } +} diff --git a/sdk/managedapplications/arm-managedapplications/src/coreClientLro.ts b/sdk/managedapplications/arm-managedapplications/src/coreClientLro.ts new file mode 100644 index 000000000000..d793a24458bc --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/coreClientLro.ts @@ -0,0 +1,323 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code 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 { + OperationArguments, + OperationSpec, + OperationResponseMap, + FullOperationResponse +} from "@azure/core-client"; +import { + LroResourceLocationConfig, + GetLroStatusFromResponse, + LongRunningOperation, + LroConfig, + LroMode, + LroResponse, + LroStatus, + createGetLroStatusFromResponse, + RawResponse +} from "./lro"; + +export const successStates = ["succeeded"]; +export const failureStates = ["failed", "canceled", "cancelled"]; +export const terminalStates = successStates.concat(failureStates); + +export type SendOperationFn = ( + args: OperationArguments, + spec: OperationSpec +) => Promise>; + +export function createPollingMethod( + sendOperationFn: SendOperationFn, + GetLroStatusFromResponse: GetLroStatusFromResponse, + args: OperationArguments, + spec: OperationSpec, + mode?: LroMode +): (path?: string) => Promise> { + /** + * Polling calls will always return a status object i.e. {"status": "success"} + * these intermediate responses are not described in the swagger so we need to + * pass custom mappers at runtime. + * This function replaces all the existing mappers to be able to deserialize a status object + * @param responses Original set of responses defined in the operation + */ + function getCompositeMappers(responses: { + [responseCode: string]: OperationResponseMap; + }): { + [responseCode: string]: OperationResponseMap; + } { + return Object.keys(responses).reduce((acc, statusCode) => { + return { + ...acc, + [statusCode]: { + ...responses[statusCode], + bodyMapper: { + type: { + name: "Composite", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } + } + } + }; + }, {} as { [responseCode: string]: OperationResponseMap }); + } + let response: LroStatus | undefined = undefined; + const customerCallback = args?.options?.onResponse; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: ( + rawResponse: FullOperationResponse, + flatResponse: unknown + ): void => { + response = GetLroStatusFromResponse( + { + statusCode: rawResponse.status, + body: rawResponse.parsedBody, + headers: rawResponse.headers.toJSON() + }, + flatResponse as TResult + ); + if (response.done) { + customerCallback?.(rawResponse, flatResponse); + } + } + } + }; + // Make sure we don't send any body to the get request + const { requestBody, responses, ...restSpec } = spec; + if (mode === "AzureAsync") { + return async (path?: string) => { + await sendOperationFn(updatedArgs, { + ...restSpec, + responses: getCompositeMappers(responses), + httpMethod: "GET", + ...(path && { path }) + }); + return response!; + }; + } + return async (path?: string) => { + await sendOperationFn(updatedArgs, { + ...restSpec, + responses: responses, + httpMethod: "GET", + ...(path && { path }) + }); + return response!; + }; +} + +/** + * We need to selectively deserialize our responses, only deserializing if we + * are in a final Lro response, not deserializing any polling non-terminal responses + */ +export function shouldDeserializeLro(lroResourceLocationConfig?: string) { + let initialOperationInfo: LroResponseInfo | undefined; + let isInitialRequest = true; + + return (response: FullOperationResponse) => { + if (response.status < 200 || response.status >= 300) { + return true; + } + + if (!initialOperationInfo) { + initialOperationInfo = getLroData(response); + } else { + isInitialRequest = false; + } + + if ( + initialOperationInfo.azureAsyncOperation || + initialOperationInfo.operationLocation + ) { + return ( + !isInitialRequest && + isAsyncOperationFinalResponse( + response, + initialOperationInfo, + lroResourceLocationConfig + ) + ); + } + + if (initialOperationInfo.location) { + return isLocationFinalResponse(response); + } + + if (initialOperationInfo.requestMethod === "PUT") { + return isBodyPollingFinalResponse(response); + } + + return true; + }; +} + +function isAsyncOperationFinalResponse( + response: FullOperationResponse, + initialOperationInfo: LroResponseInfo, + lroResourceLocationConfig?: string +): boolean { + const status: string = response.parsedBody?.status || "Succeeded"; + if (!terminalStates.includes(status.toLowerCase())) { + return false; + } + + if (initialOperationInfo.requestMethod === "DELETE") { + return true; + } + + if ( + initialOperationInfo.requestMethod === "PUT" && + lroResourceLocationConfig && + lroResourceLocationConfig.toLowerCase() === "azure-asyncoperation" + ) { + return true; + } + + if ( + initialOperationInfo.requestMethod !== "PUT" && + !initialOperationInfo.location + ) { + return true; + } + + return false; +} + +function isLocationFinalResponse(response: FullOperationResponse): boolean { + return response.status !== 202; +} + +function isBodyPollingFinalResponse(response: FullOperationResponse): boolean { + const provisioningState: string = + response.parsedBody?.properties?.provisioningState || "Succeeded"; + + if (terminalStates.includes(provisioningState.toLowerCase())) { + return true; + } + + return false; +} + +interface LroResponseInfo { + requestMethod: string; + azureAsyncOperation?: string; + operationLocation?: string; + location?: string; +} + +function getLroData(result: FullOperationResponse): LroResponseInfo { + return { + azureAsyncOperation: result.headers.get("azure-asyncoperation"), + operationLocation: result.headers.get("operation-location"), + location: result.headers.get("location"), + requestMethod: result.request.method + }; +} + +export function getSpecPath(spec: OperationSpec): string { + if (spec.path) { + return spec.path; + } else { + throw Error("Bad spec: request path is not found!"); + } +} + +export class CoreClientLro implements LongRunningOperation { + constructor( + private sendOperationFn: SendOperationFn, + private args: OperationArguments, + private spec: OperationSpec, + private lroResourceLocationConfig?: LroResourceLocationConfig, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest( + initializeState: ( + rawResponse: RawResponse, + flatResponse: unknown + ) => boolean + ): Promise> { + const { onResponse, ...restOptions } = this.args.options || {}; + return this.sendOperationFn( + { + ...this.args, + options: { + ...restOptions, + onResponse: ( + rawResponse: FullOperationResponse, + flatResponse: unknown + ) => { + const isCompleted = initializeState( + { + statusCode: rawResponse.status, + body: rawResponse.parsedBody, + headers: rawResponse.headers.toJSON() + }, + flatResponse + ); + if (isCompleted) { + onResponse?.(rawResponse, flatResponse); + } + } + } + }, + this.spec + ); + } + + public async sendPollRequest( + config: LroConfig, + path: string + ): Promise> { + const getLroStatusFromResponse = createGetLroStatusFromResponse( + this, + config, + this.lroResourceLocationConfig + ); + return createPollingMethod( + this.sendOperationFn, + getLroStatusFromResponse, + this.args, + this.spec, + config.mode + )(path); + } + + public async retrieveAzureAsyncResource( + path?: string + ): Promise> { + const updatedArgs = { ...this.args }; + if (updatedArgs.options) { + (updatedArgs.options as any).shouldDeserialize = true; + } + return createPollingMethod( + this.sendOperationFn, + (rawResponse, flatResponse) => ({ + rawResponse, + flatResponse, + done: true + }), + updatedArgs, + this.spec + )(path); + } +} diff --git a/sdk/managedapplications/arm-managedapplications/src/index.ts b/sdk/managedapplications/arm-managedapplications/src/index.ts new file mode 100644 index 000000000000..b31a3522c95e --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/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 * from "./models"; +export { ApplicationClient } from "./applicationClient"; +export { ApplicationClientContext } from "./applicationClientContext"; +export * from "./operationsInterfaces"; diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/azureAsyncPolling.ts b/sdk/managedapplications/arm-managedapplications/src/lro/azureAsyncPolling.ts new file mode 100644 index 000000000000..725578a69264 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/azureAsyncPolling.ts @@ -0,0 +1,96 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code 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 { + failureStates, + LroResourceLocationConfig, + LongRunningOperation, + LroBody, + LroResponse, + LroStatus, + RawResponse, + successStates +} from "./models"; +import { isUnexpectedPollingResponse } from "./requestUtils"; + +function getResponseStatus(rawResponse: RawResponse): string { + const { status } = (rawResponse.body as LroBody) ?? {}; + return status?.toLowerCase() ?? "succeeded"; +} + +function isAzureAsyncPollingDone(rawResponse: RawResponse): boolean { + const state = getResponseStatus(rawResponse); + if ( + isUnexpectedPollingResponse(rawResponse) || + failureStates.includes(state) + ) { + throw new Error(`Operation status: ${state}`); + } + return successStates.includes(state); +} + +async function sendFinalRequest( + lro: LongRunningOperation, + lroResourceLocationConfig?: LroResourceLocationConfig, + resourceLocation?: string +): Promise | undefined> { + switch (lroResourceLocationConfig) { + case "original-uri": + return lro.retrieveAzureAsyncResource(); + case "azure-async-operation": + return Promise.resolve(undefined); + case "location": + default: + return lro.retrieveAzureAsyncResource(resourceLocation); + } +} + +export function processAzureAsyncOperationResult( + lro: LongRunningOperation, + resourceLocation?: string, + lroResourceLocationConfig?: LroResourceLocationConfig +): (rawResponse: RawResponse, flatResponse: TResult) => LroStatus { + return ( + rawResponse: RawResponse, + flatResponse: TResult + ): LroStatus => { + if (isAzureAsyncPollingDone(rawResponse)) { + if (resourceLocation === undefined) { + return { rawResponse, flatResponse, done: true }; + } else { + return { + rawResponse, + flatResponse, + done: false, + next: async () => { + const finalResponse = await sendFinalRequest( + lro, + lroResourceLocationConfig, + resourceLocation + ); + return { + ...(finalResponse ?? { + rawResponse, + flatResponse + }), + done: true + }; + } + }; + } + } + return { + rawResponse, + flatResponse, + done: false + }; + }; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/bodyPolling.ts b/sdk/managedapplications/arm-managedapplications/src/lro/bodyPolling.ts new file mode 100644 index 000000000000..b1c87f8bc8d7 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/bodyPolling.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { + failureStates, + LroBody, + LroStatus, + RawResponse, + successStates +} from "./models"; +import { isUnexpectedPollingResponse } from "./requestUtils"; + +function getProvisioningState(rawResponse: RawResponse): string { + const { properties, provisioningState } = (rawResponse.body as LroBody) ?? {}; + const state: string | undefined = + properties?.provisioningState ?? provisioningState; + return state?.toLowerCase() ?? "succeeded"; +} + +export function isBodyPollingDone(rawResponse: RawResponse): boolean { + const state = getProvisioningState(rawResponse); + if ( + isUnexpectedPollingResponse(rawResponse) || + failureStates.includes(state) + ) { + throw new Error( + `The long running operation has failed. The provisioning state: ${state}.` + ); + } + return successStates.includes(state); +} + +/** + * Creates a polling strategy based on BodyPolling which uses the provisioning state + * from the result to determine the current operation state + */ +export function processBodyPollingOperationResult( + rawResponse: RawResponse, + flatResponse: TResult +): LroStatus { + return { + rawResponse, + flatResponse, + done: isBodyPollingDone(rawResponse) + }; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/index.ts b/sdk/managedapplications/arm-managedapplications/src/lro/index.ts new file mode 100644 index 000000000000..20df608fc848 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/index.ts @@ -0,0 +1,26 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { LroEngine } from "./lroEngine"; +export { createGetLroStatusFromResponse } from "./stateMachine"; +export { + LroResourceLocationConfig, + GetLroStatusFromResponse, + RawResponse, + LongRunningOperation, + LroConfig, + LroMode, + LroResponse, + LroStatus, + LroTerminalState, + LroInProgressState, + LroEngineOptions +} from "./models"; diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/locationPolling.ts b/sdk/managedapplications/arm-managedapplications/src/lro/locationPolling.ts new file mode 100644 index 000000000000..9d1aadfbdecc --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/locationPolling.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { LroStatus, RawResponse } from "./models"; +import { isUnexpectedPollingResponse } from "./requestUtils"; + +function isLocationPollingDone(rawResponse: RawResponse): boolean { + return ( + !isUnexpectedPollingResponse(rawResponse) && rawResponse.statusCode !== 202 + ); +} + +export function processLocationPollingOperationResult( + rawResponse: RawResponse, + flatResponse: TResult +): LroStatus { + return { + rawResponse, + flatResponse, + done: isLocationPollingDone(rawResponse) + }; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/lroEngine.ts b/sdk/managedapplications/arm-managedapplications/src/lro/lroEngine.ts new file mode 100644 index 000000000000..85cc15e60913 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/lroEngine.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Poller, PollOperationState } from "@azure/core-lro"; +import { + LongRunningOperation, + LroEngineOptions, + ResumablePollOperationState +} from "./models"; +import { GenericPollOperation } from "./operation"; + +/** + * The LRO Engine, a class that performs polling. + */ +export class LroEngine< + TResult, + TState extends PollOperationState +> extends Poller { + private intervalInMs: number; + + constructor(lro: LongRunningOperation, options?: LroEngineOptions) { + const { intervalInMs = 2000, resumeFrom } = options || {}; + function deserializeState( + resumeFrom: string + ): TState & ResumablePollOperationState { + try { + return JSON.parse(resumeFrom).state; + } catch (e) { + throw new Error( + `LroEngine: Unable to deserialize state: ${resumeFrom}` + ); + } + } + const state: TState & ResumablePollOperationState = resumeFrom + ? deserializeState(resumeFrom) + : ({} as any); + + const operation = new GenericPollOperation(state, lro); + super(operation); + + this.intervalInMs = intervalInMs; + operation.setPollerConfig(this as any); + } + + /** + * The method used by the poller to wait before attempting to update its operation. + */ + delay(): Promise { + return new Promise((resolve) => + setTimeout(() => resolve(), this.intervalInMs) + ); + } +} diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/models.ts b/sdk/managedapplications/arm-managedapplications/src/lro/models.ts new file mode 100644 index 000000000000..93c3437c8e40 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/models.ts @@ -0,0 +1,173 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code 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 { PollOperationState } from "@azure/core-lro"; + +/** + * Options for the LRO poller. + */ +export interface LroEngineOptions { + /** + * Defines how much time the poller is going to wait before making a new request to the service. + */ + intervalInMs?: number; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + resumeFrom?: string; +} + +export const successStates = ["succeeded"]; +export const failureStates = ["failed", "canceled", "cancelled"]; +/** + * The LRO states that signal that the LRO has completed. + */ +export const terminalStates = successStates.concat(failureStates); + +/** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ +export type LroResourceLocationConfig = + | "azure-async-operation" + | "location" + | "original-uri"; + +/** + * The type of a LRO response body. This is just a convenience type for checking the status of the operation. + */ + +export interface LroBody extends Record { + /** The status of the operation. */ + status?: string; + /** The state of the provisioning process */ + provisioningState?: string; + /** The properties of the provisioning process */ + properties?: { provisioningState?: string } & Record; +} + +/** + * Simple type of the raw response. + */ +export interface RawResponse { + /** The HTTP status code */ + statusCode: number; + /** A HttpHeaders collection in the response represented as a simple JSON object where all header names have been normalized to be lower-case. */ + headers: { + [headerName: string]: string; + }; + /** The parsed response body */ + body?: unknown; +} + +/** + * The type of the response of a LRO. + */ +export interface LroResponse { + /** The flattened response */ + flatResponse: T; + /** The raw response */ + rawResponse: RawResponse; +} + +/** The type of which LRO implementation being followed by a specific API. */ +export type LroMode = "AzureAsync" | "Location" | "Body"; + +/** + * The configuration of a LRO to determine how to perform polling and checking whether the operation has completed. + */ +export interface LroConfig { + /** The LRO mode */ + mode?: LroMode; + /** The path of a provisioned resource */ + resourceLocation?: string; +} + +/** + * Type of a polling operation state that can actually be resumed. + */ +export type ResumablePollOperationState = PollOperationState & { + initialRawResponse?: RawResponse; + config?: LroConfig; + pollingURL?: string; +}; + +export interface PollerConfig { + intervalInMs: number; +} + +/** + * The type of a terminal state of an LRO. + */ +export interface LroTerminalState extends LroResponse { + /** + * Whether the operation has finished. + */ + done: true; +} + +/** + * The type of an in-progress state of an LRO. + */ +export interface LroInProgressState extends LroResponse { + /** + * Whether the operation has finished. + */ + done: false; + /** + * The request to be sent next if it is different from the standard polling one. + * Notice that it will disregard any polling URLs provided to it. + */ + next?: () => Promise>; +} + +/** + * The type of an LRO state which is a tagged union of terminal and in-progress states. + */ +export type LroStatus = LroTerminalState | LroInProgressState; + +/** + * The type of the getLROStatusFromResponse method. It takes the response as input and returns along the response whether the operation has finished. + */ +export type GetLroStatusFromResponse = ( + rawResponse: RawResponse, + flatResponse: T +) => LroStatus; + +/** + * Description of a long running operation. + */ +export interface LongRunningOperation { + /** + * The request path. + */ + requestPath: string; + /** + * The HTTP request method. + */ + requestMethod: string; + /** + * A function that can be used to send initial request to the service. + */ + sendInitialRequest: ( + initializeState: ( + rawResponse: RawResponse, + flatResponse: unknown + ) => boolean + ) => Promise>; + /** + * A function that can be used to poll for the current status of a long running operation. + */ + sendPollRequest: (config: LroConfig, path: string) => Promise>; + /** + * A function that can be used to retrieve the provisioned azure resource. + */ + retrieveAzureAsyncResource: (path?: string) => Promise>; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/operation.ts b/sdk/managedapplications/arm-managedapplications/src/lro/operation.ts new file mode 100644 index 000000000000..3ea7b76d89b3 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/operation.ts @@ -0,0 +1,120 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code 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 { PollOperationState, PollOperation } from "@azure/core-lro"; +import { + PollerConfig, + ResumablePollOperationState, + LongRunningOperation, + LroStatus +} from "./models"; +import { getPollingUrl } from "./requestUtils"; +import { createInitializeState, createPollForLROStatus } from "./stateMachine"; + +export class GenericPollOperation< + TResult, + TState extends PollOperationState +> implements PollOperation { + private getLROStatusFromResponse?: ( + pollingURL: string, + pollerConfig: PollerConfig + ) => Promise>; + private pollerConfig?: PollerConfig; + constructor( + public state: TState & ResumablePollOperationState, + private lro: LongRunningOperation + ) {} + + public setPollerConfig(pollerConfig: PollerConfig): void { + this.pollerConfig = pollerConfig; + } + + /** + * General update function for LROPoller, the general process is as follows + * 1. Check initial operation result to determine the strategy to use + * - Strategies: Location, Azure-AsyncOperation, Original Uri + * 2. Check if the operation result has a terminal state + * - Terminal state will be determined by each strategy + * 2.1 If it is terminal state Check if a final GET request is required, if so + * send final GET request and return result from operation. If no final GET + * is required, just return the result from operation. + * - Determining what to call for final request is responsibility of each strategy + * 2.2 If it is not terminal state, call the polling operation and go to step 1 + * - Determining what to call for polling is responsibility of each strategy + * - Strategies will always use the latest URI for polling if provided otherwise + * the last known one + */ + async update(options?: { + abortSignal?: AbortSignalLike | undefined; + fireProgress?: ((state: TState) => void) | undefined; + }): Promise> { + const state = this.state; + if (!state.isStarted) { + const initializeState = createInitializeState( + state, + this.lro.requestPath, + this.lro.requestMethod + ); + await this.lro.sendInitialRequest(initializeState); + } + + if (!state.isCompleted) { + if (this.getLROStatusFromResponse === undefined) { + if (state.config === undefined) { + throw new Error( + "Bad state: LRO mode is undefined. Please check if the serialized state is well-formed." + ); + } + this.getLROStatusFromResponse = createPollForLROStatus( + this.lro, + state.config + ); + } + if (state.pollingURL === undefined) { + throw new Error( + "Bad state: polling URL is undefined. Please check if the serialized state is well-formed." + ); + } + const currentState = await this.getLROStatusFromResponse( + state.pollingURL, + this.pollerConfig! + ); + if (currentState.done) { + state.result = currentState.flatResponse; + state.isCompleted = true; + } else { + this.getLROStatusFromResponse = + currentState.next ?? this.getLROStatusFromResponse; + state.pollingURL = getPollingUrl( + currentState.rawResponse, + state.pollingURL + ); + } + } + options?.fireProgress?.(state); + return this; + } + + async cancel(): Promise> { + this.state.isCancelled = true; + return this; + } + + /** + * Serializes the Poller operation. + */ + public toString(): string { + return JSON.stringify({ + state: this.state + }); + } +} diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/passthrough.ts b/sdk/managedapplications/arm-managedapplications/src/lro/passthrough.ts new file mode 100644 index 000000000000..ae7f87d38483 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/passthrough.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code 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 { LroStatus, RawResponse } from "./models"; + +export function processPassthroughOperationResult( + rawResponse: RawResponse, + flatResponse: TResult +): LroStatus { + return { + rawResponse, + flatResponse, + done: true + }; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/requestUtils.ts b/sdk/managedapplications/arm-managedapplications/src/lro/requestUtils.ts new file mode 100644 index 000000000000..40d993686f0d --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/requestUtils.ts @@ -0,0 +1,105 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code 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 { LroConfig, RawResponse } from "./models"; + +/** + * Detects where the continuation token is and returns it. Notice that azure-asyncoperation + * must be checked first before the other location headers because there are scenarios + * where both azure-asyncoperation and location could be present in the same response but + * azure-asyncoperation should be the one to use for polling. + */ +export function getPollingUrl( + rawResponse: RawResponse, + defaultPath: string +): string { + return ( + getAzureAsyncOperation(rawResponse) ?? + getLocation(rawResponse) ?? + getOperationLocation(rawResponse) ?? + defaultPath + ); +} + +function getLocation(rawResponse: RawResponse): string | undefined { + return rawResponse.headers["location"]; +} + +function getOperationLocation(rawResponse: RawResponse): string | undefined { + return rawResponse.headers["operation-location"]; +} + +function getAzureAsyncOperation(rawResponse: RawResponse): string | undefined { + return rawResponse.headers["azure-asyncoperation"]; +} + +export function inferLroMode( + requestPath: string, + requestMethod: string, + rawResponse: RawResponse +): LroConfig { + if (getAzureAsyncOperation(rawResponse) !== undefined) { + return { + mode: "AzureAsync", + resourceLocation: + requestMethod === "PUT" + ? requestPath + : requestMethod === "POST" + ? getLocation(rawResponse) + : undefined + }; + } else if ( + getLocation(rawResponse) !== undefined || + getOperationLocation(rawResponse) !== undefined + ) { + return { + mode: "Location" + }; + } else if (["PUT", "PATCH"].includes(requestMethod)) { + return { + mode: "Body" + }; + } + return {}; +} + +export class RestError extends Error { + public statusCode?: number; + constructor(message: string, statusCode: number) { + super(message); + this.name = "RestError"; + this.statusCode = statusCode; + + Object.setPrototypeOf(this, RestError.prototype); + } +} + +export function isUnexpectedInitialResponse(rawResponse: RawResponse): boolean { + const code = rawResponse.statusCode; + if (![203, 204, 202, 201, 200, 500].includes(code)) { + throw new RestError( + `Received unexpected HTTP status code ${code} in the initial response. This may indicate a server issue.`, + code + ); + } + return false; +} + +export function isUnexpectedPollingResponse(rawResponse: RawResponse): boolean { + const code = rawResponse.statusCode; + if (![202, 201, 200, 500].includes(code)) { + throw new RestError( + `Received unexpected HTTP status code ${code} while polling. This may indicate a server issue.`, + code + ); + } + return false; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/lro/stateMachine.ts b/sdk/managedapplications/arm-managedapplications/src/lro/stateMachine.ts new file mode 100644 index 000000000000..19a8f6747032 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/lro/stateMachine.ts @@ -0,0 +1,138 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code 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 { processAzureAsyncOperationResult } from "./azureAsyncPolling"; +import { + isBodyPollingDone, + processBodyPollingOperationResult +} from "./bodyPolling"; +import { processLocationPollingOperationResult } from "./locationPolling"; +import { + LroResourceLocationConfig, + GetLroStatusFromResponse, + LongRunningOperation, + LroConfig, + LroStatus, + PollerConfig, + RawResponse, + ResumablePollOperationState +} from "./models"; +import { processPassthroughOperationResult } from "./passthrough"; +import { + getPollingUrl, + inferLroMode, + isUnexpectedInitialResponse +} from "./requestUtils"; + +/** + * creates a stepping function that maps an LRO state to another. + */ +export function createGetLroStatusFromResponse( + lroPrimitives: LongRunningOperation, + config: LroConfig, + lroResourceLocationConfig?: LroResourceLocationConfig +): GetLroStatusFromResponse { + switch (config.mode) { + case "AzureAsync": { + return processAzureAsyncOperationResult( + lroPrimitives, + config.resourceLocation, + lroResourceLocationConfig + ); + } + case "Location": { + return processLocationPollingOperationResult; + } + case "Body": { + return processBodyPollingOperationResult; + } + default: { + return processPassthroughOperationResult; + } + } +} + +/** + * Creates a polling operation that returns a LRO state. + */ +export function createPollForLROStatus( + lroPrimitives: LongRunningOperation, + config: LroConfig +): ( + pollingURL: string, + pollerConfig: PollerConfig +) => Promise> { + return async ( + path: string, + pollerConfig: PollerConfig + ): Promise> => { + const response = await lroPrimitives.sendPollRequest(config, path); + const retryAfter: string | undefined = + response.rawResponse.headers["retry-after"]; + if (retryAfter !== undefined) { + const retryAfterInMs = parseInt(retryAfter); + pollerConfig.intervalInMs = isNaN(retryAfterInMs) + ? calculatePollingIntervalFromDate( + new Date(retryAfter), + pollerConfig.intervalInMs + ) + : retryAfterInMs; + } + return response; + }; +} + +function calculatePollingIntervalFromDate( + retryAfterDate: Date, + defaultIntervalInMs: number +): number { + const timeNow = Math.floor(new Date().getTime()); + const retryAfterTime = retryAfterDate.getTime(); + if (timeNow < retryAfterTime) { + return retryAfterTime - timeNow; + } + return defaultIntervalInMs; +} + +/** + * Creates a callback to be used to initialize the polling operation state. + * @param state - of the polling operation + * @param operationSpec - of the LRO + * @param callback - callback to be called when the operation is done + * @returns callback that initializes the state of the polling operation + */ +export function createInitializeState( + state: ResumablePollOperationState, + requestPath: string, + requestMethod: string +): (rawResponse: RawResponse, flatResponse: unknown) => boolean { + return (rawResponse: RawResponse, flatResponse: unknown) => { + if (isUnexpectedInitialResponse(rawResponse)) return true; + state.initialRawResponse = rawResponse; + state.isStarted = true; + state.pollingURL = getPollingUrl(state.initialRawResponse, requestPath); + state.config = inferLroMode( + requestPath, + requestMethod, + state.initialRawResponse + ); + /** short circuit polling if body polling is done in the initial request */ + if ( + state.config.mode === undefined || + (state.config.mode === "Body" && + isBodyPollingDone(state.initialRawResponse)) + ) { + state.result = flatResponse as TResult; + state.isCompleted = true; + } + return Boolean(state.isCompleted); + }; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/managedApplicationClient.ts b/sdk/managedapplications/arm-managedapplications/src/managedApplicationClient.ts deleted file mode 100644 index 2897a8be4c98..000000000000 --- a/sdk/managedapplications/arm-managedapplications/src/managedApplicationClient.ts +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as Parameters from "./models/parameters"; -import * as operations from "./operations"; -import { ManagedApplicationClientContext } from "./managedApplicationClientContext"; - - -class ManagedApplicationClient extends ManagedApplicationClientContext { - // Operation groups - appliances: operations.Appliances; - applianceDefinitions: operations.ApplianceDefinitions; - - /** - * Initializes a new instance of the ManagedApplicationClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ManagedApplicationClientOptions) { - super(credentials, subscriptionId, options); - this.appliances = new operations.Appliances(this); - this.applianceDefinitions = new operations.ApplianceDefinitions(this); - } - - /** - * Lists all of the available Microsoft.Solutions REST API operations. - * @param [options] The optional parameters - * @returns Promise - */ - listOperations(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listOperations(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listOperations(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listOperations(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - options - }, - listOperationsOperationSpec, - callback) as Promise; - } - - /** - * Lists all of the available Microsoft.Solutions REST API operations. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listOperationsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listOperationsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listOperationsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listOperationsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - nextPageLink, - options - }, - listOperationsNextOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Solutions/operations", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.OperationListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listOperationsNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.OperationListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -export { - ManagedApplicationClient, - ManagedApplicationClientContext, - Models as ManagedApplicationModels, - Mappers as ManagedApplicationMappers -}; -export * from "./operations"; diff --git a/sdk/managedapplications/arm-managedapplications/src/managedApplicationClientContext.ts b/sdk/managedapplications/arm-managedapplications/src/managedApplicationClientContext.ts deleted file mode 100644 index ddcedede9ce8..000000000000 --- a/sdk/managedapplications/arm-managedapplications/src/managedApplicationClientContext.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-managedapplications"; -const packageVersion = "1.0.2"; - -export class ManagedApplicationClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the ManagedApplicationClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ManagedApplicationClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2016-09-01-preview'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/managedapplications/arm-managedapplications/src/models/applianceDefinitionsMappers.ts b/sdk/managedapplications/arm-managedapplications/src/models/applianceDefinitionsMappers.ts deleted file mode 100644 index bf65dc418a3c..000000000000 --- a/sdk/managedapplications/arm-managedapplications/src/models/applianceDefinitionsMappers.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - Appliance, - ApplianceArtifact, - ApplianceDefinition, - ApplianceDefinitionListResult, - AppliancePatchable, - ApplianceProviderAuthorization, - BaseResource, - ErrorResponse, - GenericResource, - Identity, - Plan, - PlanPatchable, - Resource, - Sku -} from "../models/mappers"; diff --git a/sdk/managedapplications/arm-managedapplications/src/models/appliancesMappers.ts b/sdk/managedapplications/arm-managedapplications/src/models/appliancesMappers.ts deleted file mode 100644 index d4d39be5ada8..000000000000 --- a/sdk/managedapplications/arm-managedapplications/src/models/appliancesMappers.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - Appliance, - ApplianceArtifact, - ApplianceDefinition, - ApplianceListResult, - AppliancePatchable, - ApplianceProviderAuthorization, - BaseResource, - ErrorResponse, - GenericResource, - Identity, - Plan, - PlanPatchable, - Resource, - Sku -} from "../models/mappers"; diff --git a/sdk/managedapplications/arm-managedapplications/src/models/index.ts b/sdk/managedapplications/arm-managedapplications/src/models/index.ts index 28e979a00944..908a47bafc68 100644 --- a/sdk/managedapplications/arm-managedapplications/src/models/index.ts +++ b/sdk/managedapplications/arm-managedapplications/src/models/index.ts @@ -1,899 +1,507 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +/** Result of the request to list Microsoft.Solutions operations. It contains a list of operations and a URL link to get the next set of results. */ +export interface OperationListResult { + /** List of Microsoft.Solutions operations. */ + value?: Operation[]; + /** URL to get the next set of operation list results if there are any. */ + nextLink?: string; +} -/** - * Plan for the appliance. - */ -export interface Plan { - /** - * The plan name. - */ - name: string; - /** - * The publisher ID. - */ - publisher: string; - /** - * The product code. - */ - product: string; - /** - * The promotion code. - */ - promotionCode?: string; - /** - * The plan's version. - */ - version: string; +/** Microsoft.Solutions operation */ +export interface Operation { + /** Operation name: {provider}/{resource}/{operation} */ + name?: string; + /** The object that represents the operation. */ + display?: OperationDisplay; } -/** - * Resource information. - */ -export interface Resource extends BaseResource { +/** The object that represents the operation. */ +export interface OperationDisplay { + /** Service provider: Microsoft.Solutions */ + provider?: string; + /** Resource on which the operation is performed: Application, JitRequest, etc. */ + resource?: string; + /** Operation type: Read, write, delete, etc. */ + operation?: string; +} + +/** Resource information. */ +export interface Resource { /** * Resource ID - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; /** * Resource name - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * Resource type - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; - /** - * Resource location - */ + /** Resource location */ location?: string; - /** - * Resource tags - */ + /** Resource tags */ tags?: { [propertyName: string]: string }; } -/** - * Resource information. - */ -export interface GenericResource extends Resource { - /** - * ID of the resource that manages this resource. - */ - managedBy?: string; - /** - * The SKU of the resource. - */ - sku?: Sku; - /** - * The identity of the resource. - */ - identity?: Identity; +/** SKU for the resource. */ +export interface Sku { + /** The SKU name. */ + name: string; + /** The SKU tier. */ + tier?: string; + /** The SKU size. */ + size?: string; + /** The SKU family. */ + family?: string; + /** The SKU model. */ + model?: string; + /** The SKU capacity. */ + capacity?: number; } -/** - * Information about appliance. - */ -export interface Appliance extends GenericResource { - /** - * The managed resource group Id. - */ - managedResourceGroupId: string; - /** - * The fully qualified path of appliance definition Id. - */ - applianceDefinitionId?: string; - /** - * Name and value pairs that define the appliance parameters. It can be a JObject or a well - * formed JSON string. - */ - parameters?: any; - /** - * Name and value pairs that define the appliance outputs. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly outputs?: any; - /** - * The appliance provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', - * 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: ProvisioningState; - /** - * The blob URI where the UI definition file is located. - */ - uiDefinitionUri?: string; +/** Identity for the resource. */ +export interface Identity { /** - * The plan information. + * The principal ID of resource identity. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - plan?: Plan; + readonly principalId?: string; /** - * The kind of the appliance. Allowed values are MarketPlace and ServiceCatalog. + * The tenant ID of resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - kind?: string; + readonly tenantId?: string; + /** The identity type. */ + type?: "SystemAssigned"; } -/** - * Plan for the appliance. - */ +/** Plan for the managed application. */ +export interface Plan { + /** The plan name. */ + name: string; + /** The publisher ID. */ + publisher: string; + /** The product code. */ + product: string; + /** The promotion code. */ + promotionCode?: string; + /** The plan's version. */ + version: string; +} + +/** Error response indicates managed application is not able to process the incoming request. The reason is provided in the error message. */ +export interface ErrorResponse { + /** Http status code. */ + httpStatus?: string; + /** Error code. */ + errorCode?: string; + /** Error message indicating why the operation failed. */ + errorMessage?: string; +} + +/** Plan for the managed application. */ export interface PlanPatchable { - /** - * The plan name. - */ + /** The plan name. */ name?: string; - /** - * The publisher ID. - */ + /** The publisher ID. */ publisher?: string; - /** - * The product code. - */ + /** The product code. */ product?: string; - /** - * The promotion code. - */ + /** The promotion code. */ promotionCode?: string; - /** - * The plan's version. - */ + /** The plan's version. */ version?: string; } -/** - * Information about appliance. - */ -export interface AppliancePatchable extends GenericResource { - /** - * The managed resource group Id. - */ - managedResourceGroupId?: string; - /** - * The fully qualified path of appliance definition Id. - */ - applianceDefinitionId?: string; - /** - * Name and value pairs that define the appliance parameters. It can be a JObject or a well - * formed JSON string. - */ - parameters?: any; - /** - * Name and value pairs that define the appliance outputs. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly outputs?: any; - /** - * The appliance provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', - * 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: ProvisioningState; - /** - * The blob URI where the UI definition file is located. - */ - uiDefinitionUri?: string; - /** - * The plan information. - */ - plan?: PlanPatchable; - /** - * The kind of the appliance. Allowed values are MarketPlace and ServiceCatalog. - */ - kind?: string; -} - -/** - * The appliance provider authorization. - */ -export interface ApplianceProviderAuthorization { - /** - * The provider's principal identifier. This is the identity that the provider will use to call - * ARM to manage the appliance resources. - */ +/** The managed application provider authorization. */ +export interface ApplicationProviderAuthorization { + /** The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the managed application resources. */ principalId: string; - /** - * The provider's role definition identifier. This role will define all the permissions that the - * provider must have on the appliance's container resource group. This role definition cannot - * have permission to delete the resource group. - */ + /** The provider's role definition identifier. This role will define all the permissions that the provider must have on the managed application's container resource group. This role definition cannot have permission to delete the resource group. */ roleDefinitionId: string; } -/** - * Appliance artifact. - */ -export interface ApplianceArtifact { - /** - * The appliance artifact name. - */ +/** Managed application artifact. */ +export interface ApplicationArtifact { + /** The managed application artifact name. */ name?: string; - /** - * The appliance artifact blob uri. - */ + /** The managed application artifact blob uri. */ uri?: string; - /** - * The the appliance artifact type. Possible values include: 'Template', 'Custom' - */ - type?: ApplianceArtifactType; + /** The managed application artifact type. */ + type?: ApplicationArtifactType; } -/** - * Information about appliance definition. - */ -export interface ApplianceDefinition extends GenericResource { - /** - * The appliance lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None' - */ - lockLevel: ApplianceLockLevel; - /** - * The appliance definition display name. - */ - displayName?: string; - /** - * The appliance provider authorizations. - */ - authorizations: ApplianceProviderAuthorization[]; - /** - * The collection of appliance artifacts. The portal will use the files specified as artifacts to - * construct the user experience of creating an appliance from an appliance definition. - */ - artifacts?: ApplianceArtifact[]; - /** - * The appliance definition description. - */ - description?: string; - /** - * The appliance definition package file Uri. - */ - packageFileUri: string; +/** List of managed application definitions. */ +export interface ApplicationDefinitionListResult { + /** The array of managed application definitions. */ + value?: ApplicationDefinition[]; + /** The URL to use for getting the next set of results. */ + nextLink?: string; } -/** - * SKU for the resource. - */ -export interface Sku { - /** - * The SKU name. - */ - name: string; - /** - * The SKU tier. - */ - tier?: string; - /** - * The SKU size. - */ - size?: string; - /** - * The SKU family. - */ - family?: string; - /** - * The SKU model. - */ - model?: string; - /** - * The SKU capacity. - */ - capacity?: number; +/** List of managed applications. */ +export interface ApplicationListResult { + /** The array of managed applications. */ + value?: Application[]; + /** The URL to use for getting the next set of results. */ + nextLink?: string; } -/** - * Identity for the resource. - */ -export interface Identity { - /** - * The principal ID of resource identity. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly principalId?: string; - /** - * The tenant ID of resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly tenantId?: string; - /** - * The identity type. Possible values include: 'SystemAssigned' - */ - type?: ResourceIdentityType; -} +/** Resource information. */ +export type GenericResource = Resource & { + /** ID of the resource that manages this resource. */ + managedBy?: string; + /** The SKU of the resource. */ + sku?: Sku; + /** The identity of the resource. */ + identity?: Identity; +}; -/** - * Error response indicates ARM appliance is not able to process the incoming request. The reason - * is provided in the error message. - */ -export interface ErrorResponse { - /** - * Http status code. - */ - httpStatus?: string; +/** Information about managed application. */ +export type Application = GenericResource & { + /** The plan information. */ + plan?: Plan; + /** The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. */ + kind: string; + /** The managed resource group Id. */ + managedResourceGroupId: string; + /** The fully qualified path of managed application definition Id. */ + applicationDefinitionId?: string; + /** Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. */ + parameters?: Record; /** - * Error code. + * Name and value pairs that define the managed application outputs. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - errorCode?: string; + readonly outputs?: Record; /** - * Error message indicating why the operation failed. + * The managed application provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - errorMessage?: string; -} + readonly provisioningState?: ProvisioningState; +}; -/** - * The object that represents the operation. - */ -export interface OperationDisplay { - /** - * Service provider: Microsoft.Solutions - */ - provider?: string; +/** Information about managed application. */ +export type ApplicationPatchable = GenericResource & { + /** The plan information. */ + plan?: PlanPatchable; + /** The kind of the managed application. Allowed values are MarketPlace and ServiceCatalog. */ + kind?: string; + /** The managed resource group Id. */ + managedResourceGroupId?: string; + /** The fully qualified path of managed application definition Id. */ + applicationDefinitionId?: string; + /** Name and value pairs that define the managed application parameters. It can be a JObject or a well formed JSON string. */ + parameters?: Record; /** - * Resource on which the operation is performed: Profile, endpoint, etc. + * Name and value pairs that define the managed application outputs. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - resource?: string; + readonly outputs?: Record; /** - * Operation type: Read, write, delete, etc. + * The managed application provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - operation?: string; -} + readonly provisioningState?: ProvisioningState; +}; -/** - * Microsoft.Solutions operation - */ -export interface Operation { - /** - * Operation name: {provider}/{resource}/{operation} - */ - name?: string; - /** - * The object that represents the operation. - */ - display?: OperationDisplay; +/** Information about managed application definition. */ +export type ApplicationDefinition = GenericResource & { + /** The managed application lock level. */ + lockLevel: ApplicationLockLevel; + /** The managed application definition display name. */ + displayName?: string; + /** A value indicating whether the package is enabled or not. */ + isEnabled?: string; + /** The managed application provider authorizations. */ + authorizations: ApplicationProviderAuthorization[]; + /** The collection of managed application artifacts. The portal will use the files specified as artifacts to construct the user experience of creating a managed application from a managed application definition. */ + artifacts?: ApplicationArtifact[]; + /** The managed application definition description. */ + description?: string; + /** The managed application definition package file Uri. Use this element */ + packageFileUri?: string; + /** The inline main template json which has resources to be provisioned. It can be a JObject or well-formed JSON string. */ + mainTemplate?: Record; + /** The createUiDefinition json for the backing template with Microsoft.Solutions/applications resource. It can be a JObject or well-formed JSON string. */ + createUiDefinition?: Record; +}; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Accepted = "Accepted", + Running = "Running", + Ready = "Ready", + Creating = "Creating", + Created = "Created", + Deleting = "Deleting", + Deleted = "Deleted", + Canceled = "Canceled", + Failed = "Failed", + Succeeded = "Succeeded", + Updating = "Updating" } /** - * Optional Parameters. - */ -export interface AppliancesUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Parameters supplied to update an existing appliance. - */ - parameters?: Appliance; + * 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 + * **Accepted** \ + * **Running** \ + * **Ready** \ + * **Creating** \ + * **Created** \ + * **Deleting** \ + * **Deleted** \ + * **Canceled** \ + * **Failed** \ + * **Succeeded** \ + * **Updating** + */ +export type ProvisioningState = string; +/** Defines values for ApplicationLockLevel. */ +export type ApplicationLockLevel = "CanNotDelete" | "ReadOnly" | "None"; +/** Defines values for ApplicationArtifactType. */ +export type ApplicationArtifactType = "Template" | "Custom"; + +/** Optional parameters. */ +export interface ApplicationClientListOperationsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listOperations operation. */ +export type ApplicationClientListOperationsResponse = OperationListResult; + +/** Optional parameters. */ +export interface ApplicationClientListOperationsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listOperationsNext operation. */ +export type ApplicationClientListOperationsNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface ApplicationClientListOperationsNextNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listOperationsNextNext operation. */ +export type ApplicationClientListOperationsNextNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface ApplicationsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ApplicationsGetResponse = Application; + +/** Optional parameters. */ +export interface ApplicationsDeleteOptionalParams + 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 AppliancesUpdateByIdOptionalParams extends msRest.RequestOptionsBase { - /** - * Parameters supplied to update an existing appliance. - */ - parameters?: Appliance; +/** Optional parameters. */ +export interface ApplicationsCreateOrUpdateOptionalParams + 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; } -/** - * An interface representing ManagedApplicationClientOptions. - */ -export interface ManagedApplicationClientOptions extends AzureServiceClientOptions { - baseUri?: string; +/** Contains response data for the createOrUpdate operation. */ +export type ApplicationsCreateOrUpdateResponse = Application; + +/** Optional parameters. */ +export interface ApplicationsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Parameters supplied to update an existing managed application. */ + parameters?: ApplicationPatchable; } -/** - * @interface - * Result of the request to list Microsoft.Solutions operations. It contains a list of operations - * and a URL link to get the next set of results. - * @extends Array - */ -export interface OperationListResult extends Array { - /** - * URL to get the next set of operation list results if there are any. - */ - nextLink?: string; +/** Contains response data for the update operation. */ +export type ApplicationsUpdateResponse = Application; + +/** Optional parameters. */ +export interface ApplicationsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type ApplicationsListByResourceGroupResponse = ApplicationListResult; + +/** Optional parameters. */ +export interface ApplicationsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type ApplicationsListBySubscriptionResponse = ApplicationListResult; + +/** Optional parameters. */ +export interface ApplicationsGetByIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getById operation. */ +export type ApplicationsGetByIdResponse = Application; + +/** Optional parameters. */ +export interface ApplicationsDeleteByIdOptionalParams + 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; } -/** - * @interface - * List of appliances. - * @extends Array - */ -export interface ApplianceListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; +/** Optional parameters. */ +export interface ApplicationsCreateOrUpdateByIdOptionalParams + 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; } -/** - * @interface - * List of appliance definitions. - * @extends Array - */ -export interface ApplianceDefinitionListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; +/** Contains response data for the createOrUpdateById operation. */ +export type ApplicationsCreateOrUpdateByIdResponse = Application; + +/** Optional parameters. */ +export interface ApplicationsUpdateByIdOptionalParams + extends coreClient.OperationOptions { + /** Parameters supplied to update an existing managed application. */ + parameters?: Application; } -/** - * Defines values for ProvisioningState. - * Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', - * 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' - * @readonly - * @enum {string} - */ -export type ProvisioningState = 'Accepted' | 'Running' | 'Ready' | 'Creating' | 'Created' | 'Deleting' | 'Deleted' | 'Canceled' | 'Failed' | 'Succeeded' | 'Updating'; +/** Contains response data for the updateById operation. */ +export type ApplicationsUpdateByIdResponse = Application; -/** - * Defines values for ApplianceLockLevel. - * Possible values include: 'CanNotDelete', 'ReadOnly', 'None' - * @readonly - * @enum {string} - */ -export type ApplianceLockLevel = 'CanNotDelete' | 'ReadOnly' | 'None'; +/** Optional parameters. */ +export interface ApplicationsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Defines values for ApplianceArtifactType. - * Possible values include: 'Template', 'Custom' - * @readonly - * @enum {string} - */ -export type ApplianceArtifactType = 'Template' | 'Custom'; +/** Contains response data for the listByResourceGroupNext operation. */ +export type ApplicationsListByResourceGroupNextResponse = ApplicationListResult; -/** - * Defines values for ResourceIdentityType. - * Possible values include: 'SystemAssigned' - * @readonly - * @enum {string} - */ -export type ResourceIdentityType = 'SystemAssigned'; +/** Optional parameters. */ +export interface ApplicationsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listOperations operation. - */ -export type ListOperationsResponse = OperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Contains response data for the listBySubscriptionNext operation. */ +export type ApplicationsListBySubscriptionNextResponse = ApplicationListResult; -/** - * Contains response data for the listOperationsNext operation. - */ -export type ListOperationsNextResponse = OperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Optional parameters. */ +export interface ApplicationsListByResourceGroupNextNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the get operation. - */ -export type AppliancesGetResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; +/** Contains response data for the listByResourceGroupNextNext operation. */ +export type ApplicationsListByResourceGroupNextNextResponse = ApplicationListResult; -/** - * Contains response data for the createOrUpdate operation. - */ -export type AppliancesCreateOrUpdateResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; +/** Optional parameters. */ +export interface ApplicationsListBySubscriptionNextNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the update operation. - */ -export type AppliancesUpdateResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; +/** Contains response data for the listBySubscriptionNextNext operation. */ +export type ApplicationsListBySubscriptionNextNextResponse = ApplicationListResult; -/** - * Contains response data for the listByResourceGroup operation. - */ -export type AppliancesListByResourceGroupResponse = ApplianceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceListResult; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsGetOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listBySubscription operation. - */ -export type AppliancesListBySubscriptionResponse = ApplianceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceListResult; - }; -}; +/** Contains response data for the get operation. */ +export type ApplicationDefinitionsGetResponse = ApplicationDefinition; -/** - * Contains response data for the getById operation. - */ -export type AppliancesGetByIdResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsDeleteOptionalParams + 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 createOrUpdateById operation. - */ -export type AppliancesCreateOrUpdateByIdResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsCreateOrUpdateOptionalParams + 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 updateById operation. - */ -export type AppliancesUpdateByIdResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; +/** Contains response data for the createOrUpdate operation. */ +export type ApplicationDefinitionsCreateOrUpdateResponse = ApplicationDefinition; -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type AppliancesBeginCreateOrUpdateResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the beginCreateOrUpdateById operation. - */ -export type AppliancesBeginCreateOrUpdateByIdResponse = Appliance & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Appliance; - }; -}; +/** Contains response data for the listByResourceGroup operation. */ +export type ApplicationDefinitionsListByResourceGroupResponse = ApplicationDefinitionListResult; -/** - * Contains response data for the listByResourceGroupNext operation. - */ -export type AppliancesListByResourceGroupNextResponse = ApplianceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceListResult; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsGetByIdOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the listBySubscriptionNext operation. - */ -export type AppliancesListBySubscriptionNextResponse = ApplianceListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceListResult; - }; -}; +/** Contains response data for the getById operation. */ +export type ApplicationDefinitionsGetByIdResponse = ApplicationDefinition; -/** - * Contains response data for the get operation. - */ -export type ApplianceDefinitionsGetResponse = ApplianceDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinition; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsDeleteByIdOptionalParams + 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 ApplianceDefinitionsCreateOrUpdateResponse = ApplianceDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinition; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsCreateOrUpdateByIdOptionalParams + 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 listByResourceGroup operation. - */ -export type ApplianceDefinitionsListByResourceGroupResponse = ApplianceDefinitionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinitionListResult; - }; -}; +/** Contains response data for the createOrUpdateById operation. */ +export type ApplicationDefinitionsCreateOrUpdateByIdResponse = ApplicationDefinition; -/** - * Contains response data for the getById operation. - */ -export type ApplianceDefinitionsGetByIdResponse = ApplianceDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinition; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the createOrUpdateById operation. - */ -export type ApplianceDefinitionsCreateOrUpdateByIdResponse = ApplianceDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinition; - }; -}; +/** Contains response data for the listByResourceGroupNext operation. */ +export type ApplicationDefinitionsListByResourceGroupNextResponse = ApplicationDefinitionListResult; -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type ApplianceDefinitionsBeginCreateOrUpdateResponse = ApplianceDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinition; - }; -}; +/** Optional parameters. */ +export interface ApplicationDefinitionsListByResourceGroupNextNextOptionalParams + extends coreClient.OperationOptions {} -/** - * Contains response data for the beginCreateOrUpdateById operation. - */ -export type ApplianceDefinitionsBeginCreateOrUpdateByIdResponse = ApplianceDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinition; - }; -}; +/** Contains response data for the listByResourceGroupNextNext operation. */ +export type ApplicationDefinitionsListByResourceGroupNextNextResponse = ApplicationDefinitionListResult; -/** - * Contains response data for the listByResourceGroupNext operation. - */ -export type ApplianceDefinitionsListByResourceGroupNextResponse = ApplianceDefinitionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApplianceDefinitionListResult; - }; -}; +/** Optional parameters. */ +export interface ApplicationClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/models/mappers.ts b/sdk/managedapplications/arm-managedapplications/src/models/mappers.ts index 5f035b2b393d..a1843f48fb42 100644 --- a/sdk/managedapplications/arm-managedapplications/src/models/mappers.ts +++ b/sdk/managedapplications/arm-managedapplications/src/models/mappers.ts @@ -1,53 +1,81 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; -export const Plan: msRest.CompositeMapper = { - serializedName: "Plan", +export const Operation: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Plan", + className: "Operation", modelProperties: { name: { - required: true, serializedName: "name", type: { name: "String" } }, - publisher: { - required: true, - serializedName: "publisher", + display: { + serializedName: "display", type: { - name: "String" + name: "Composite", + className: "OperationDisplay" } - }, - product: { - required: true, - serializedName: "product", + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", type: { name: "String" } }, - promotionCode: { - serializedName: "promotionCode", + resource: { + serializedName: "resource", type: { name: "String" } }, - version: { - required: true, - serializedName: "version", + operation: { + serializedName: "operation", type: { name: "String" } @@ -56,29 +84,28 @@ export const Plan: msRest.CompositeMapper = { } }; -export const Resource: msRest.CompositeMapper = { - serializedName: "Resource", +export const Resource: coreClient.CompositeMapper = { type: { name: "Composite", className: "Resource", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, type: { - readOnly: true, serializedName: "type", + readOnly: true, type: { name: "String" } @@ -93,106 +120,82 @@ export const Resource: msRest.CompositeMapper = { serializedName: "tags", type: { name: "Dictionary", - value: { - type: { - name: "String" - } - } + value: { type: { name: "String" } } } } } } }; -export const GenericResource: msRest.CompositeMapper = { - serializedName: "GenericResource", +export const Sku: coreClient.CompositeMapper = { type: { name: "Composite", - className: "GenericResource", + className: "Sku", modelProperties: { - ...Resource.type.modelProperties, - managedBy: { - serializedName: "managedBy", + name: { + serializedName: "name", + required: true, type: { name: "String" } }, - sku: { - serializedName: "sku", + tier: { + serializedName: "tier", type: { - name: "Composite", - className: "Sku" + name: "String" } }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "Identity" - } - } - } - } -}; - -export const Appliance: msRest.CompositeMapper = { - serializedName: "Appliance", - type: { - name: "Composite", - className: "Appliance", - modelProperties: { - ...GenericResource.type.modelProperties, - managedResourceGroupId: { - required: true, - serializedName: "properties.managedResourceGroupId", + size: { + serializedName: "size", type: { name: "String" } }, - applianceDefinitionId: { - serializedName: "properties.applianceDefinitionId", + family: { + serializedName: "family", type: { name: "String" } }, - parameters: { - serializedName: "properties.parameters", + model: { + serializedName: "model", type: { - name: "Object" + name: "String" } }, - outputs: { - readOnly: true, - serializedName: "properties.outputs", + capacity: { + serializedName: "capacity", type: { - name: "Object" + name: "Number" } - }, - provisioningState: { + } + } + } +}; + +export const Identity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Identity", + modelProperties: { + principalId: { + serializedName: "principalId", readOnly: true, - serializedName: "properties.provisioningState", type: { name: "String" } }, - uiDefinitionUri: { - serializedName: "properties.uiDefinitionUri", + tenantId: { + serializedName: "tenantId", + readOnly: true, type: { name: "String" } }, - plan: { - serializedName: "plan", - type: { - name: "Composite", - className: "Plan" - } - }, - kind: { - serializedName: "kind", - constraints: { - Pattern: /^[-\w\._,\(\)]+$/ - }, + type: { + defaultValue: "SystemAssigned", + isConstant: true, + serializedName: "type", type: { name: "String" } @@ -201,26 +204,28 @@ export const Appliance: msRest.CompositeMapper = { } }; -export const PlanPatchable: msRest.CompositeMapper = { - serializedName: "PlanPatchable", +export const Plan: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PlanPatchable", + className: "Plan", modelProperties: { name: { serializedName: "name", + required: true, type: { name: "String" } }, publisher: { serializedName: "publisher", + required: true, type: { name: "String" } }, product: { serializedName: "product", + required: true, type: { name: "String" } @@ -233,6 +238,7 @@ export const PlanPatchable: msRest.CompositeMapper = { }, version: { serializedName: "version", + required: true, type: { name: "String" } @@ -241,63 +247,64 @@ export const PlanPatchable: msRest.CompositeMapper = { } }; -export const AppliancePatchable: msRest.CompositeMapper = { - serializedName: "AppliancePatchable", +export const ErrorResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppliancePatchable", + className: "ErrorResponse", modelProperties: { - ...GenericResource.type.modelProperties, - managedResourceGroupId: { - serializedName: "properties.managedResourceGroupId", + httpStatus: { + serializedName: "httpStatus", type: { name: "String" } }, - applianceDefinitionId: { - serializedName: "properties.applianceDefinitionId", + errorCode: { + serializedName: "errorCode", type: { name: "String" } }, - parameters: { - serializedName: "properties.parameters", + errorMessage: { + serializedName: "errorMessage", type: { - name: "Object" + name: "String" } - }, - outputs: { - readOnly: true, - serializedName: "properties.outputs", + } + } + } +}; + +export const PlanPatchable: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PlanPatchable", + modelProperties: { + name: { + serializedName: "name", type: { - name: "Object" + name: "String" } }, - provisioningState: { - readOnly: true, - serializedName: "properties.provisioningState", + publisher: { + serializedName: "publisher", type: { name: "String" } }, - uiDefinitionUri: { - serializedName: "properties.uiDefinitionUri", + product: { + serializedName: "product", type: { name: "String" } }, - plan: { - serializedName: "plan", + promotionCode: { + serializedName: "promotionCode", type: { - name: "Composite", - className: "PlanPatchable" + name: "String" } }, - kind: { - serializedName: "kind", - constraints: { - Pattern: /^[-\w\._,\(\)]+$/ - }, + version: { + serializedName: "version", type: { name: "String" } @@ -306,22 +313,21 @@ export const AppliancePatchable: msRest.CompositeMapper = { } }; -export const ApplianceProviderAuthorization: msRest.CompositeMapper = { - serializedName: "ApplianceProviderAuthorization", +export const ApplicationProviderAuthorization: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ApplianceProviderAuthorization", + className: "ApplicationProviderAuthorization", modelProperties: { principalId: { - required: true, serializedName: "principalId", + required: true, type: { name: "String" } }, roleDefinitionId: { - required: true, serializedName: "roleDefinitionId", + required: true, type: { name: "String" } @@ -330,11 +336,10 @@ export const ApplianceProviderAuthorization: msRest.CompositeMapper = { } }; -export const ApplianceArtifact: msRest.CompositeMapper = { - serializedName: "ApplianceArtifact", +export const ApplicationArtifact: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ApplianceArtifact", + className: "ApplicationArtifact", modelProperties: { name: { serializedName: "name", @@ -352,75 +357,59 @@ export const ApplianceArtifact: msRest.CompositeMapper = { serializedName: "type", type: { name: "Enum", - allowedValues: [ - "Template", - "Custom" - ] + allowedValues: ["Template", "Custom"] } } } } }; -export const ApplianceDefinition: msRest.CompositeMapper = { - serializedName: "ApplianceDefinition", +export const ApplicationDefinitionListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ApplianceDefinition", + className: "ApplicationDefinitionListResult", modelProperties: { - ...GenericResource.type.modelProperties, - lockLevel: { - required: true, - serializedName: "properties.lockLevel", - type: { - name: "Enum", - allowedValues: [ - "CanNotDelete", - "ReadOnly", - "None" - ] - } - }, - displayName: { - serializedName: "properties.displayName", - type: { - name: "String" - } - }, - authorizations: { - required: true, - serializedName: "properties.authorizations", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ApplianceProviderAuthorization" + className: "ApplicationDefinition" } } } }, - artifacts: { - serializedName: "properties.artifacts", + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ApplicationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApplicationListResult", + modelProperties: { + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ApplianceArtifact" + className: "Application" } } } }, - description: { - serializedName: "properties.description", - type: { - name: "String" - } - }, - packageFileUri: { - required: true, - serializedName: "properties.packageFileUri", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -429,134 +418,150 @@ export const ApplianceDefinition: msRest.CompositeMapper = { } }; -export const Sku: msRest.CompositeMapper = { - serializedName: "Sku", +export const GenericResource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Sku", + className: "GenericResource", modelProperties: { - name: { - required: true, - serializedName: "name", + ...Resource.type.modelProperties, + managedBy: { + serializedName: "managedBy", type: { name: "String" } }, - tier: { - serializedName: "tier", + sku: { + serializedName: "sku", type: { - name: "String" + name: "Composite", + className: "Sku" } }, - size: { - serializedName: "size", + identity: { + serializedName: "identity", type: { - name: "String" + name: "Composite", + className: "Identity" + } + } + } + } +}; + +export const Application: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Application", + modelProperties: { + ...GenericResource.type.modelProperties, + plan: { + serializedName: "plan", + type: { + name: "Composite", + className: "Plan" } }, - family: { - serializedName: "family", + kind: { + constraints: { + Pattern: new RegExp("^[-\\w\\._,\\(\\)]+$") + }, + serializedName: "kind", + required: true, type: { name: "String" } }, - model: { - serializedName: "model", + managedResourceGroupId: { + serializedName: "properties.managedResourceGroupId", + required: true, type: { name: "String" } }, - capacity: { - serializedName: "capacity", + applicationDefinitionId: { + serializedName: "properties.applicationDefinitionId", type: { - name: "Number" + name: "String" } - } - } - } -}; - -export const Identity: msRest.CompositeMapper = { - serializedName: "Identity", - type: { - name: "Composite", - className: "Identity", - modelProperties: { - principalId: { - readOnly: true, - serializedName: "principalId", + }, + parameters: { + serializedName: "properties.parameters", type: { - name: "String" + name: "Dictionary", + value: { type: { name: "any" } } } }, - tenantId: { + outputs: { + serializedName: "properties.outputs", readOnly: true, - serializedName: "tenantId", type: { - name: "String" + name: "Dictionary", + value: { type: { name: "any" } } } }, - type: { - serializedName: "type", + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, type: { - name: "Enum", - allowedValues: [ - "SystemAssigned" - ] + name: "String" } } } } }; -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", +export const ApplicationPatchable: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ErrorResponse", + className: "ApplicationPatchable", modelProperties: { - httpStatus: { - serializedName: "httpStatus", + ...GenericResource.type.modelProperties, + plan: { + serializedName: "plan", type: { - name: "String" + name: "Composite", + className: "PlanPatchable" } }, - errorCode: { - serializedName: "errorCode", + kind: { + constraints: { + Pattern: new RegExp("^[-\\w\\._,\\(\\)]+$") + }, + serializedName: "kind", type: { name: "String" } }, - errorMessage: { - serializedName: "errorMessage", + managedResourceGroupId: { + serializedName: "properties.managedResourceGroupId", type: { name: "String" } - } - } - } -}; - -export const OperationDisplay: msRest.CompositeMapper = { - serializedName: "Operation_display", - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", + }, + applicationDefinitionId: { + serializedName: "properties.applicationDefinitionId", type: { name: "String" } }, - resource: { - serializedName: "resource", + parameters: { + serializedName: "properties.parameters", type: { - name: "String" + name: "Dictionary", + value: { type: { name: "any" } } } }, - operation: { - serializedName: "operation", + outputs: { + serializedName: "properties.outputs", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, type: { name: "String" } @@ -565,107 +570,81 @@ export const OperationDisplay: msRest.CompositeMapper = { } }; -export const Operation: msRest.CompositeMapper = { - serializedName: "Operation", +export const ApplicationDefinition: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Operation", + className: "ApplicationDefinition", modelProperties: { - name: { - serializedName: "name", + ...GenericResource.type.modelProperties, + lockLevel: { + serializedName: "properties.lockLevel", + required: true, + type: { + name: "Enum", + allowedValues: ["CanNotDelete", "ReadOnly", "None"] + } + }, + displayName: { + serializedName: "properties.displayName", type: { name: "String" } }, - display: { - serializedName: "display", + isEnabled: { + serializedName: "properties.isEnabled", type: { - name: "Composite", - className: "OperationDisplay" + name: "String" } - } - } - } -}; - -export const OperationListResult: msRest.CompositeMapper = { - serializedName: "OperationListResult", - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "", + }, + authorizations: { + serializedName: "properties.authorizations", + required: true, type: { name: "Sequence", element: { type: { name: "Composite", - className: "Operation" + className: "ApplicationProviderAuthorization" } } } }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const ApplianceListResult: msRest.CompositeMapper = { - serializedName: "ApplianceListResult", - type: { - name: "Composite", - className: "ApplianceListResult", - modelProperties: { - value: { - serializedName: "", + artifacts: { + serializedName: "properties.artifacts", type: { name: "Sequence", element: { type: { name: "Composite", - className: "Appliance" + className: "ApplicationArtifact" } } } }, - nextLink: { - serializedName: "nextLink", + description: { + serializedName: "properties.description", type: { name: "String" } - } - } - } -}; - -export const ApplianceDefinitionListResult: msRest.CompositeMapper = { - serializedName: "ApplianceDefinitionListResult", - type: { - name: "Composite", - className: "ApplianceDefinitionListResult", - modelProperties: { - value: { - serializedName: "", + }, + packageFileUri: { + serializedName: "properties.packageFileUri", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ApplianceDefinition" - } - } + name: "String" } }, - nextLink: { - serializedName: "nextLink", + mainTemplate: { + serializedName: "properties.mainTemplate", type: { - name: "String" + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + createUiDefinition: { + serializedName: "properties.createUiDefinition", + type: { + name: "Dictionary", + value: { type: { name: "any" } } } } } diff --git a/sdk/managedapplications/arm-managedapplications/src/models/parameters.ts b/sdk/managedapplications/arm-managedapplications/src/models/parameters.ts index 571c4b265cc8..edf96961fd7c 100644 --- a/sdk/managedapplications/arm-managedapplications/src/models/parameters.ts +++ b/sdk/managedapplications/arm-managedapplications/src/models/parameters.ts @@ -1,118 +1,167 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + Application as ApplicationMapper, + ApplicationPatchable as ApplicationPatchableMapper, + ApplicationDefinition as ApplicationDefinitionMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2018-06-01", + isConstant: true, serializedName: "api-version", type: { name: "String" } } }; -export const applianceDefinitionId: msRest.OperationURLParameter = { - parameterPath: "applianceDefinitionId", + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { + serializedName: "nextLink", required: true, - serializedName: "applianceDefinitionId", type: { name: "String" } }, skipEncoding: true }; -export const applianceDefinitionName: msRest.OperationURLParameter = { - parameterPath: "applianceDefinitionName", + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", mapper: { + constraints: { + Pattern: new RegExp("^[-\\w\\._\\(\\)]+$"), + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", required: true, - serializedName: "applianceDefinitionName", + type: { + name: "String" + } + } +}; + +export const applicationName: OperationURLParameter = { + parameterPath: "applicationName", + mapper: { constraints: { MaxLength: 64, MinLength: 3 }, + serializedName: "applicationName", + required: true, type: { name: "String" } } }; -export const applianceId: msRest.OperationURLParameter = { - parameterPath: "applianceId", + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", mapper: { + serializedName: "subscriptionId", required: true, - serializedName: "applianceId", type: { name: "String" } - }, - skipEncoding: true + } }; -export const applianceName: msRest.OperationURLParameter = { - parameterPath: "applianceName", + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - required: true, - serializedName: "applianceName", - constraints: { - MaxLength: 64, - MinLength: 3 - }, + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: ApplicationMapper +}; + +export const parameters1: OperationParameter = { + parameterPath: ["options", "parameters"], + mapper: ApplicationPatchableMapper +}; + +export const applicationId: OperationURLParameter = { + parameterPath: "applicationId", mapper: { + serializedName: "applicationId", required: true, - serializedName: "nextLink", type: { name: "String" } }, skipEncoding: true }; -export const resourceGroupName: msRest.OperationURLParameter = { - parameterPath: "resourceGroupName", + +export const parameters2: OperationParameter = { + parameterPath: ["options", "parameters"], + mapper: ApplicationMapper +}; + +export const applicationDefinitionName: OperationURLParameter = { + parameterPath: "applicationDefinitionName", mapper: { - required: true, - serializedName: "resourceGroupName", constraints: { - MaxLength: 90, - MinLength: 1, - Pattern: /^[-\w\._\(\)]+$/ + MaxLength: 64, + MinLength: 3 }, - type: { - name: "String" - } - } -}; -export const subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { + serializedName: "applicationDefinitionName", required: true, - serializedName: "subscriptionId", type: { name: "String" } } }; + +export const parameters3: OperationParameter = { + parameterPath: "parameters", + mapper: ApplicationDefinitionMapper +}; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/applianceDefinitions.ts b/sdk/managedapplications/arm-managedapplications/src/operations/applianceDefinitions.ts deleted file mode 100644 index c8143c9644b7..000000000000 --- a/sdk/managedapplications/arm-managedapplications/src/operations/applianceDefinitions.ts +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/applianceDefinitionsMappers"; -import * as Parameters from "../models/parameters"; -import { ManagedApplicationClientContext } from "../managedApplicationClientContext"; - -/** Class representing a ApplianceDefinitions. */ -export class ApplianceDefinitions { - private readonly client: ManagedApplicationClientContext; - - /** - * Create a ApplianceDefinitions. - * @param {ManagedApplicationClientContext} client Reference to the service client. - */ - constructor(client: ManagedApplicationClientContext) { - this.client = client; - } - - /** - * Gets the appliance definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceDefinitionName The name of the appliance definition. - * @param [options] The optional parameters - * @returns Promise - */ - get(resourceGroupName: string, applianceDefinitionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceDefinitionName The name of the appliance definition. - * @param callback The callback - */ - get(resourceGroupName: string, applianceDefinitionName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceDefinitionName The name of the appliance definition. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, applianceDefinitionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, applianceDefinitionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - applianceDefinitionName, - options - }, - getOperationSpec, - callback) as Promise; - } - - /** - * Deletes the appliance definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceDefinitionName The name of the appliance definition to delete. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(resourceGroupName: string, applianceDefinitionName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,applianceDefinitionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - - /** - * Creates a new appliance definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceDefinitionName The name of the appliance definition. - * @param parameters Parameters supplied to the create or update an appliance definition. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: Models.ApplianceDefinition, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdate(resourceGroupName,applianceDefinitionName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Lists the appliance definitions in a resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listByResourceGroupOperationSpec, - callback) as Promise; - } - - /** - * Gets the appliance definition. - * @param applianceDefinitionId The fully qualified ID of the appliance definition, including the - * appliance name and the appliance definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} - * @param [options] The optional parameters - * @returns Promise - */ - getById(applianceDefinitionId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param applianceDefinitionId The fully qualified ID of the appliance definition, including the - * appliance name and the appliance definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} - * @param callback The callback - */ - getById(applianceDefinitionId: string, callback: msRest.ServiceCallback): void; - /** - * @param applianceDefinitionId The fully qualified ID of the appliance definition, including the - * appliance name and the appliance definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} - * @param options The optional parameters - * @param callback The callback - */ - getById(applianceDefinitionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getById(applianceDefinitionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - applianceDefinitionId, - options - }, - getByIdOperationSpec, - callback) as Promise; - } - - /** - * Deletes the appliance definition. - * @param applianceDefinitionId The fully qualified ID of the appliance definition, including the - * appliance name and the appliance definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} - * @param [options] The optional parameters - * @returns Promise - */ - deleteById(applianceDefinitionId: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteById(applianceDefinitionId,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - - /** - * Creates a new appliance definition. - * @param applianceDefinitionId The fully qualified ID of the appliance definition, including the - * appliance name and the appliance definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} - * @param parameters Parameters supplied to the create or update an appliance definition. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdateById(applianceDefinitionId: string, parameters: Models.ApplianceDefinition, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdateById(applianceDefinitionId,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Deletes the appliance definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceDefinitionName The name of the appliance definition to delete. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod(resourceGroupName: string, applianceDefinitionName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - applianceDefinitionName, - options - }, - beginDeleteMethodOperationSpec, - options); - } - - /** - * Creates a new appliance definition. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceDefinitionName The name of the appliance definition. - * @param parameters Parameters supplied to the create or update an appliance definition. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate(resourceGroupName: string, applianceDefinitionName: string, parameters: Models.ApplianceDefinition, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - applianceDefinitionName, - parameters, - options - }, - beginCreateOrUpdateOperationSpec, - options); - } - - /** - * Deletes the appliance definition. - * @param applianceDefinitionId The fully qualified ID of the appliance definition, including the - * appliance name and the appliance definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteById(applianceDefinitionId: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - applianceDefinitionId, - options - }, - beginDeleteByIdOperationSpec, - options); - } - - /** - * Creates a new appliance definition. - * @param applianceDefinitionId The fully qualified ID of the appliance definition, including the - * appliance name and the appliance definition resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name} - * @param parameters Parameters supplied to the create or update an appliance definition. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdateById(applianceDefinitionId: string, parameters: Models.ApplianceDefinition, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - applianceDefinitionId, - parameters, - options - }, - beginCreateOrUpdateByIdOperationSpec, - options); - } - - /** - * Lists the appliance definitions in a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByResourceGroupNextOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applianceDefinitions/{applianceDefinitionName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.applianceDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApplianceDefinition - }, - 404: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applianceDefinitions", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApplianceDefinitionListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const getByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "{applianceDefinitionId}", - urlParameters: [ - Parameters.applianceDefinitionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApplianceDefinition - }, - 404: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applianceDefinitions/{applianceDefinitionName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.applianceDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applianceDefinitions/{applianceDefinitionName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.applianceDefinitionName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.ApplianceDefinition, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.ApplianceDefinition - }, - 201: { - bodyMapper: Mappers.ApplianceDefinition - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginDeleteByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "{applianceDefinitionId}", - urlParameters: [ - Parameters.applianceDefinitionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginCreateOrUpdateByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "{applianceDefinitionId}", - urlParameters: [ - Parameters.applianceDefinitionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.ApplianceDefinition, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.ApplianceDefinition - }, - 201: { - bodyMapper: Mappers.ApplianceDefinition - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApplianceDefinitionListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/appliances.ts b/sdk/managedapplications/arm-managedapplications/src/operations/appliances.ts deleted file mode 100644 index 0064b4426553..000000000000 --- a/sdk/managedapplications/arm-managedapplications/src/operations/appliances.ts +++ /dev/null @@ -1,716 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/appliancesMappers"; -import * as Parameters from "../models/parameters"; -import { ManagedApplicationClientContext } from "../managedApplicationClientContext"; - -/** Class representing a Appliances. */ -export class Appliances { - private readonly client: ManagedApplicationClientContext; - - /** - * Create a Appliances. - * @param {ManagedApplicationClientContext} client Reference to the service client. - */ - constructor(client: ManagedApplicationClientContext) { - this.client = client; - } - - /** - * Gets the appliance. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param [options] The optional parameters - * @returns Promise - */ - get(resourceGroupName: string, applianceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param callback The callback - */ - get(resourceGroupName: string, applianceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, applianceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, applianceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - applianceName, - options - }, - getOperationSpec, - callback) as Promise; - } - - /** - * Deletes the appliance. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(resourceGroupName: string, applianceName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,applianceName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - - /** - * Creates a new appliance. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param parameters Parameters supplied to the create or update an appliance. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate(resourceGroupName: string, applianceName: string, parameters: Models.Appliance, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdate(resourceGroupName,applianceName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Updates an existing appliance. The only value that can be updated via PATCH currently is the - * tags. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param [options] The optional parameters - * @returns Promise - */ - update(resourceGroupName: string, applianceName: string, options?: Models.AppliancesUpdateOptionalParams): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param callback The callback - */ - update(resourceGroupName: string, applianceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param options The optional parameters - * @param callback The callback - */ - update(resourceGroupName: string, applianceName: string, options: Models.AppliancesUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, applianceName: string, options?: Models.AppliancesUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - applianceName, - options - }, - updateOperationSpec, - callback) as Promise; - } - - /** - * Gets all the appliances within a resource group. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listByResourceGroupOperationSpec, - callback) as Promise; - } - - /** - * Gets all the appliances within a subscription. - * @param [options] The optional parameters - * @returns Promise - */ - listBySubscription(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listBySubscription(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listBySubscription(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBySubscription(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listBySubscriptionOperationSpec, - callback) as Promise; - } - - /** - * Gets the appliance. - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param [options] The optional parameters - * @returns Promise - */ - getById(applianceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param callback The callback - */ - getById(applianceId: string, callback: msRest.ServiceCallback): void; - /** - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param options The optional parameters - * @param callback The callback - */ - getById(applianceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getById(applianceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - applianceId, - options - }, - getByIdOperationSpec, - callback) as Promise; - } - - /** - * Deletes the appliance. - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param [options] The optional parameters - * @returns Promise - */ - deleteById(applianceId: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteById(applianceId,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - - /** - * Creates a new appliance. - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param parameters Parameters supplied to the create or update an appliance. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdateById(applianceId: string, parameters: Models.Appliance, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdateById(applianceId,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Updates an existing appliance. The only value that can be updated via PATCH currently is the - * tags. - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param [options] The optional parameters - * @returns Promise - */ - updateById(applianceId: string, options?: Models.AppliancesUpdateByIdOptionalParams): Promise; - /** - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param callback The callback - */ - updateById(applianceId: string, callback: msRest.ServiceCallback): void; - /** - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param options The optional parameters - * @param callback The callback - */ - updateById(applianceId: string, options: Models.AppliancesUpdateByIdOptionalParams, callback: msRest.ServiceCallback): void; - updateById(applianceId: string, options?: Models.AppliancesUpdateByIdOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - applianceId, - options - }, - updateByIdOperationSpec, - callback) as Promise; - } - - /** - * Deletes the appliance. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod(resourceGroupName: string, applianceName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - applianceName, - options - }, - beginDeleteMethodOperationSpec, - options); - } - - /** - * Creates a new appliance. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param applianceName The name of the appliance. - * @param parameters Parameters supplied to the create or update an appliance. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate(resourceGroupName: string, applianceName: string, parameters: Models.Appliance, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - applianceName, - parameters, - options - }, - beginCreateOrUpdateOperationSpec, - options); - } - - /** - * Deletes the appliance. - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteById(applianceId: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - applianceId, - options - }, - beginDeleteByIdOperationSpec, - options); - } - - /** - * Creates a new appliance. - * @param applianceId The fully qualified ID of the appliance, including the appliance name and the - * appliance resource type. Use the format, - * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/appliances/{appliance-name} - * @param parameters Parameters supplied to the create or update an appliance. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdateById(applianceId: string, parameters: Models.Appliance, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - applianceId, - parameters, - options - }, - beginCreateOrUpdateByIdOperationSpec, - options); - } - - /** - * Gets all the appliances within a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByResourceGroupNextOperationSpec, - callback) as Promise; - } - - /** - * Gets all the appliances within a subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listBySubscriptionNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listBySubscriptionNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listBySubscriptionNextOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances/{applianceName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.applianceName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.Appliance - }, - 404: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const updateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances/{applianceName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.applianceName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "parameters" - ], - mapper: Mappers.Appliance - }, - responses: { - 200: { - bodyMapper: Mappers.Appliance - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApplianceListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const listBySubscriptionOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Solutions/appliances", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApplianceListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const getByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "{applianceId}", - urlParameters: [ - Parameters.applianceId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.Appliance - }, - 404: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const updateByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "{applianceId}", - urlParameters: [ - Parameters.applianceId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "parameters" - ], - mapper: Mappers.Appliance - }, - responses: { - 200: { - bodyMapper: Mappers.Appliance - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances/{applianceName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.applianceName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/appliances/{applianceName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.applianceName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.Appliance, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.Appliance - }, - 201: { - bodyMapper: Mappers.Appliance - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginDeleteByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "{applianceId}", - urlParameters: [ - Parameters.applianceId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const beginCreateOrUpdateByIdOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "{applianceId}", - urlParameters: [ - Parameters.applianceId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.Appliance, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.Appliance - }, - 201: { - bodyMapper: Mappers.Appliance - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApplianceListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApplianceListResult - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/applicationDefinitions.ts b/sdk/managedapplications/arm-managedapplications/src/operations/applicationDefinitions.ts new file mode 100644 index 000000000000..0ed8878976e6 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/operations/applicationDefinitions.ts @@ -0,0 +1,810 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ApplicationDefinitions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ApplicationClientContext } from "../applicationClientContext"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { LroEngine } from "../lro"; +import { CoreClientLro, shouldDeserializeLro } from "../coreClientLro"; +import { + ApplicationDefinition, + ApplicationDefinitionsListByResourceGroupNextOptionalParams, + ApplicationDefinitionsListByResourceGroupOptionalParams, + ApplicationDefinitionsListByResourceGroupNextNextOptionalParams, + ApplicationDefinitionsGetOptionalParams, + ApplicationDefinitionsGetResponse, + ApplicationDefinitionsDeleteOptionalParams, + ApplicationDefinitionsCreateOrUpdateOptionalParams, + ApplicationDefinitionsCreateOrUpdateResponse, + ApplicationDefinitionsListByResourceGroupResponse, + ApplicationDefinitionsGetByIdOptionalParams, + ApplicationDefinitionsGetByIdResponse, + ApplicationDefinitionsDeleteByIdOptionalParams, + ApplicationDefinitionsCreateOrUpdateByIdOptionalParams, + ApplicationDefinitionsCreateOrUpdateByIdResponse, + ApplicationDefinitionsListByResourceGroupNextResponse, + ApplicationDefinitionsListByResourceGroupNextNextResponse +} from "../models"; + +/// +/** Class representing a ApplicationDefinitions. */ +export class ApplicationDefinitionsImpl implements ApplicationDefinitions { + private readonly client: ApplicationClientContext; + + /** + * Initialize a new instance of the class ApplicationDefinitions class. + * @param client Reference to the service client + */ + constructor(client: ApplicationClientContext) { + this.client = client; + } + + /** + * Lists the managed application definitions in a 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?: ApplicationDefinitionsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: ApplicationDefinitionsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: ApplicationDefinitionsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * 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. + */ + public listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: ApplicationDefinitionsListByResourceGroupNextOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupNextPagingAll( + resourceGroupName, + nextLink, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupNextPagingPage( + resourceGroupName, + nextLink, + options + ); + } + }; + } + + private async *listByResourceGroupNextPagingPage( + resourceGroupName: string, + nextLink: string, + options?: ApplicationDefinitionsListByResourceGroupNextOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroupNext( + resourceGroupName, + nextLink, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNextNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupNextPagingAll( + resourceGroupName: string, + nextLink: string, + options?: ApplicationDefinitionsListByResourceGroupNextOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupNextPagingPage( + resourceGroupName, + nextLink, + options + )) { + yield* page; + } + } + + /** + * Gets the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, applicationDefinitionName, options }, + getOperationSpec + ); + } + + /** + * Deletes the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition to delete. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new CoreClientLro( + sendOperation, + { resourceGroupName, applicationDefinitionName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { intervalInMs: options?.updateIntervalInMs }); + } + + /** + * Deletes the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition to delete. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + applicationDefinitionName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Creates a new managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + applicationDefinitionName: string, + parameters: ApplicationDefinition, + options?: ApplicationDefinitionsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ApplicationDefinitionsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new CoreClientLro( + sendOperation, + { resourceGroupName, applicationDefinitionName, parameters, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { intervalInMs: options?.updateIntervalInMs }); + } + + /** + * Creates a new managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + applicationDefinitionName: string, + parameters: ApplicationDefinition, + options?: ApplicationDefinitionsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + applicationDefinitionName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Lists the managed application definitions in a 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?: ApplicationDefinitionsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Gets the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param options The options parameters. + */ + getById( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsGetByIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, applicationDefinitionName, options }, + getByIdOperationSpec + ); + } + + /** + * Deletes the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param options The options parameters. + */ + async beginDeleteById( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsDeleteByIdOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new CoreClientLro( + sendOperation, + { resourceGroupName, applicationDefinitionName, options }, + deleteByIdOperationSpec + ); + return new LroEngine(lro, { intervalInMs: options?.updateIntervalInMs }); + } + + /** + * Deletes the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param options The options parameters. + */ + async beginDeleteByIdAndWait( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsDeleteByIdOptionalParams + ): Promise { + const poller = await this.beginDeleteById( + resourceGroupName, + applicationDefinitionName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Creates a new managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update a managed application definition. + * @param options The options parameters. + */ + async beginCreateOrUpdateById( + resourceGroupName: string, + applicationDefinitionName: string, + parameters: ApplicationDefinition, + options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ApplicationDefinitionsCreateOrUpdateByIdResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new CoreClientLro( + sendOperation, + { resourceGroupName, applicationDefinitionName, parameters, options }, + createOrUpdateByIdOperationSpec + ); + return new LroEngine(lro, { intervalInMs: options?.updateIntervalInMs }); + } + + /** + * Creates a new managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update a managed application definition. + * @param options The options parameters. + */ + async beginCreateOrUpdateByIdAndWait( + resourceGroupName: string, + applicationDefinitionName: string, + parameters: ApplicationDefinition, + options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdateById( + resourceGroupName, + applicationDefinitionName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * 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?: ApplicationDefinitionsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } + + /** + * ListByResourceGroupNextNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroupNext + * method. + * @param options The options parameters. + */ + private _listByResourceGroupNextNext( + resourceGroupName: string, + nextLink: string, + options?: ApplicationDefinitionsListByResourceGroupNextNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationDefinition + }, + 404: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.applicationDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.applicationDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ApplicationDefinition + }, + 201: { + bodyMapper: Mappers.ApplicationDefinition + }, + 202: { + bodyMapper: Mappers.ApplicationDefinition + }, + 204: { + bodyMapper: Mappers.ApplicationDefinition + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.applicationDefinitionName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationDefinitionListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const getByIdOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationDefinition + }, + 404: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.applicationDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteByIdOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.applicationDefinitionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateByIdOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ApplicationDefinition + }, + 201: { + bodyMapper: Mappers.ApplicationDefinition + }, + 202: { + bodyMapper: Mappers.ApplicationDefinition + }, + 204: { + bodyMapper: Mappers.ApplicationDefinition + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.applicationDefinitionName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationDefinitionListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationDefinitionListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/applications.ts b/sdk/managedapplications/arm-managedapplications/src/operations/applications.ts new file mode 100644 index 000000000000..ec94d159b0f7 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/operations/applications.ts @@ -0,0 +1,1069 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Applications } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ApplicationClientContext } from "../applicationClientContext"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { LroEngine } from "../lro"; +import { CoreClientLro, shouldDeserializeLro } from "../coreClientLro"; +import { + Application, + ApplicationsListByResourceGroupNextOptionalParams, + ApplicationsListByResourceGroupOptionalParams, + ApplicationsListBySubscriptionNextOptionalParams, + ApplicationsListBySubscriptionOptionalParams, + ApplicationsListByResourceGroupNextNextOptionalParams, + ApplicationsListBySubscriptionNextNextOptionalParams, + ApplicationsGetOptionalParams, + ApplicationsGetResponse, + ApplicationsDeleteOptionalParams, + ApplicationsCreateOrUpdateOptionalParams, + ApplicationsCreateOrUpdateResponse, + ApplicationsUpdateOptionalParams, + ApplicationsUpdateResponse, + ApplicationsListByResourceGroupResponse, + ApplicationsListBySubscriptionResponse, + ApplicationsGetByIdOptionalParams, + ApplicationsGetByIdResponse, + ApplicationsDeleteByIdOptionalParams, + ApplicationsCreateOrUpdateByIdOptionalParams, + ApplicationsCreateOrUpdateByIdResponse, + ApplicationsUpdateByIdOptionalParams, + ApplicationsUpdateByIdResponse, + ApplicationsListByResourceGroupNextResponse, + ApplicationsListBySubscriptionNextResponse, + ApplicationsListByResourceGroupNextNextResponse, + ApplicationsListBySubscriptionNextNextResponse +} from "../models"; + +/// +/** Class representing a Applications. */ +export class ApplicationsImpl implements Applications { + private readonly client: ApplicationClientContext; + + /** + * Initialize a new instance of the class Applications class. + * @param client Reference to the service client + */ + constructor(client: ApplicationClientContext) { + this.client = client; + } + + /** + * Gets all the applications within a 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?: ApplicationsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: ApplicationsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: ApplicationsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Gets all the applications within a subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: ApplicationsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: ApplicationsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listBySubscriptionPagingAll( + options?: ApplicationsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * 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. + */ + public listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: ApplicationsListByResourceGroupNextOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupNextPagingAll( + resourceGroupName, + nextLink, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupNextPagingPage( + resourceGroupName, + nextLink, + options + ); + } + }; + } + + private async *listByResourceGroupNextPagingPage( + resourceGroupName: string, + nextLink: string, + options?: ApplicationsListByResourceGroupNextOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroupNext( + resourceGroupName, + nextLink, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNextNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupNextPagingAll( + resourceGroupName: string, + nextLink: string, + options?: ApplicationsListByResourceGroupNextOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupNextPagingPage( + resourceGroupName, + nextLink, + options + )) { + yield* page; + } + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + public listBySubscriptionNext( + nextLink: string, + options?: ApplicationsListBySubscriptionNextOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionNextPagingAll(nextLink, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionNextPagingPage(nextLink, options); + } + }; + } + + private async *listBySubscriptionNextPagingPage( + nextLink: string, + options?: ApplicationsListBySubscriptionNextOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscriptionNext(nextLink, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBySubscriptionNextNext( + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listBySubscriptionNextPagingAll( + nextLink: string, + options?: ApplicationsListBySubscriptionNextOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionNextPagingPage( + nextLink, + options + )) { + yield* page; + } + } + + /** + * Gets the managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + applicationName: string, + options?: ApplicationsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, applicationName, options }, + getOperationSpec + ); + } + + /** + * Deletes the managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + applicationName: string, + options?: ApplicationsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new CoreClientLro( + sendOperation, + { resourceGroupName, applicationName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { intervalInMs: options?.updateIntervalInMs }); + } + + /** + * Deletes the managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + applicationName: string, + options?: ApplicationsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + applicationName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Creates a new managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + applicationName: string, + parameters: Application, + options?: ApplicationsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ApplicationsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new CoreClientLro( + sendOperation, + { resourceGroupName, applicationName, parameters, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { intervalInMs: options?.updateIntervalInMs }); + } + + /** + * Creates a new managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + applicationName: string, + parameters: Application, + options?: ApplicationsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + applicationName, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is + * the tags. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + applicationName: string, + options?: ApplicationsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, applicationName, options }, + updateOperationSpec + ); + } + + /** + * Gets all the applications within a 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?: ApplicationsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Gets all the applications within a subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: ApplicationsListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Gets the managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param options The options parameters. + */ + getById( + applicationId: string, + options?: ApplicationsGetByIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { applicationId, options }, + getByIdOperationSpec + ); + } + + /** + * Deletes the managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param options The options parameters. + */ + async beginDeleteById( + applicationId: string, + options?: ApplicationsDeleteByIdOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new CoreClientLro( + sendOperation, + { applicationId, options }, + deleteByIdOperationSpec + ); + return new LroEngine(lro, { intervalInMs: options?.updateIntervalInMs }); + } + + /** + * Deletes the managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param options The options parameters. + */ + async beginDeleteByIdAndWait( + applicationId: string, + options?: ApplicationsDeleteByIdOptionalParams + ): Promise { + const poller = await this.beginDeleteById(applicationId, options); + return poller.pollUntilDone(); + } + + /** + * Creates a new managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param parameters Parameters supplied to the create or update a managed application. + * @param options The options parameters. + */ + async beginCreateOrUpdateById( + applicationId: string, + parameters: Application, + options?: ApplicationsCreateOrUpdateByIdOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ApplicationsCreateOrUpdateByIdResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new CoreClientLro( + sendOperation, + { applicationId, parameters, options }, + createOrUpdateByIdOperationSpec + ); + return new LroEngine(lro, { intervalInMs: options?.updateIntervalInMs }); + } + + /** + * Creates a new managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param parameters Parameters supplied to the create or update a managed application. + * @param options The options parameters. + */ + async beginCreateOrUpdateByIdAndWait( + applicationId: string, + parameters: Application, + options?: ApplicationsCreateOrUpdateByIdOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdateById( + applicationId, + parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is + * the tags. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param options The options parameters. + */ + updateById( + applicationId: string, + options?: ApplicationsUpdateByIdOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { applicationId, options }, + updateByIdOperationSpec + ); + } + + /** + * 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?: ApplicationsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: ApplicationsListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNextNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroupNext + * method. + * @param options The options parameters. + */ + private _listByResourceGroupNextNext( + resourceGroupName: string, + nextLink: string, + options?: ApplicationsListByResourceGroupNextNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextNextOperationSpec + ); + } + + /** + * ListBySubscriptionNextNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscriptionNext method. + * @param options The options parameters. + */ + private _listBySubscriptionNextNext( + nextLink: string, + options?: ApplicationsListBySubscriptionNextNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Application + }, + 404: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.applicationName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.applicationName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Application + }, + 201: { + bodyMapper: Mappers.Application + }, + 202: { + bodyMapper: Mappers.Application + }, + 204: { + bodyMapper: Mappers.Application + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.applicationName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Application + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.applicationName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applications", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const getByIdOperationSpec: coreClient.OperationSpec = { + path: "/{applicationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Application + }, + 404: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.applicationId], + headerParameters: [Parameters.accept], + serializer +}; +const deleteByIdOperationSpec: coreClient.OperationSpec = { + path: "/{applicationId}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.applicationId], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateByIdOperationSpec: coreClient.OperationSpec = { + path: "/{applicationId}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Application + }, + 201: { + bodyMapper: Mappers.Application + }, + 202: { + bodyMapper: Mappers.Application + }, + 204: { + bodyMapper: Mappers.Application + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.applicationId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateByIdOperationSpec: coreClient.OperationSpec = { + path: "/{applicationId}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Application + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.applicationId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApplicationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/managedapplications/arm-managedapplications/src/operations/index.ts b/sdk/managedapplications/arm-managedapplications/src/operations/index.ts index 50be9cad72d1..6ca98c210b1c 100644 --- a/sdk/managedapplications/arm-managedapplications/src/operations/index.ts +++ b/sdk/managedapplications/arm-managedapplications/src/operations/index.ts @@ -1,12 +1,10 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export * from "./appliances"; -export * from "./applianceDefinitions"; +export * from "./applications"; +export * from "./applicationDefinitions"; diff --git a/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applicationDefinitions.ts b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applicationDefinitions.ts new file mode 100644 index 000000000000..5b820ced60a3 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applicationDefinitions.ts @@ -0,0 +1,179 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ApplicationDefinition, + ApplicationDefinitionsListByResourceGroupNextOptionalParams, + ApplicationDefinitionsListByResourceGroupOptionalParams, + ApplicationDefinitionsGetOptionalParams, + ApplicationDefinitionsGetResponse, + ApplicationDefinitionsDeleteOptionalParams, + ApplicationDefinitionsCreateOrUpdateOptionalParams, + ApplicationDefinitionsCreateOrUpdateResponse, + ApplicationDefinitionsGetByIdOptionalParams, + ApplicationDefinitionsGetByIdResponse, + ApplicationDefinitionsDeleteByIdOptionalParams, + ApplicationDefinitionsCreateOrUpdateByIdOptionalParams, + ApplicationDefinitionsCreateOrUpdateByIdResponse +} from "../models"; + +/// +/** Interface representing a ApplicationDefinitions. */ +export interface ApplicationDefinitions { + /** + * Lists the managed application definitions in a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: ApplicationDefinitionsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * 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. + */ + listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: ApplicationDefinitionsListByResourceGroupNextOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsGetOptionalParams + ): Promise; + /** + * Deletes the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition to delete. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition to delete. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsDeleteOptionalParams + ): Promise; + /** + * Creates a new managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + applicationDefinitionName: string, + parameters: ApplicationDefinition, + options?: ApplicationDefinitionsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ApplicationDefinitionsCreateOrUpdateResponse + > + >; + /** + * Creates a new managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update an managed application definition. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + applicationDefinitionName: string, + parameters: ApplicationDefinition, + options?: ApplicationDefinitionsCreateOrUpdateOptionalParams + ): Promise; + /** + * Gets the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param options The options parameters. + */ + getById( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsGetByIdOptionalParams + ): Promise; + /** + * Deletes the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param options The options parameters. + */ + beginDeleteById( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsDeleteByIdOptionalParams + ): Promise, void>>; + /** + * Deletes the managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param options The options parameters. + */ + beginDeleteByIdAndWait( + resourceGroupName: string, + applicationDefinitionName: string, + options?: ApplicationDefinitionsDeleteByIdOptionalParams + ): Promise; + /** + * Creates a new managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update a managed application definition. + * @param options The options parameters. + */ + beginCreateOrUpdateById( + resourceGroupName: string, + applicationDefinitionName: string, + parameters: ApplicationDefinition, + options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ApplicationDefinitionsCreateOrUpdateByIdResponse + > + >; + /** + * Creates a new managed application definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationDefinitionName The name of the managed application definition. + * @param parameters Parameters supplied to the create or update a managed application definition. + * @param options The options parameters. + */ + beginCreateOrUpdateByIdAndWait( + resourceGroupName: string, + applicationDefinitionName: string, + parameters: ApplicationDefinition, + options?: ApplicationDefinitionsCreateOrUpdateByIdOptionalParams + ): Promise; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applications.ts b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applications.ts new file mode 100644 index 000000000000..59c44ebd3293 --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/applications.ts @@ -0,0 +1,225 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 "@azure/core-paging"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + Application, + ApplicationsListByResourceGroupNextOptionalParams, + ApplicationsListByResourceGroupOptionalParams, + ApplicationsListBySubscriptionNextOptionalParams, + ApplicationsListBySubscriptionOptionalParams, + ApplicationsGetOptionalParams, + ApplicationsGetResponse, + ApplicationsDeleteOptionalParams, + ApplicationsCreateOrUpdateOptionalParams, + ApplicationsCreateOrUpdateResponse, + ApplicationsUpdateOptionalParams, + ApplicationsUpdateResponse, + ApplicationsGetByIdOptionalParams, + ApplicationsGetByIdResponse, + ApplicationsDeleteByIdOptionalParams, + ApplicationsCreateOrUpdateByIdOptionalParams, + ApplicationsCreateOrUpdateByIdResponse, + ApplicationsUpdateByIdOptionalParams, + ApplicationsUpdateByIdResponse +} from "../models"; + +/// +/** Interface representing a Applications. */ +export interface Applications { + /** + * Gets all the applications within a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: ApplicationsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets all the applications within a subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: ApplicationsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * 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. + */ + listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: ApplicationsListByResourceGroupNextOptionalParams + ): PagedAsyncIterableIterator; + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + listBySubscriptionNext( + nextLink: string, + options?: ApplicationsListBySubscriptionNextOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + applicationName: string, + options?: ApplicationsGetOptionalParams + ): Promise; + /** + * Deletes the managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + applicationName: string, + options?: ApplicationsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes the managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + applicationName: string, + options?: ApplicationsDeleteOptionalParams + ): Promise; + /** + * Creates a new managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + applicationName: string, + parameters: Application, + options?: ApplicationsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ApplicationsCreateOrUpdateResponse + > + >; + /** + * Creates a new managed application. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param parameters Parameters supplied to the create or update a managed application. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + applicationName: string, + parameters: Application, + options?: ApplicationsCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is + * the tags. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationName The name of the managed application. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + applicationName: string, + options?: ApplicationsUpdateOptionalParams + ): Promise; + /** + * Gets the managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param options The options parameters. + */ + getById( + applicationId: string, + options?: ApplicationsGetByIdOptionalParams + ): Promise; + /** + * Deletes the managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param options The options parameters. + */ + beginDeleteById( + applicationId: string, + options?: ApplicationsDeleteByIdOptionalParams + ): Promise, void>>; + /** + * Deletes the managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param options The options parameters. + */ + beginDeleteByIdAndWait( + applicationId: string, + options?: ApplicationsDeleteByIdOptionalParams + ): Promise; + /** + * Creates a new managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param parameters Parameters supplied to the create or update a managed application. + * @param options The options parameters. + */ + beginCreateOrUpdateById( + applicationId: string, + parameters: Application, + options?: ApplicationsCreateOrUpdateByIdOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ApplicationsCreateOrUpdateByIdResponse + > + >; + /** + * Creates a new managed application. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param parameters Parameters supplied to the create or update a managed application. + * @param options The options parameters. + */ + beginCreateOrUpdateByIdAndWait( + applicationId: string, + parameters: Application, + options?: ApplicationsCreateOrUpdateByIdOptionalParams + ): Promise; + /** + * Updates an existing managed application. The only value that can be updated via PATCH currently is + * the tags. + * @param applicationId The fully qualified ID of the managed application, including the managed + * application name and the managed application resource type. Use the format, + * /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applications/{application-name} + * @param options The options parameters. + */ + updateById( + applicationId: string, + options?: ApplicationsUpdateByIdOptionalParams + ): Promise; +} diff --git a/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/index.ts b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..6ca98c210b1c --- /dev/null +++ b/sdk/managedapplications/arm-managedapplications/src/operationsInterfaces/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the 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 "./applications"; +export * from "./applicationDefinitions"; diff --git a/sdk/managedapplications/arm-managedapplications/tsconfig.json b/sdk/managedapplications/arm-managedapplications/tsconfig.json index 87bbf5b5fa49..0ec8659c8e83 100644 --- a/sdk/managedapplications/arm-managedapplications/tsconfig.json +++ b/sdk/managedapplications/arm-managedapplications/tsconfig.json @@ -3,13 +3,14 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6"], + "preserveConstEnums": true, + "lib": ["es6", "dom"], "declaration": true, "outDir": "./esm", "importHelpers": true diff --git a/sdk/managedapplications/ci.yml b/sdk/managedapplications/ci.yml new file mode 100644 index 000000000000..0021fb744b61 --- /dev/null +++ b/sdk/managedapplications/ci.yml @@ -0,0 +1,28 @@ +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/managedapplications/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/managedapplications/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managedapplications + Artifacts: + - name: azure-arm-managedapplications + safeName: azurearmmanagedapplications + \ No newline at end of file