diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index ba803d4ebe9d..fa1fe29e5b94 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -11,6 +11,7 @@ specifiers: '@rush-temp/app-configuration': file:./projects/app-configuration.tgz '@rush-temp/arm-analysisservices': file:./projects/arm-analysisservices.tgz '@rush-temp/arm-apimanagement': file:./projects/arm-apimanagement.tgz + '@rush-temp/arm-app': file:./projects/arm-app.tgz '@rush-temp/arm-appplatform': file:./projects/arm-appplatform.tgz '@rush-temp/arm-appservice': file:./projects/arm-appservice.tgz '@rush-temp/arm-authorization': file:./projects/arm-authorization.tgz @@ -180,6 +181,7 @@ dependencies: '@rush-temp/app-configuration': file:projects/app-configuration.tgz '@rush-temp/arm-analysisservices': file:projects/arm-analysisservices.tgz '@rush-temp/arm-apimanagement': file:projects/arm-apimanagement.tgz + '@rush-temp/arm-app': file:projects/arm-app.tgz '@rush-temp/arm-appplatform': file:projects/arm-appplatform.tgz '@rush-temp/arm-appservice': file:projects/arm-appservice.tgz '@rush-temp/arm-authorization': file:projects/arm-authorization.tgz @@ -1568,6 +1570,7 @@ packages: /@opentelemetry/node/0.22.0_@opentelemetry+api@1.0.3: resolution: {integrity: sha512-+HhGbDruQ7cwejVOIYyxRa28uosnG8W95NiQZ6qE8PXXPsDSyGeftAPbtYpGit0H2f5hrVcMlwmWHeAo9xkSLA==} engines: {node: '>=8.0.0'} + deprecated: Package renamed to @opentelemetry/sdk-trace-node peerDependencies: '@opentelemetry/api': ^1.0.0 dependencies: @@ -8221,6 +8224,27 @@ packages: uglify-js: 3.14.3 dev: false + file:projects/arm-app.tgz: + resolution: {integrity: sha512-rOzpUnWlrWX6vMTj93nu41IWKORZEcU9ZoIlf9bumjlG5dcx9jptrIlMVG502S8qIRpUzE7Kz9urZsqusF8F5g==, tarball: file:projects/arm-app.tgz} + name: '@rush-temp/arm-app' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.18.19 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.3 + dev: false + file:projects/arm-appplatform.tgz: resolution: {integrity: sha512-Pel4tu/SIfuYKVrehY87LfAoYBiwyuraQp2/PdUzhmuX6p0wXK6BUGEjZj7vC2IAAaI4k/Cnh4QLdMLvRdZUuw==, tarball: file:projects/arm-appplatform.tgz} name: '@rush-temp/arm-appplatform' diff --git a/rush.json b/rush.json index 0bdf615ba0d5..e2c0ee6eacf9 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -1155,6 +1155,11 @@ "packageName": "@azure/arm-relay", "projectFolder": "sdk/relay/arm-relay", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-app", + "projectFolder": "sdk/app/arm-app", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/app/arm-app/CHANGELOG.md b/sdk/app/arm-app/CHANGELOG.md new file mode 100644 index 000000000000..86c09465baeb --- /dev/null +++ b/sdk/app/arm-app/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-12-16) + +- Initial Release diff --git a/sdk/app/arm-app/LICENSE b/sdk/app/arm-app/LICENSE new file mode 100644 index 000000000000..ccb63b166732 --- /dev/null +++ b/sdk/app/arm-app/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +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 +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/app/arm-app/README.md b/sdk/app/arm-app/README.md new file mode 100644 index 000000000000..7a26583212b6 --- /dev/null +++ b/sdk/app/arm-app/README.md @@ -0,0 +1,98 @@ +# Azure ContainerApps API client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ContainerApps API client. + + + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/app/arm-app) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-app) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-app) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-app` package + +Install the Azure ContainerApps API client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-app +``` + +### Create and authenticate a `ContainerAppsAPIClient` + +To create a client object to access the Azure ContainerApps API API, you will need the `endpoint` of your Azure ContainerApps API resource and a `credential`. The Azure ContainerApps API client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure ContainerApps API resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure ContainerApps API** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { ContainerAppsAPIClient } = require("@azure/arm-app"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ContainerAppsAPIClient(new DefaultAzureCredential(), subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### ContainerAppsAPIClient + +`ContainerAppsAPIClient` is the primary interface for developers using the Azure ContainerApps API client library. Explore the methods on this client object to understand the different features of the Azure ContainerApps API service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fapp%2Farm-app%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/app/arm-app/_meta.json b/sdk/app/arm-app/_meta.json new file mode 100644 index 000000000000..cdf2798f277c --- /dev/null +++ b/sdk/app/arm-app/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "d4c6e0d1bd66cb1f5f5b96746642e6d2e9ef7fc1", + "readme": "specification/app/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/app/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" +} \ No newline at end of file diff --git a/sdk/app/arm-app/api-extractor.json b/sdk/app/arm-app/api-extractor.json new file mode 100644 index 000000000000..2c383b624556 --- /dev/null +++ b/sdk/app/arm-app/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-app.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/app/arm-app/package.json b/sdk/app/arm-app/package.json new file mode 100644 index 000000000000..7b3e0a8d8d01 --- /dev/null +++ b/sdk/app/arm-app/package.json @@ -0,0 +1,92 @@ +{ + "name": "@azure/arm-app", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for ContainerAppsAPIClient.", + "version": "1.0.0-beta.1", + "engines": { "node": ">=12.0.0" }, + "dependencies": { + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" + }, + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-app.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", + "rollup-plugin-sourcemaps": "^0.4.2", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/app/arm-app", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/app/arm-app/review/arm-app.api.md b/sdk/app/arm-app/review/arm-app.api.md new file mode 100644 index 000000000000..624031352435 --- /dev/null +++ b/sdk/app/arm-app/review/arm-app.api.md @@ -0,0 +1,624 @@ +## API Report File for "@azure/arm-app" + +> 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 ActiveRevisionsMode = string; + +// @public +export interface AppLogsConfiguration { + destination?: string; + logAnalyticsConfiguration?: LogAnalyticsConfiguration; +} + +// @public +export interface AvailableOperations { + nextLink?: string; + value?: OperationDetail[]; +} + +// @public +export interface Configuration { + activeRevisionsMode?: ActiveRevisionsMode; + ingress?: Ingress; + registries?: RegistryCredentials[]; + secrets?: Secret[]; +} + +// @public +export interface Container { + args?: string[]; + command?: string[]; + env?: EnvironmentVar[]; + image?: string; + name?: string; + resources?: ContainerResources; +} + +// @public +export type ContainerApp = TrackedResource & { + readonly provisioningState?: ContainerAppProvisioningState; + managedEnvironmentId?: string; + readonly latestRevisionName?: string; + readonly latestRevisionFqdn?: string; + configuration?: Configuration; + template?: Template; +}; + +// @public +export interface ContainerAppCollection { + readonly nextLink?: string; + value: ContainerApp[]; +} + +// @public +export interface ContainerAppPatch { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type ContainerAppProvisioningState = string; + +// @public +export interface ContainerApps { + beginCreateOrUpdate(resourceGroupName: string, name: string, containerAppEnvelope: ContainerApp, options?: ContainerAppsCreateOrUpdateOptionalParams): Promise, ContainerAppsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, name: string, containerAppEnvelope: ContainerApp, options?: ContainerAppsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, name: string, options?: ContainerAppsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, name: string, options?: ContainerAppsDeleteOptionalParams): Promise; + get(resourceGroupName: string, name: string, options?: ContainerAppsGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: ContainerAppsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: ContainerAppsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, name: string, containerAppEnvelope: ContainerAppPatch, options?: ContainerAppsUpdateOptionalParams): Promise; +} + +// @public (undocumented) +export class ContainerAppsAPIClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ContainerAppsAPIClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + containerApps: ContainerApps; + // (undocumented) + containerAppsRevisions: ContainerAppsRevisions; + // (undocumented) + managedEnvironments: ManagedEnvironments; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface ContainerAppsAPIClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface ContainerAppsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ContainerAppsCreateOrUpdateResponse = ContainerApp; + +// @public +export interface ContainerAppsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ContainerAppsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsGetResponse = ContainerApp; + +// @public +export interface ContainerAppsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsListByResourceGroupNextResponse = ContainerAppCollection; + +// @public +export interface ContainerAppsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsListByResourceGroupResponse = ContainerAppCollection; + +// @public +export interface ContainerAppsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsListBySubscriptionNextResponse = ContainerAppCollection; + +// @public +export interface ContainerAppsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsListBySubscriptionResponse = ContainerAppCollection; + +// @public +export interface ContainerAppsRevisions { + activateRevision(resourceGroupName: string, containerAppName: string, name: string, options?: ContainerAppsRevisionsActivateRevisionOptionalParams): Promise; + deactivateRevision(resourceGroupName: string, containerAppName: string, name: string, options?: ContainerAppsRevisionsDeactivateRevisionOptionalParams): Promise; + getRevision(resourceGroupName: string, containerAppName: string, name: string, options?: ContainerAppsRevisionsGetRevisionOptionalParams): Promise; + listRevisions(resourceGroupName: string, containerAppName: string, options?: ContainerAppsRevisionsListRevisionsOptionalParams): PagedAsyncIterableIterator; + restartRevision(resourceGroupName: string, containerAppName: string, name: string, options?: ContainerAppsRevisionsRestartRevisionOptionalParams): Promise; +} + +// @public +export interface ContainerAppsRevisionsActivateRevisionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ContainerAppsRevisionsDeactivateRevisionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ContainerAppsRevisionsGetRevisionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsRevisionsGetRevisionResponse = Revision; + +// @public +export interface ContainerAppsRevisionsListRevisionsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsRevisionsListRevisionsNextResponse = RevisionCollection; + +// @public +export interface ContainerAppsRevisionsListRevisionsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsRevisionsListRevisionsResponse = RevisionCollection; + +// @public +export interface ContainerAppsRevisionsRestartRevisionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ContainerAppsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ContainerAppsUpdateResponse = ContainerApp; + +// @public +export interface ContainerResources { + cpu?: number; + memory?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface CustomScaleRule { + auth?: ScaleRuleAuth[]; + metadata?: { + [propertyName: string]: string; + }; + type?: string; +} + +// @public +export interface Dapr { + appId?: string; + appPort?: number; + components?: DaprComponent[]; + enabled?: boolean; +} + +// @public +export interface DaprComponent { + metadata?: DaprMetadata[]; + name?: string; + type?: string; + version?: string; +} + +// @public +export interface DaprMetadata { + name?: string; + secretRef?: string; + value?: string; +} + +// @public +export interface DefaultErrorResponse { + readonly error?: DefaultErrorResponseError; +} + +// @public +export interface DefaultErrorResponseError { + readonly code?: string; + details?: DefaultErrorResponseErrorDetailsItem[]; + readonly innererror?: string; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface DefaultErrorResponseErrorDetailsItem { + readonly code?: string; + readonly message?: string; + readonly target?: string; +} + +// @public +export type EnvironmentProvisioningState = "Succeeded" | "Failed" | "Canceled" | "Waiting" | "InitializationInProgress" | "InfrastructureSetupInProgress" | "InfrastructureSetupComplete" | "ScheduledForDelete" | "UpgradeRequested" | "UpgradeFailed"; + +// @public +export interface EnvironmentVar { + name?: string; + secretRef?: string; + value?: string; +} + +// @public +export interface HttpScaleRule { + auth?: ScaleRuleAuth[]; + metadata?: { + [propertyName: string]: string; + }; +} + +// @public +export interface Ingress { + allowInsecure?: boolean; + external?: boolean; + readonly fqdn?: string; + targetPort?: number; + traffic?: TrafficWeight[]; + transport?: IngressTransportMethod; +} + +// @public +export type IngressTransportMethod = string; + +// @public +export enum KnownActiveRevisionsMode { + // (undocumented) + Multiple = "multiple", + // (undocumented) + Single = "single" +} + +// @public +export enum KnownContainerAppProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Failed = "Failed", + // (undocumented) + InProgress = "InProgress", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownIngressTransportMethod { + // (undocumented) + Auto = "auto", + // (undocumented) + Http = "http", + // (undocumented) + Http2 = "http2" +} + +// @public +export enum KnownRevisionHealthState { + // (undocumented) + Healthy = "Healthy", + // (undocumented) + None = "None", + // (undocumented) + Unhealthy = "Unhealthy" +} + +// @public +export enum KnownRevisionProvisioningState { + // (undocumented) + Deprovisioned = "Deprovisioned", + // (undocumented) + Deprovisioning = "Deprovisioning", + // (undocumented) + Failed = "Failed", + // (undocumented) + Provisioned = "Provisioned", + // (undocumented) + Provisioning = "Provisioning" +} + +// @public +export interface LogAnalyticsConfiguration { + customerId?: string; + sharedKey?: string; +} + +// @public +export type ManagedEnvironment = TrackedResource & { + readonly provisioningState?: EnvironmentProvisioningState; + daprAIInstrumentationKey?: string; + vnetConfiguration?: VnetConfiguration; + readonly deploymentErrors?: string; + internalLoadBalancerEnabled?: boolean; + readonly defaultDomain?: string; + readonly staticIp?: string; + appLogsConfiguration?: AppLogsConfiguration; +}; + +// @public +export interface ManagedEnvironmentPatch { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface ManagedEnvironments { + beginCreateOrUpdate(resourceGroupName: string, name: string, environmentEnvelope: ManagedEnvironment, options?: ManagedEnvironmentsCreateOrUpdateOptionalParams): Promise, ManagedEnvironmentsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, name: string, environmentEnvelope: ManagedEnvironment, options?: ManagedEnvironmentsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, name: string, options?: ManagedEnvironmentsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, name: string, options?: ManagedEnvironmentsDeleteOptionalParams): Promise; + get(resourceGroupName: string, name: string, options?: ManagedEnvironmentsGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: ManagedEnvironmentsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: ManagedEnvironmentsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, name: string, environmentEnvelope: ManagedEnvironmentPatch, options?: ManagedEnvironmentsUpdateOptionalParams): Promise; +} + +// @public +export interface ManagedEnvironmentsCollection { + readonly nextLink?: string; + value: ManagedEnvironment[]; +} + +// @public +export interface ManagedEnvironmentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ManagedEnvironmentsCreateOrUpdateResponse = ManagedEnvironment; + +// @public +export interface ManagedEnvironmentsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface ManagedEnvironmentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedEnvironmentsGetResponse = ManagedEnvironment; + +// @public +export interface ManagedEnvironmentsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedEnvironmentsListByResourceGroupNextResponse = ManagedEnvironmentsCollection; + +// @public +export interface ManagedEnvironmentsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedEnvironmentsListByResourceGroupResponse = ManagedEnvironmentsCollection; + +// @public +export interface ManagedEnvironmentsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedEnvironmentsListBySubscriptionNextResponse = ManagedEnvironmentsCollection; + +// @public +export interface ManagedEnvironmentsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedEnvironmentsListBySubscriptionResponse = ManagedEnvironmentsCollection; + +// @public +export interface ManagedEnvironmentsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ManagedEnvironmentsUpdateResponse = ManagedEnvironment; + +// @public +export interface OperationDetail { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = AvailableOperations; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = AvailableOperations; + +// @public +export type ProxyResource = Resource & {}; + +// @public +export interface QueueScaleRule { + auth?: ScaleRuleAuth[]; + queueLength?: number; + queueName?: string; +} + +// @public +export interface RegistryCredentials { + passwordSecretRef?: string; + server?: string; + username?: string; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export type Revision = ProxyResource & { + readonly createdTime?: Date; + readonly fqdn?: string; + readonly template?: Template; + readonly active?: boolean; + readonly replicas?: number; + readonly trafficWeight?: number; + readonly provisioningError?: string; + readonly healthState?: RevisionHealthState; + readonly provisioningState?: RevisionProvisioningState; +}; + +// @public +export interface RevisionCollection { + readonly nextLink?: string; + value: Revision[]; +} + +// @public +export type RevisionHealthState = string; + +// @public +export type RevisionProvisioningState = string; + +// @public +export interface Scale { + maxReplicas?: number; + minReplicas?: number; + rules?: ScaleRule[]; +} + +// @public +export interface ScaleRule { + azureQueue?: QueueScaleRule; + custom?: CustomScaleRule; + http?: HttpScaleRule; + name?: string; +} + +// @public +export interface ScaleRuleAuth { + secretRef?: string; + triggerParameter?: string; +} + +// @public +export interface Secret { + name?: string; + value?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface Template { + containers?: Container[]; + dapr?: Dapr; + revisionSuffix?: string; + scale?: Scale; +} + +// @public +export type TrackedResource = Resource & { + tags?: { + [propertyName: string]: string; + }; + location: string; +}; + +// @public +export interface TrafficWeight { + latestRevision?: boolean; + revisionName?: string; + weight?: number; +} + +// @public +export interface VnetConfiguration { + dockerBridgeCidr?: string; + infrastructureSubnetResourceId?: string; + platformServiceCidr?: string; + platformServiceDnsIp?: string; + runtimeSubnetResourceName?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/app/arm-app/rollup.config.js b/sdk/app/arm-app/rollup.config.js new file mode 100644 index 000000000000..9be1955eb7f1 --- /dev/null +++ b/sdk/app/arm-app/rollup.config.js @@ -0,0 +1,188 @@ +/* + * 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 + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export 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/app/arm-app/src/containerAppsAPIClient.ts b/sdk/app/arm-app/src/containerAppsAPIClient.ts new file mode 100644 index 000000000000..525feb1045c0 --- /dev/null +++ b/sdk/app/arm-app/src/containerAppsAPIClient.ts @@ -0,0 +1,92 @@ +/* + * 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 { + ContainerAppsImpl, + ContainerAppsRevisionsImpl, + ManagedEnvironmentsImpl, + OperationsImpl +} from "./operations"; +import { + ContainerApps, + ContainerAppsRevisions, + ManagedEnvironments, + Operations +} from "./operationsInterfaces"; +import { ContainerAppsAPIClientOptionalParams } from "./models"; + +export class ContainerAppsAPIClient extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; + + /** + * Initializes a new instance of the ContainerAppsAPIClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Your Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: ContainerAppsAPIClientOptionalParams + ) { + 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: ContainerAppsAPIClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-app/1.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 || "2022-01-01-preview"; + this.containerApps = new ContainerAppsImpl(this); + this.containerAppsRevisions = new ContainerAppsRevisionsImpl(this); + this.managedEnvironments = new ManagedEnvironmentsImpl(this); + this.operations = new OperationsImpl(this); + } + + containerApps: ContainerApps; + containerAppsRevisions: ContainerAppsRevisions; + managedEnvironments: ManagedEnvironments; + operations: Operations; +} diff --git a/sdk/app/arm-app/src/index.ts b/sdk/app/arm-app/src/index.ts new file mode 100644 index 000000000000..895d36c46397 --- /dev/null +++ b/sdk/app/arm-app/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export * from "./models"; +export { ContainerAppsAPIClient } from "./containerAppsAPIClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/app/arm-app/src/lroImpl.ts b/sdk/app/arm-app/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/app/arm-app/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/app/arm-app/src/models/index.ts b/sdk/app/arm-app/src/models/index.ts new file mode 100644 index 000000000000..1a7c16a89f8f --- /dev/null +++ b/sdk/app/arm-app/src/models/index.ts @@ -0,0 +1,854 @@ +/* + * 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"; + +/** Container App collection ARM resource. */ +export interface ContainerAppCollection { + /** Collection of resources. */ + value: ContainerApp[]; + /** + * Link to next page of resources. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Non versioned Container App configuration properties that define the mutable settings of a Container app */ +export interface Configuration { + /** Collection of secrets used by a Container app */ + secrets?: Secret[]; + /** + * ActiveRevisionsMode controls how active revisions are handled for the Container app: + * Multiple: multiple revisions can be active. If no value if provided, this is the defaultSingle: Only one revision can be active at a time. Revision weights can not be used in this mode + */ + activeRevisionsMode?: ActiveRevisionsMode; + /** Ingress configurations. */ + ingress?: Ingress; + /** Collection of private container registry credentials for containers used by the Container app */ + registries?: RegistryCredentials[]; +} + +/** Container App Secret. */ +export interface Secret { + /** Secret Name. */ + name?: string; + /** Secret Value. */ + value?: string; +} + +/** Container App Ingress configuration. */ +export interface Ingress { + /** + * Hostname. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly fqdn?: string; + /** Bool indicating if app exposes an external http endpoint */ + external?: boolean; + /** Target Port in containers for traffic from ingress */ + targetPort?: number; + /** Ingress transport protocol */ + transport?: IngressTransportMethod; + /** Traffic weights for app's revisions */ + traffic?: TrafficWeight[]; + /** Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS connections */ + allowInsecure?: boolean; +} + +/** Traffic weight assigned to a revision */ +export interface TrafficWeight { + /** Name of a revision */ + revisionName?: string; + /** Traffic weight assigned to a revision */ + weight?: number; + /** Indicates that the traffic weight belongs to a latest stable revision */ + latestRevision?: boolean; +} + +/** Container App Private Registry */ +export interface RegistryCredentials { + /** Container Registry Server */ + server?: string; + /** Container Registry Username */ + username?: string; + /** The name of the Secret that contains the registry login password */ + passwordSecretRef?: string; +} + +/** + * Container App versioned application definition. + * Defines the desired state of an immutable revision. + * Any changes to this section Will result in a new revision being created + */ +export interface Template { + /** User friendly suffix that is appended to the revision name */ + revisionSuffix?: string; + /** List of container definitions for the Container App. */ + containers?: Container[]; + /** Scaling properties for the Container App. */ + scale?: Scale; + /** Dapr configuration for the Container App. */ + dapr?: Dapr; +} + +/** Container App container definition. */ +export interface Container { + /** Container image tag. */ + image?: string; + /** Custom container name. */ + name?: string; + /** Container start command. */ + command?: string[]; + /** Container start command arguments. */ + args?: string[]; + /** Container environment variables. */ + env?: EnvironmentVar[]; + /** Container resource requirements. */ + resources?: ContainerResources; +} + +/** Container App container environment variable. */ +export interface EnvironmentVar { + /** Environment variable name. */ + name?: string; + /** Non-secret environment variable value. */ + value?: string; + /** Name of the Container App secret from which to pull the environment variable value. */ + secretRef?: string; +} + +/** Container App container resource requirements. */ +export interface ContainerResources { + /** Required CPU in cores, e.g. 0.5 */ + cpu?: number; + /** Required memory, e.g. "250Mb" */ + memory?: string; +} + +/** Container App scaling configurations. */ +export interface Scale { + /** Optional. Minimum number of container replicas. */ + minReplicas?: number; + /** Optional. Maximum number of container replicas. Defaults to 10 if not set. */ + maxReplicas?: number; + /** Scaling rules. */ + rules?: ScaleRule[]; +} + +/** Container App container scaling rule. */ +export interface ScaleRule { + /** Scale Rule Name */ + name?: string; + /** Azure Queue based scaling. */ + azureQueue?: QueueScaleRule; + /** Custom scale rule. */ + custom?: CustomScaleRule; + /** HTTP requests based scaling. */ + http?: HttpScaleRule; +} + +/** Container App container Azure Queue based scaling rule. */ +export interface QueueScaleRule { + /** Queue name. */ + queueName?: string; + /** Queue length. */ + queueLength?: number; + /** Authentication secrets for the queue scale rule. */ + auth?: ScaleRuleAuth[]; +} + +/** Auth Secrets for Container App Scale Rule */ +export interface ScaleRuleAuth { + /** Name of the Container App secret from which to pull the auth params. */ + secretRef?: string; + /** Trigger Parameter that uses the secret */ + triggerParameter?: string; +} + +/** Container App container Custom scaling rule. */ +export interface CustomScaleRule { + /** + * Type of the custom scale rule + * eg: azure-servicebus, redis etc. + */ + type?: string; + /** Metadata properties to describe custom scale rule. */ + metadata?: { [propertyName: string]: string }; + /** Authentication secrets for the custom scale rule. */ + auth?: ScaleRuleAuth[]; +} + +/** Container App container Custom scaling rule. */ +export interface HttpScaleRule { + /** Metadata properties to describe http scale rule. */ + metadata?: { [propertyName: string]: string }; + /** Authentication secrets for the custom scale rule. */ + auth?: ScaleRuleAuth[]; +} + +/** Container App Dapr configuration. */ +export interface Dapr { + /** Boolean indicating if the Dapr side car is enabled */ + enabled?: boolean; + /** Dapr application identifier */ + appId?: string; + /** Port on which the Dapr side car */ + appPort?: number; + /** Collection of Dapr components */ + components?: DaprComponent[]; +} + +/** Dapr component configuration */ +export interface DaprComponent { + /** Component name */ + name?: string; + /** Component type */ + type?: string; + /** Component version */ + version?: string; + /** Component metadata */ + metadata?: DaprMetadata[]; +} + +/** Container App Dapr component metadata. */ +export interface DaprMetadata { + /** Metadata property name. */ + name?: string; + /** Metadata property value. */ + value?: string; + /** Name of the Container App secret from which to pull the metadata property value. */ + secretRef?: string; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** App Service error response. */ +export interface DefaultErrorResponse { + /** + * Error model. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly error?: DefaultErrorResponseError; +} + +/** Error model. */ +export interface DefaultErrorResponseError { + /** + * Standardized string to programmatically identify the error. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * Detailed error description and debugging information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * Detailed error description and debugging information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** Details or the error */ + details?: DefaultErrorResponseErrorDetailsItem[]; + /** + * More information to debug error. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly innererror?: string; +} + +/** Detailed errors. */ +export interface DefaultErrorResponseErrorDetailsItem { + /** + * Standardized string to programmatically identify the error. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * Detailed error description and debugging information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * Detailed error description and debugging information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; +} + +/** Container App Patch. */ +export interface ContainerAppPatch { + /** Application-specific metadata in the form of key-value pairs. */ + tags?: { [propertyName: string]: string }; +} + +/** Container App Revisions collection ARM resource. */ +export interface RevisionCollection { + /** Collection of resources. */ + value: Revision[]; + /** + * Link to next page of resources. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Collection of Environments */ +export interface ManagedEnvironmentsCollection { + /** Collection of resources. */ + value: ManagedEnvironment[]; + /** + * Link to next page of resources. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Configuration properties for apps environment to join a Virtual Network */ +export interface VnetConfiguration { + /** CIDR notation IP range from which to assign infrastructure service environment IPs. It must not overlap with any Subnet IP ranges. */ + platformServiceCidr?: string; + /** IpAddress in platformService Cidr for internal service DNS server */ + platformServiceDnsIp?: string; + /** Subnet Resource Id for Infrastructure components should be in the same VNET as 'InfrastructureSubnetResourceId'. Must not overlap with ServiceCidr */ + infrastructureSubnetResourceId?: string; + /** Subnet Resource Name to which the ContainerApp Containers are injected into, should be in the same VNET as 'InfrastructureSubnetResourceId'. Must not overlap with ServiceCidr */ + runtimeSubnetResourceName?: string; + /** CIDR notation IP range assigned to the Docker bridge, network. It must not overlap with any Subnet IP ranges or the infrastructure service address range. */ + dockerBridgeCidr?: string; +} + +/** Configuration of application logs */ +export interface AppLogsConfiguration { + /** Logs destination */ + destination?: string; + /** Log Analytics configuration */ + logAnalyticsConfiguration?: LogAnalyticsConfiguration; +} + +/** Log analytics configuration */ +export interface LogAnalyticsConfiguration { + /** Log analytics customer id */ + customerId?: string; + /** Log analytics customer key */ + sharedKey?: string; +} + +/** An environment for hosting container apps */ +export interface ManagedEnvironmentPatch { + /** Application-specific metadata in the form of key-value pairs. */ + tags?: { [propertyName: string]: string }; +} + +/** Available operations of the service */ +export interface AvailableOperations { + /** Collection of available operation details */ + value?: OperationDetail[]; + /** + * URL client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + nextLink?: string; +} + +/** Operation detail payload */ +export interface OperationDetail { + /** Name of the operation */ + name?: string; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; + /** Display of the operation */ + display?: OperationDisplay; + /** Origin of the operation */ + origin?: string; +} + +/** Operation display payload */ +export interface OperationDisplay { + /** Resource provider of the operation */ + provider?: string; + /** Resource of the operation */ + resource?: string; + /** Localized friendly name for the operation */ + operation?: string; + /** Localized friendly description for the operation */ + description?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export type TrackedResource = Resource & { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +}; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export type ProxyResource = Resource & {}; + +/** Container App. */ +export type ContainerApp = TrackedResource & { + /** + * Provisioning state of the Container App. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ContainerAppProvisioningState; + /** Resource ID of the Container App's environment. */ + managedEnvironmentId?: string; + /** + * Name of the latest revision of the Container App. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly latestRevisionName?: string; + /** + * Fully Qualified Domain Name of the latest revision of the Container App. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly latestRevisionFqdn?: string; + /** Non versioned Container App configuration properties. */ + configuration?: Configuration; + /** Container App versioned application definition. */ + template?: Template; +}; + +/** An environment for hosting container apps */ +export type ManagedEnvironment = TrackedResource & { + /** + * Provisioning state of the Environment. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: EnvironmentProvisioningState; + /** Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry */ + daprAIInstrumentationKey?: string; + /** Vnet configuration for the environment */ + vnetConfiguration?: VnetConfiguration; + /** + * Any errors that occurred during deployment or deployment validation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deploymentErrors?: string; + /** Only visible within Vnet/Subnet */ + internalLoadBalancerEnabled?: boolean; + /** + * Default Domain Name for the cluster + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly defaultDomain?: string; + /** + * Static IP of the Environment + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly staticIp?: string; + /** + * Cluster configuration which enables the log daemon to export + * app logs to a destination. Currently only "log-analytics" is + * supported + */ + appLogsConfiguration?: AppLogsConfiguration; +}; + +/** Container App Revision. */ +export type Revision = ProxyResource & { + /** + * Timestamp describing when the revision was created + * by controller + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly createdTime?: Date; + /** + * Fully qualified domain name of the revision + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly fqdn?: string; + /** + * Container App Revision Template with all possible settings and the + * defaults if user did not provide them. The defaults are populated + * as they were at the creation time + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly template?: Template; + /** + * Boolean describing if the Revision is Active + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly active?: boolean; + /** + * Number of pods currently running for this revision + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly replicas?: number; + /** + * Traffic weight assigned to this revision + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly trafficWeight?: number; + /** + * Optional Field - Platform Error Message + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningError?: string; + /** + * Current health State of the revision + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly healthState?: RevisionHealthState; + /** + * Current provisioning State of the revision + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: RevisionProvisioningState; +}; + +/** Known values of {@link ContainerAppProvisioningState} that the service accepts. */ +export enum KnownContainerAppProvisioningState { + InProgress = "InProgress", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled" +} + +/** + * Defines values for ContainerAppProvisioningState. \ + * {@link KnownContainerAppProvisioningState} can be used interchangeably with ContainerAppProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InProgress** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** + */ +export type ContainerAppProvisioningState = string; + +/** Known values of {@link ActiveRevisionsMode} that the service accepts. */ +export enum KnownActiveRevisionsMode { + Multiple = "multiple", + Single = "single" +} + +/** + * Defines values for ActiveRevisionsMode. \ + * {@link KnownActiveRevisionsMode} can be used interchangeably with ActiveRevisionsMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **multiple** \ + * **single** + */ +export type ActiveRevisionsMode = string; + +/** Known values of {@link IngressTransportMethod} that the service accepts. */ +export enum KnownIngressTransportMethod { + Auto = "auto", + Http = "http", + Http2 = "http2" +} + +/** + * Defines values for IngressTransportMethod. \ + * {@link KnownIngressTransportMethod} can be used interchangeably with IngressTransportMethod, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **auto** \ + * **http** \ + * **http2** + */ +export type IngressTransportMethod = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link RevisionHealthState} that the service accepts. */ +export enum KnownRevisionHealthState { + Healthy = "Healthy", + Unhealthy = "Unhealthy", + None = "None" +} + +/** + * Defines values for RevisionHealthState. \ + * {@link KnownRevisionHealthState} can be used interchangeably with RevisionHealthState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Healthy** \ + * **Unhealthy** \ + * **None** + */ +export type RevisionHealthState = string; + +/** Known values of {@link RevisionProvisioningState} that the service accepts. */ +export enum KnownRevisionProvisioningState { + Provisioning = "Provisioning", + Provisioned = "Provisioned", + Failed = "Failed", + Deprovisioning = "Deprovisioning", + Deprovisioned = "Deprovisioned" +} + +/** + * Defines values for RevisionProvisioningState. \ + * {@link KnownRevisionProvisioningState} can be used interchangeably with RevisionProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Provisioning** \ + * **Provisioned** \ + * **Failed** \ + * **Deprovisioning** \ + * **Deprovisioned** + */ +export type RevisionProvisioningState = string; +/** Defines values for EnvironmentProvisioningState. */ +export type EnvironmentProvisioningState = + | "Succeeded" + | "Failed" + | "Canceled" + | "Waiting" + | "InitializationInProgress" + | "InfrastructureSetupInProgress" + | "InfrastructureSetupComplete" + | "ScheduledForDelete" + | "UpgradeRequested" + | "UpgradeFailed"; + +/** Optional parameters. */ +export interface ContainerAppsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type ContainerAppsListBySubscriptionResponse = ContainerAppCollection; + +/** Optional parameters. */ +export interface ContainerAppsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type ContainerAppsListByResourceGroupResponse = ContainerAppCollection; + +/** Optional parameters. */ +export interface ContainerAppsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ContainerAppsGetResponse = ContainerApp; + +/** Optional parameters. */ +export interface ContainerAppsCreateOrUpdateOptionalParams + 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 ContainerAppsCreateOrUpdateResponse = ContainerApp; + +/** Optional parameters. */ +export interface ContainerAppsDeleteOptionalParams + 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 ContainerAppsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ContainerAppsUpdateResponse = ContainerApp; + +/** Optional parameters. */ +export interface ContainerAppsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type ContainerAppsListBySubscriptionNextResponse = ContainerAppCollection; + +/** Optional parameters. */ +export interface ContainerAppsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type ContainerAppsListByResourceGroupNextResponse = ContainerAppCollection; + +/** Optional parameters. */ +export interface ContainerAppsRevisionsListRevisionsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listRevisions operation. */ +export type ContainerAppsRevisionsListRevisionsResponse = RevisionCollection; + +/** Optional parameters. */ +export interface ContainerAppsRevisionsGetRevisionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getRevision operation. */ +export type ContainerAppsRevisionsGetRevisionResponse = Revision; + +/** Optional parameters. */ +export interface ContainerAppsRevisionsActivateRevisionOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ContainerAppsRevisionsDeactivateRevisionOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ContainerAppsRevisionsRestartRevisionOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ContainerAppsRevisionsListRevisionsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listRevisionsNext operation. */ +export type ContainerAppsRevisionsListRevisionsNextResponse = RevisionCollection; + +/** Optional parameters. */ +export interface ManagedEnvironmentsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type ManagedEnvironmentsListBySubscriptionResponse = ManagedEnvironmentsCollection; + +/** Optional parameters. */ +export interface ManagedEnvironmentsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type ManagedEnvironmentsListByResourceGroupResponse = ManagedEnvironmentsCollection; + +/** Optional parameters. */ +export interface ManagedEnvironmentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ManagedEnvironmentsGetResponse = ManagedEnvironment; + +/** Optional parameters. */ +export interface ManagedEnvironmentsCreateOrUpdateOptionalParams + 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 ManagedEnvironmentsCreateOrUpdateResponse = ManagedEnvironment; + +/** Optional parameters. */ +export interface ManagedEnvironmentsDeleteOptionalParams + 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 ManagedEnvironmentsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type ManagedEnvironmentsUpdateResponse = ManagedEnvironment; + +/** Optional parameters. */ +export interface ManagedEnvironmentsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type ManagedEnvironmentsListBySubscriptionNextResponse = ManagedEnvironmentsCollection; + +/** Optional parameters. */ +export interface ManagedEnvironmentsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type ManagedEnvironmentsListByResourceGroupNextResponse = ManagedEnvironmentsCollection; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = AvailableOperations; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = AvailableOperations; + +/** Optional parameters. */ +export interface ContainerAppsAPIClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/app/arm-app/src/models/mappers.ts b/sdk/app/arm-app/src/models/mappers.ts new file mode 100644 index 000000000000..0da748f2c822 --- /dev/null +++ b/sdk/app/arm-app/src/models/mappers.ts @@ -0,0 +1,1331 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const ContainerAppCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerAppCollection", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ContainerApp" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Configuration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Configuration", + modelProperties: { + secrets: { + serializedName: "secrets", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Secret" + } + } + } + }, + activeRevisionsMode: { + serializedName: "activeRevisionsMode", + type: { + name: "String" + } + }, + ingress: { + serializedName: "ingress", + type: { + name: "Composite", + className: "Ingress" + } + }, + registries: { + serializedName: "registries", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RegistryCredentials" + } + } + } + } + } + } +}; + +export const Secret: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Secret", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const Ingress: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Ingress", + modelProperties: { + fqdn: { + serializedName: "fqdn", + readOnly: true, + type: { + name: "String" + } + }, + external: { + defaultValue: false, + serializedName: "external", + type: { + name: "Boolean" + } + }, + targetPort: { + serializedName: "targetPort", + type: { + name: "Number" + } + }, + transport: { + serializedName: "transport", + type: { + name: "String" + } + }, + traffic: { + serializedName: "traffic", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TrafficWeight" + } + } + } + }, + allowInsecure: { + serializedName: "allowInsecure", + type: { + name: "Boolean" + } + } + } + } +}; + +export const TrafficWeight: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrafficWeight", + modelProperties: { + revisionName: { + serializedName: "revisionName", + type: { + name: "String" + } + }, + weight: { + serializedName: "weight", + type: { + name: "Number" + } + }, + latestRevision: { + defaultValue: false, + serializedName: "latestRevision", + type: { + name: "Boolean" + } + } + } + } +}; + +export const RegistryCredentials: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RegistryCredentials", + modelProperties: { + server: { + serializedName: "server", + type: { + name: "String" + } + }, + username: { + serializedName: "username", + type: { + name: "String" + } + }, + passwordSecretRef: { + serializedName: "passwordSecretRef", + type: { + name: "String" + } + } + } + } +}; + +export const Template: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Template", + modelProperties: { + revisionSuffix: { + serializedName: "revisionSuffix", + type: { + name: "String" + } + }, + containers: { + serializedName: "containers", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Container" + } + } + } + }, + scale: { + serializedName: "scale", + type: { + name: "Composite", + className: "Scale" + } + }, + dapr: { + serializedName: "dapr", + type: { + name: "Composite", + className: "Dapr" + } + } + } + } +}; + +export const Container: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Container", + modelProperties: { + image: { + serializedName: "image", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + command: { + serializedName: "command", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + args: { + serializedName: "args", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + env: { + serializedName: "env", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EnvironmentVar" + } + } + } + }, + resources: { + serializedName: "resources", + type: { + name: "Composite", + className: "ContainerResources" + } + } + } + } +}; + +export const EnvironmentVar: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EnvironmentVar", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + }, + secretRef: { + serializedName: "secretRef", + type: { + name: "String" + } + } + } + } +}; + +export const ContainerResources: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerResources", + modelProperties: { + cpu: { + serializedName: "cpu", + type: { + name: "Number" + } + }, + memory: { + serializedName: "memory", + type: { + name: "String" + } + } + } + } +}; + +export const Scale: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Scale", + modelProperties: { + minReplicas: { + serializedName: "minReplicas", + type: { + name: "Number" + } + }, + maxReplicas: { + serializedName: "maxReplicas", + type: { + name: "Number" + } + }, + rules: { + serializedName: "rules", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ScaleRule" + } + } + } + } + } + } +}; + +export const ScaleRule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ScaleRule", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + azureQueue: { + serializedName: "azureQueue", + type: { + name: "Composite", + className: "QueueScaleRule" + } + }, + custom: { + serializedName: "custom", + type: { + name: "Composite", + className: "CustomScaleRule" + } + }, + http: { + serializedName: "http", + type: { + name: "Composite", + className: "HttpScaleRule" + } + } + } + } +}; + +export const QueueScaleRule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QueueScaleRule", + modelProperties: { + queueName: { + serializedName: "queueName", + type: { + name: "String" + } + }, + queueLength: { + serializedName: "queueLength", + type: { + name: "Number" + } + }, + auth: { + serializedName: "auth", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ScaleRuleAuth" + } + } + } + } + } + } +}; + +export const ScaleRuleAuth: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ScaleRuleAuth", + modelProperties: { + secretRef: { + serializedName: "secretRef", + type: { + name: "String" + } + }, + triggerParameter: { + serializedName: "triggerParameter", + type: { + name: "String" + } + } + } + } +}; + +export const CustomScaleRule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CustomScaleRule", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "String" + } + }, + metadata: { + serializedName: "metadata", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + auth: { + serializedName: "auth", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ScaleRuleAuth" + } + } + } + } + } + } +}; + +export const HttpScaleRule: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "HttpScaleRule", + modelProperties: { + metadata: { + serializedName: "metadata", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + auth: { + serializedName: "auth", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ScaleRuleAuth" + } + } + } + } + } + } +}; + +export const Dapr: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Dapr", + modelProperties: { + enabled: { + serializedName: "enabled", + type: { + name: "Boolean" + } + }, + appId: { + serializedName: "appId", + type: { + name: "String" + } + }, + appPort: { + serializedName: "appPort", + type: { + name: "Number" + } + }, + components: { + serializedName: "components", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DaprComponent" + } + } + } + } + } + } +}; + +export const DaprComponent: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DaprComponent", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + metadata: { + serializedName: "metadata", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DaprMetadata" + } + } + } + } + } + } +}; + +export const DaprMetadata: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DaprMetadata", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + }, + secretRef: { + serializedName: "secretRef", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const DefaultErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DefaultErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "DefaultErrorResponseError" + } + } + } + } +}; + +export const DefaultErrorResponseError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DefaultErrorResponseError", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "DefaultErrorResponseErrorDetailsItem" + } + } + } + }, + innererror: { + serializedName: "innererror", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const DefaultErrorResponseErrorDetailsItem: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DefaultErrorResponseErrorDetailsItem", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ContainerAppPatch: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerAppPatch", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const RevisionCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RevisionCollection", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Revision" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ManagedEnvironmentsCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedEnvironmentsCollection", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ManagedEnvironment" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const VnetConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "VnetConfiguration", + modelProperties: { + platformServiceCidr: { + serializedName: "platformServiceCidr", + type: { + name: "String" + } + }, + platformServiceDnsIp: { + serializedName: "platformServiceDnsIp", + type: { + name: "String" + } + }, + infrastructureSubnetResourceId: { + serializedName: "infrastructureSubnetResourceId", + type: { + name: "String" + } + }, + runtimeSubnetResourceName: { + serializedName: "runtimeSubnetResourceName", + type: { + name: "String" + } + }, + dockerBridgeCidr: { + serializedName: "dockerBridgeCidr", + type: { + name: "String" + } + } + } + } +}; + +export const AppLogsConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppLogsConfiguration", + modelProperties: { + destination: { + serializedName: "destination", + type: { + name: "String" + } + }, + logAnalyticsConfiguration: { + serializedName: "logAnalyticsConfiguration", + type: { + name: "Composite", + className: "LogAnalyticsConfiguration" + } + } + } + } +}; + +export const LogAnalyticsConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LogAnalyticsConfiguration", + modelProperties: { + customerId: { + serializedName: "customerId", + type: { + name: "String" + } + }, + sharedKey: { + serializedName: "sharedKey", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedEnvironmentPatch: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedEnvironmentPatch", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const AvailableOperations: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AvailableOperations", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationDetail" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OperationDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDetail", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const ContainerApp: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ContainerApp", + modelProperties: { + ...TrackedResource.type.modelProperties, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + managedEnvironmentId: { + serializedName: "properties.managedEnvironmentId", + type: { + name: "String" + } + }, + latestRevisionName: { + serializedName: "properties.latestRevisionName", + readOnly: true, + type: { + name: "String" + } + }, + latestRevisionFqdn: { + serializedName: "properties.latestRevisionFqdn", + readOnly: true, + type: { + name: "String" + } + }, + configuration: { + serializedName: "properties.configuration", + type: { + name: "Composite", + className: "Configuration" + } + }, + template: { + serializedName: "properties.template", + type: { + name: "Composite", + className: "Template" + } + } + } + } +}; + +export const ManagedEnvironment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedEnvironment", + modelProperties: { + ...TrackedResource.type.modelProperties, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "Enum", + allowedValues: [ + "Succeeded", + "Failed", + "Canceled", + "Waiting", + "InitializationInProgress", + "InfrastructureSetupInProgress", + "InfrastructureSetupComplete", + "ScheduledForDelete", + "UpgradeRequested", + "UpgradeFailed" + ] + } + }, + daprAIInstrumentationKey: { + serializedName: "properties.daprAIInstrumentationKey", + type: { + name: "String" + } + }, + vnetConfiguration: { + serializedName: "properties.vnetConfiguration", + type: { + name: "Composite", + className: "VnetConfiguration" + } + }, + deploymentErrors: { + serializedName: "properties.deploymentErrors", + readOnly: true, + type: { + name: "String" + } + }, + internalLoadBalancerEnabled: { + serializedName: "properties.internalLoadBalancerEnabled", + type: { + name: "Boolean" + } + }, + defaultDomain: { + serializedName: "properties.defaultDomain", + readOnly: true, + type: { + name: "String" + } + }, + staticIp: { + serializedName: "properties.staticIp", + readOnly: true, + type: { + name: "String" + } + }, + appLogsConfiguration: { + serializedName: "properties.appLogsConfiguration", + type: { + name: "Composite", + className: "AppLogsConfiguration" + } + } + } + } +}; + +export const Revision: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Revision", + modelProperties: { + ...ProxyResource.type.modelProperties, + createdTime: { + serializedName: "properties.createdTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + fqdn: { + serializedName: "properties.fqdn", + readOnly: true, + type: { + name: "String" + } + }, + template: { + serializedName: "properties.template", + type: { + name: "Composite", + className: "Template" + } + }, + active: { + serializedName: "properties.active", + readOnly: true, + type: { + name: "Boolean" + } + }, + replicas: { + serializedName: "properties.replicas", + readOnly: true, + type: { + name: "Number" + } + }, + trafficWeight: { + serializedName: "properties.trafficWeight", + readOnly: true, + type: { + name: "Number" + } + }, + provisioningError: { + serializedName: "properties.provisioningError", + readOnly: true, + type: { + name: "String" + } + }, + healthState: { + serializedName: "properties.healthState", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/app/arm-app/src/models/parameters.ts b/sdk/app/arm-app/src/models/parameters.ts new file mode 100644 index 000000000000..7cec4f391267 --- /dev/null +++ b/sdk/app/arm-app/src/models/parameters.ts @@ -0,0 +1,148 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + ContainerApp as ContainerAppMapper, + ContainerAppPatch as ContainerAppPatchMapper, + ManagedEnvironment as ManagedEnvironmentMapper, + ManagedEnvironmentPatch as ManagedEnvironmentPatchMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-01-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + Pattern: new RegExp("^[-\\w\\._\\(\\)]+[^\\.]$"), + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const name: OperationURLParameter = { + parameterPath: "name", + mapper: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const containerAppEnvelope: OperationParameter = { + parameterPath: "containerAppEnvelope", + mapper: ContainerAppMapper +}; + +export const containerAppEnvelope1: OperationParameter = { + parameterPath: "containerAppEnvelope", + mapper: ContainerAppPatchMapper +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const containerAppName: OperationURLParameter = { + parameterPath: "containerAppName", + mapper: { + serializedName: "containerAppName", + required: true, + type: { + name: "String" + } + } +}; + +export const environmentEnvelope: OperationParameter = { + parameterPath: "environmentEnvelope", + mapper: ManagedEnvironmentMapper +}; + +export const environmentEnvelope1: OperationParameter = { + parameterPath: "environmentEnvelope", + mapper: ManagedEnvironmentPatchMapper +}; diff --git a/sdk/app/arm-app/src/operations/containerApps.ts b/sdk/app/arm-app/src/operations/containerApps.ts new file mode 100644 index 000000000000..1b987f0bba7f --- /dev/null +++ b/sdk/app/arm-app/src/operations/containerApps.ts @@ -0,0 +1,592 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ContainerApps } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ContainerAppsAPIClient } from "../containerAppsAPIClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ContainerApp, + ContainerAppsListBySubscriptionNextOptionalParams, + ContainerAppsListBySubscriptionOptionalParams, + ContainerAppsListByResourceGroupNextOptionalParams, + ContainerAppsListByResourceGroupOptionalParams, + ContainerAppsListBySubscriptionResponse, + ContainerAppsListByResourceGroupResponse, + ContainerAppsGetOptionalParams, + ContainerAppsGetResponse, + ContainerAppsCreateOrUpdateOptionalParams, + ContainerAppsCreateOrUpdateResponse, + ContainerAppsDeleteOptionalParams, + ContainerAppPatch, + ContainerAppsUpdateOptionalParams, + ContainerAppsUpdateResponse, + ContainerAppsListBySubscriptionNextResponse, + ContainerAppsListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing ContainerApps operations. */ +export class ContainerAppsImpl implements ContainerApps { + private readonly client: ContainerAppsAPIClient; + + /** + * Initialize a new instance of the class ContainerApps class. + * @param client Reference to the service client + */ + constructor(client: ContainerAppsAPIClient) { + this.client = client; + } + + /** + * Get the Container Apps in a given subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: ContainerAppsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: ContainerAppsListBySubscriptionOptionalParams + ): 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?: ContainerAppsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Get the Container Apps in a given resource group. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: ContainerAppsListByResourceGroupOptionalParams + ): 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?: ContainerAppsListByResourceGroupOptionalParams + ): 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?: ContainerAppsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Get the Container Apps in a given subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: ContainerAppsListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Get the Container Apps in a given resource group. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: ContainerAppsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Get the properties of a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + name: string, + options?: ContainerAppsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, options }, + getOperationSpec + ); + } + + /** + * Description for Create or update a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param containerAppEnvelope Properties used to create a container app + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + name: string, + containerAppEnvelope: ContainerApp, + options?: ContainerAppsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ContainerAppsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, name, containerAppEnvelope, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Description for Create or update a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param containerAppEnvelope Properties used to create a container app + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + name: string, + containerAppEnvelope: ContainerApp, + options?: ContainerAppsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + name, + containerAppEnvelope, + options + ); + return poller.pollUntilDone(); + } + + /** + * Description for Delete a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + name: string, + options?: ContainerAppsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, name, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Description for Delete a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + name: string, + options?: ContainerAppsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete(resourceGroupName, name, options); + return poller.pollUntilDone(); + } + + /** + * Patches a Container App. Currently only patching of tags is supported + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param containerAppEnvelope Properties of a container app that need to be updated + * @param options The options parameters. + */ + update( + resourceGroupName: string, + name: string, + containerAppEnvelope: ContainerAppPatch, + options?: ContainerAppsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, containerAppEnvelope, options }, + updateOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: ContainerAppsListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @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?: ContainerAppsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ContainerAppCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ContainerAppCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ContainerApp + }, + 404: { + isError: true + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ContainerApp + }, + 201: { + bodyMapper: Mappers.ContainerApp + }, + 202: { + bodyMapper: Mappers.ContainerApp + }, + 204: { + bodyMapper: Mappers.ContainerApp + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + requestBody: Parameters.containerAppEnvelope, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ContainerApp + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + requestBody: Parameters.containerAppEnvelope1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ContainerAppCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ContainerAppCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/app/arm-app/src/operations/containerAppsRevisions.ts b/sdk/app/arm-app/src/operations/containerAppsRevisions.ts new file mode 100644 index 000000000000..24f5f9a28dfd --- /dev/null +++ b/sdk/app/arm-app/src/operations/containerAppsRevisions.ts @@ -0,0 +1,356 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ContainerAppsRevisions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ContainerAppsAPIClient } from "../containerAppsAPIClient"; +import { + Revision, + ContainerAppsRevisionsListRevisionsNextOptionalParams, + ContainerAppsRevisionsListRevisionsOptionalParams, + ContainerAppsRevisionsListRevisionsResponse, + ContainerAppsRevisionsGetRevisionOptionalParams, + ContainerAppsRevisionsGetRevisionResponse, + ContainerAppsRevisionsActivateRevisionOptionalParams, + ContainerAppsRevisionsDeactivateRevisionOptionalParams, + ContainerAppsRevisionsRestartRevisionOptionalParams, + ContainerAppsRevisionsListRevisionsNextResponse +} from "../models"; + +/// +/** Class containing ContainerAppsRevisions operations. */ +export class ContainerAppsRevisionsImpl implements ContainerAppsRevisions { + private readonly client: ContainerAppsAPIClient; + + /** + * Initialize a new instance of the class ContainerAppsRevisions class. + * @param client Reference to the service client + */ + constructor(client: ContainerAppsAPIClient) { + this.client = client; + } + + /** + * Get the Revisions for a given Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App for which Revisions are needed. + * @param options The options parameters. + */ + public listRevisions( + resourceGroupName: string, + containerAppName: string, + options?: ContainerAppsRevisionsListRevisionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listRevisionsPagingAll( + resourceGroupName, + containerAppName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listRevisionsPagingPage( + resourceGroupName, + containerAppName, + options + ); + } + }; + } + + private async *listRevisionsPagingPage( + resourceGroupName: string, + containerAppName: string, + options?: ContainerAppsRevisionsListRevisionsOptionalParams + ): AsyncIterableIterator { + let result = await this._listRevisions( + resourceGroupName, + containerAppName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listRevisionsNext( + resourceGroupName, + containerAppName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listRevisionsPagingAll( + resourceGroupName: string, + containerAppName: string, + options?: ContainerAppsRevisionsListRevisionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listRevisionsPagingPage( + resourceGroupName, + containerAppName, + options + )) { + yield* page; + } + } + + /** + * Get the Revisions for a given Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App for which Revisions are needed. + * @param options The options parameters. + */ + private _listRevisions( + resourceGroupName: string, + containerAppName: string, + options?: ContainerAppsRevisionsListRevisionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, containerAppName, options }, + listRevisionsOperationSpec + ); + } + + /** + * Get a revision of a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App. + * @param name Name of the Container App Revision. + * @param options The options parameters. + */ + getRevision( + resourceGroupName: string, + containerAppName: string, + name: string, + options?: ContainerAppsRevisionsGetRevisionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, containerAppName, name, options }, + getRevisionOperationSpec + ); + } + + /** + * Activates a revision for a Container App + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App. + * @param name Name of the Container App Revision to activate + * @param options The options parameters. + */ + activateRevision( + resourceGroupName: string, + containerAppName: string, + name: string, + options?: ContainerAppsRevisionsActivateRevisionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, containerAppName, name, options }, + activateRevisionOperationSpec + ); + } + + /** + * Deactivates a revision for a Container App + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App. + * @param name Name of the Container App Revision to deactivate + * @param options The options parameters. + */ + deactivateRevision( + resourceGroupName: string, + containerAppName: string, + name: string, + options?: ContainerAppsRevisionsDeactivateRevisionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, containerAppName, name, options }, + deactivateRevisionOperationSpec + ); + } + + /** + * Restarts a revision for a Container App + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App. + * @param name Name of the Container App Revision to restart + * @param options The options parameters. + */ + restartRevision( + resourceGroupName: string, + containerAppName: string, + name: string, + options?: ContainerAppsRevisionsRestartRevisionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, containerAppName, name, options }, + restartRevisionOperationSpec + ); + } + + /** + * ListRevisionsNext + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App for which Revisions are needed. + * @param nextLink The nextLink from the previous successful call to the ListRevisions method. + * @param options The options parameters. + */ + private _listRevisionsNext( + resourceGroupName: string, + containerAppName: string, + nextLink: string, + options?: ContainerAppsRevisionsListRevisionsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, containerAppName, nextLink, options }, + listRevisionsNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listRevisionsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.RevisionCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.containerAppName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getRevisionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Revision + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name, + Parameters.containerAppName + ], + headerParameters: [Parameters.accept], + serializer +}; +const activateRevisionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/activate", + httpMethod: "POST", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name, + Parameters.containerAppName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deactivateRevisionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/deactivate", + httpMethod: "POST", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name, + Parameters.containerAppName + ], + headerParameters: [Parameters.accept], + serializer +}; +const restartRevisionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/restart", + httpMethod: "POST", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name, + Parameters.containerAppName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listRevisionsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.RevisionCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink, + Parameters.containerAppName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/app/arm-app/src/operations/index.ts b/sdk/app/arm-app/src/operations/index.ts new file mode 100644 index 000000000000..5399f924f9c0 --- /dev/null +++ b/sdk/app/arm-app/src/operations/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./containerApps"; +export * from "./containerAppsRevisions"; +export * from "./managedEnvironments"; +export * from "./operations"; diff --git a/sdk/app/arm-app/src/operations/managedEnvironments.ts b/sdk/app/arm-app/src/operations/managedEnvironments.ts new file mode 100644 index 000000000000..066e470c6da1 --- /dev/null +++ b/sdk/app/arm-app/src/operations/managedEnvironments.ts @@ -0,0 +1,590 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ManagedEnvironments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ContainerAppsAPIClient } from "../containerAppsAPIClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ManagedEnvironment, + ManagedEnvironmentsListBySubscriptionNextOptionalParams, + ManagedEnvironmentsListBySubscriptionOptionalParams, + ManagedEnvironmentsListByResourceGroupNextOptionalParams, + ManagedEnvironmentsListByResourceGroupOptionalParams, + ManagedEnvironmentsListBySubscriptionResponse, + ManagedEnvironmentsListByResourceGroupResponse, + ManagedEnvironmentsGetOptionalParams, + ManagedEnvironmentsGetResponse, + ManagedEnvironmentsCreateOrUpdateOptionalParams, + ManagedEnvironmentsCreateOrUpdateResponse, + ManagedEnvironmentsDeleteOptionalParams, + ManagedEnvironmentPatch, + ManagedEnvironmentsUpdateOptionalParams, + ManagedEnvironmentsUpdateResponse, + ManagedEnvironmentsListBySubscriptionNextResponse, + ManagedEnvironmentsListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing ManagedEnvironments operations. */ +export class ManagedEnvironmentsImpl implements ManagedEnvironments { + private readonly client: ContainerAppsAPIClient; + + /** + * Initialize a new instance of the class ManagedEnvironments class. + * @param client Reference to the service client + */ + constructor(client: ContainerAppsAPIClient) { + this.client = client; + } + + /** + * Get all Managed Environments for a subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: ManagedEnvironmentsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: ManagedEnvironmentsListBySubscriptionOptionalParams + ): 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?: ManagedEnvironmentsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Get all the Managed Environments in a resource group. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: ManagedEnvironmentsListByResourceGroupOptionalParams + ): 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?: ManagedEnvironmentsListByResourceGroupOptionalParams + ): 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?: ManagedEnvironmentsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Get all Managed Environments for a subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: ManagedEnvironmentsListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Get all the Managed Environments in a resource group. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: ManagedEnvironmentsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Get the properties of a Managed Environment used to host container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + name: string, + options?: ManagedEnvironmentsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, options }, + getOperationSpec + ); + } + + /** + * Creates or updates a Managed Environment used to host container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param environmentEnvelope Configuration details of the Environment. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + name: string, + environmentEnvelope: ManagedEnvironment, + options?: ManagedEnvironmentsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ManagedEnvironmentsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, name, environmentEnvelope, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Creates or updates a Managed Environment used to host container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param environmentEnvelope Configuration details of the Environment. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + name: string, + environmentEnvelope: ManagedEnvironment, + options?: ManagedEnvironmentsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + name, + environmentEnvelope, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a Managed Environment if it does not have any container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + name: string, + options?: ManagedEnvironmentsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, name, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Delete a Managed Environment if it does not have any container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + name: string, + options?: ManagedEnvironmentsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete(resourceGroupName, name, options); + return poller.pollUntilDone(); + } + + /** + * Patches a Managed Environment. Only patching of tags is supported currently + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param environmentEnvelope Configuration details of the Environment. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + name: string, + environmentEnvelope: ManagedEnvironmentPatch, + options?: ManagedEnvironmentsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, name, environmentEnvelope, options }, + updateOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: ManagedEnvironmentsListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @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?: ManagedEnvironmentsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedEnvironmentsCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedEnvironmentsCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedEnvironment + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ManagedEnvironment + }, + 201: { + bodyMapper: Mappers.ManagedEnvironment + }, + 202: { + bodyMapper: Mappers.ManagedEnvironment + }, + 204: { + bodyMapper: Mappers.ManagedEnvironment + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + requestBody: Parameters.environmentEnvelope, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ManagedEnvironment + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + requestBody: Parameters.environmentEnvelope1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.name + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedEnvironmentsCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedEnvironmentsCollection + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/app/arm-app/src/operations/operations.ts b/sdk/app/arm-app/src/operations/operations.ts new file mode 100644 index 000000000000..365537dcc52e --- /dev/null +++ b/sdk/app/arm-app/src/operations/operations.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ContainerAppsAPIClient } from "../containerAppsAPIClient"; +import { + OperationDetail, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: ContainerAppsAPIClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: ContainerAppsAPIClient) { + this.client = client; + } + + /** + * Lists all of the available RP operations. + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all of the available RP operations. + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.App/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AvailableOperations + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AvailableOperations + }, + default: { + bodyMapper: Mappers.DefaultErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/app/arm-app/src/operationsInterfaces/containerApps.ts b/sdk/app/arm-app/src/operationsInterfaces/containerApps.ts new file mode 100644 index 000000000000..a4238b9451ef --- /dev/null +++ b/sdk/app/arm-app/src/operationsInterfaces/containerApps.ts @@ -0,0 +1,121 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ContainerApp, + ContainerAppsListBySubscriptionOptionalParams, + ContainerAppsListByResourceGroupOptionalParams, + ContainerAppsGetOptionalParams, + ContainerAppsGetResponse, + ContainerAppsCreateOrUpdateOptionalParams, + ContainerAppsCreateOrUpdateResponse, + ContainerAppsDeleteOptionalParams, + ContainerAppPatch, + ContainerAppsUpdateOptionalParams, + ContainerAppsUpdateResponse +} from "../models"; + +/// +/** Interface representing a ContainerApps. */ +export interface ContainerApps { + /** + * Get the Container Apps in a given subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: ContainerAppsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the Container Apps in a given resource group. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: ContainerAppsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the properties of a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + name: string, + options?: ContainerAppsGetOptionalParams + ): Promise; + /** + * Description for Create or update a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param containerAppEnvelope Properties used to create a container app + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + name: string, + containerAppEnvelope: ContainerApp, + options?: ContainerAppsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ContainerAppsCreateOrUpdateResponse + > + >; + /** + * Description for Create or update a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param containerAppEnvelope Properties used to create a container app + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + name: string, + containerAppEnvelope: ContainerApp, + options?: ContainerAppsCreateOrUpdateOptionalParams + ): Promise; + /** + * Description for Delete a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + name: string, + options?: ContainerAppsDeleteOptionalParams + ): Promise, void>>; + /** + * Description for Delete a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + name: string, + options?: ContainerAppsDeleteOptionalParams + ): Promise; + /** + * Patches a Container App. Currently only patching of tags is supported + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Container App. + * @param containerAppEnvelope Properties of a container app that need to be updated + * @param options The options parameters. + */ + update( + resourceGroupName: string, + name: string, + containerAppEnvelope: ContainerAppPatch, + options?: ContainerAppsUpdateOptionalParams + ): Promise; +} diff --git a/sdk/app/arm-app/src/operationsInterfaces/containerAppsRevisions.ts b/sdk/app/arm-app/src/operationsInterfaces/containerAppsRevisions.ts new file mode 100644 index 000000000000..a6e571f0d820 --- /dev/null +++ b/sdk/app/arm-app/src/operationsInterfaces/containerAppsRevisions.ts @@ -0,0 +1,86 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + Revision, + ContainerAppsRevisionsListRevisionsOptionalParams, + ContainerAppsRevisionsGetRevisionOptionalParams, + ContainerAppsRevisionsGetRevisionResponse, + ContainerAppsRevisionsActivateRevisionOptionalParams, + ContainerAppsRevisionsDeactivateRevisionOptionalParams, + ContainerAppsRevisionsRestartRevisionOptionalParams +} from "../models"; + +/// +/** Interface representing a ContainerAppsRevisions. */ +export interface ContainerAppsRevisions { + /** + * Get the Revisions for a given Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App for which Revisions are needed. + * @param options The options parameters. + */ + listRevisions( + resourceGroupName: string, + containerAppName: string, + options?: ContainerAppsRevisionsListRevisionsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a revision of a Container App. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App. + * @param name Name of the Container App Revision. + * @param options The options parameters. + */ + getRevision( + resourceGroupName: string, + containerAppName: string, + name: string, + options?: ContainerAppsRevisionsGetRevisionOptionalParams + ): Promise; + /** + * Activates a revision for a Container App + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App. + * @param name Name of the Container App Revision to activate + * @param options The options parameters. + */ + activateRevision( + resourceGroupName: string, + containerAppName: string, + name: string, + options?: ContainerAppsRevisionsActivateRevisionOptionalParams + ): Promise; + /** + * Deactivates a revision for a Container App + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App. + * @param name Name of the Container App Revision to deactivate + * @param options The options parameters. + */ + deactivateRevision( + resourceGroupName: string, + containerAppName: string, + name: string, + options?: ContainerAppsRevisionsDeactivateRevisionOptionalParams + ): Promise; + /** + * Restarts a revision for a Container App + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param containerAppName Name of the Container App. + * @param name Name of the Container App Revision to restart + * @param options The options parameters. + */ + restartRevision( + resourceGroupName: string, + containerAppName: string, + name: string, + options?: ContainerAppsRevisionsRestartRevisionOptionalParams + ): Promise; +} diff --git a/sdk/app/arm-app/src/operationsInterfaces/index.ts b/sdk/app/arm-app/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..5399f924f9c0 --- /dev/null +++ b/sdk/app/arm-app/src/operationsInterfaces/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./containerApps"; +export * from "./containerAppsRevisions"; +export * from "./managedEnvironments"; +export * from "./operations"; diff --git a/sdk/app/arm-app/src/operationsInterfaces/managedEnvironments.ts b/sdk/app/arm-app/src/operationsInterfaces/managedEnvironments.ts new file mode 100644 index 000000000000..0f63230925b3 --- /dev/null +++ b/sdk/app/arm-app/src/operationsInterfaces/managedEnvironments.ts @@ -0,0 +1,121 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ManagedEnvironment, + ManagedEnvironmentsListBySubscriptionOptionalParams, + ManagedEnvironmentsListByResourceGroupOptionalParams, + ManagedEnvironmentsGetOptionalParams, + ManagedEnvironmentsGetResponse, + ManagedEnvironmentsCreateOrUpdateOptionalParams, + ManagedEnvironmentsCreateOrUpdateResponse, + ManagedEnvironmentsDeleteOptionalParams, + ManagedEnvironmentPatch, + ManagedEnvironmentsUpdateOptionalParams, + ManagedEnvironmentsUpdateResponse +} from "../models"; + +/// +/** Interface representing a ManagedEnvironments. */ +export interface ManagedEnvironments { + /** + * Get all Managed Environments for a subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: ManagedEnvironmentsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get all the Managed Environments in a resource group. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: ManagedEnvironmentsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the properties of a Managed Environment used to host container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + name: string, + options?: ManagedEnvironmentsGetOptionalParams + ): Promise; + /** + * Creates or updates a Managed Environment used to host container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param environmentEnvelope Configuration details of the Environment. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + name: string, + environmentEnvelope: ManagedEnvironment, + options?: ManagedEnvironmentsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ManagedEnvironmentsCreateOrUpdateResponse + > + >; + /** + * Creates or updates a Managed Environment used to host container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param environmentEnvelope Configuration details of the Environment. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + name: string, + environmentEnvelope: ManagedEnvironment, + options?: ManagedEnvironmentsCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete a Managed Environment if it does not have any container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + name: string, + options?: ManagedEnvironmentsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a Managed Environment if it does not have any container apps. + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + name: string, + options?: ManagedEnvironmentsDeleteOptionalParams + ): Promise; + /** + * Patches a Managed Environment. Only patching of tags is supported currently + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Name of the Environment. + * @param environmentEnvelope Configuration details of the Environment. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + name: string, + environmentEnvelope: ManagedEnvironmentPatch, + options?: ManagedEnvironmentsUpdateOptionalParams + ): Promise; +} diff --git a/sdk/app/arm-app/src/operationsInterfaces/operations.ts b/sdk/app/arm-app/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..a704bdd7789c --- /dev/null +++ b/sdk/app/arm-app/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { OperationDetail, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available RP operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/app/arm-app/test/sampleTest.ts b/sdk/app/arm-app/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/app/arm-app/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/app/arm-app/tsconfig.json b/sdk/app/arm-app/tsconfig.json new file mode 100644 index 000000000000..6e3251194117 --- /dev/null +++ b/sdk/app/arm-app/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts", "./test/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/sdk/app/ci.yml b/sdk/app/ci.yml new file mode 100644 index 000000000000..e3356f52bc1d --- /dev/null +++ b/sdk/app/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/app/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/app/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: app + Artifacts: + - name: azure-arm-app + safeName: azurearmapp + \ No newline at end of file