From 22fca3182b24650d68a56c3a851c83333b8af87d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 22 Jan 2024 06:19:58 +0000 Subject: [PATCH] CodeGen from PR 27380 in Azure/azure-rest-api-specs Merge 0a924617e6a604182ebb49cb58a3838114086730 into 5386fbbdda25f3edfa4b19f6e0304c8a7bf47883 --- common/config/rush/pnpm-lock.yaml | 9 +- sdk/apicenter/arm-apicenter/CHANGELOG.md | 4 +- sdk/apicenter/arm-apicenter/LICENSE | 2 +- sdk/apicenter/arm-apicenter/README.md | 2 +- sdk/apicenter/arm-apicenter/_meta.json | 8 +- sdk/apicenter/arm-apicenter/assets.json | 6 - sdk/apicenter/arm-apicenter/package.json | 26 +- .../arm-apicenter/review/arm-apicenter.api.md | 818 ++++++++- .../samples-dev/operationsListSample.ts | 40 - .../servicesCreateOrUpdateSample.ts | 43 - .../samples-dev/servicesDeleteSample.ts | 40 - .../samples-dev/servicesGetSample.ts | 40 - .../servicesListByResourceGroupSample.ts | 44 - .../servicesListBySubscriptionSample.ts | 40 - .../samples-dev/servicesUpdateSample.ts | 40 - .../samples/v1-beta/javascript/README.md | 62 - .../javascript/operationsListSample.js | 37 - .../samples/v1-beta/javascript/package.json | 32 - .../samples/v1-beta/javascript/sample.env | 4 - .../servicesCreateOrUpdateSample.js | 36 - .../javascript/servicesDeleteSample.js | 36 - .../v1-beta/javascript/servicesGetSample.js | 36 - .../servicesListByResourceGroupSample.js | 38 - .../servicesListBySubscriptionSample.js | 37 - .../javascript/servicesUpdateSample.js | 36 - .../samples/v1-beta/typescript/README.md | 75 - .../samples/v1-beta/typescript/package.json | 41 - .../samples/v1-beta/typescript/sample.env | 4 - .../typescript/src/operationsListSample.ts | 40 - .../src/servicesCreateOrUpdateSample.ts | 43 - .../typescript/src/servicesDeleteSample.ts | 40 - .../typescript/src/servicesGetSample.ts | 40 - .../src/servicesListByResourceGroupSample.ts | 44 - .../src/servicesListBySubscriptionSample.ts | 40 - .../typescript/src/servicesUpdateSample.ts | 40 - .../samples/v1-beta/typescript/tsconfig.json | 17 - .../arm-apicenter/src/azureAPICenter.ts | 121 +- .../arm-apicenter/src/models/index.ts | 982 ++++++++++- .../arm-apicenter/src/models/mappers.ts | 1545 +++++++++++++++-- .../arm-apicenter/src/models/parameters.ts | 243 ++- .../src/operations/apiDefinitions.ts | 473 +++++ .../src/operations/apiVersions.ts | 375 ++++ .../arm-apicenter/src/operations/apis.ts | 369 ++++ .../src/operations/deployments.ts | 375 ++++ .../src/operations/environments.ts | 369 ++++ .../arm-apicenter/src/operations/index.ts | 7 + .../src/operations/metadataSchemas.ts | 363 ++++ .../src/operations/operations.ts | 36 +- .../arm-apicenter/src/operations/services.ts | 222 ++- .../src/operations/workspaces.ts | 363 ++++ .../operationsInterfaces/apiDefinitions.ts | 110 ++ .../src/operationsInterfaces/apiVersions.ts | 82 + .../src/operationsInterfaces/apis.ts | 82 + .../src/operationsInterfaces/deployments.ts | 82 + .../src/operationsInterfaces/environments.ts | 82 + .../src/operationsInterfaces/index.ts | 7 + .../operationsInterfaces/metadataSchemas.ts | 82 + .../src/operationsInterfaces/operations.ts | 4 +- .../src/operationsInterfaces/services.ts | 48 +- .../src/operationsInterfaces/workspaces.ts | 82 + .../arm-apicenter/src/pagingHelper.ts | 2 +- .../test/apicenter_operations_test.spec.ts | 66 - .../arm-apicenter/test/sampleTest.ts | 43 + sdk/apicenter/arm-apicenter/tsconfig.json | 10 +- 64 files changed, 7038 insertions(+), 1527 deletions(-) delete mode 100644 sdk/apicenter/arm-apicenter/assets.json delete mode 100644 sdk/apicenter/arm-apicenter/samples-dev/operationsListSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples-dev/servicesCreateOrUpdateSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples-dev/servicesDeleteSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples-dev/servicesGetSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples-dev/servicesListByResourceGroupSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples-dev/servicesListBySubscriptionSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples-dev/servicesUpdateSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/README.md delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/operationsListSample.js delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/package.json delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/sample.env delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesCreateOrUpdateSample.js delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesDeleteSample.js delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesGetSample.js delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListByResourceGroupSample.js delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListBySubscriptionSample.js delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesUpdateSample.js delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/README.md delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/package.json delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/sample.env delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/operationsListSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesCreateOrUpdateSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesDeleteSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesGetSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListByResourceGroupSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListBySubscriptionSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesUpdateSample.ts delete mode 100644 sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/tsconfig.json create mode 100644 sdk/apicenter/arm-apicenter/src/operations/apiDefinitions.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operations/apiVersions.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operations/apis.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operations/deployments.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operations/environments.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operations/metadataSchemas.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operations/workspaces.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operationsInterfaces/apiDefinitions.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operationsInterfaces/apiVersions.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operationsInterfaces/apis.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operationsInterfaces/deployments.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operationsInterfaces/environments.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operationsInterfaces/metadataSchemas.ts create mode 100644 sdk/apicenter/arm-apicenter/src/operationsInterfaces/workspaces.ts delete mode 100644 sdk/apicenter/arm-apicenter/test/apicenter_operations_test.spec.ts create mode 100644 sdk/apicenter/arm-apicenter/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c354b7d233a6..7394f4aaaca5 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -11216,24 +11216,29 @@ packages: dev: false file:projects/arm-apicenter.tgz: - resolution: {integrity: sha512-uPE98WZ1lbsANbSaNM8pZeINf0kHRJsEQBurLQD/2jTsyBdc6FHi9urtmrdw3zSSlF3zEhmr9d4wn1lMo9qj1g==, tarball: file:projects/arm-apicenter.tgz} + resolution: {integrity: sha512-guL8ii/lLV6LSVeUfJhI2hsvOGPRbdH0X0mNy1ntk46WyJgmRXrKuAk0Ekv+2SQJGMWhK6GPv3Fu8EQKyeRnPQ==, tarball: file:projects/arm-apicenter.tgz} name: '@rush-temp/arm-apicenter' version: 0.0.0 dependencies: '@azure/identity': 3.4.1 '@microsoft/api-extractor': 7.39.1(@types/node@18.19.8) '@types/chai': 4.3.11 + '@types/mocha': 10.0.6 '@types/node': 18.19.8 chai: 4.3.10 cross-env: 7.0.3 dotenv: 16.3.1 + esm: 3.2.25 mkdirp: 2.1.6 mocha: 10.2.0 - rimraf: 3.0.2 + rimraf: 5.0.5 + ts-node: 10.9.2(@types/node@18.19.8)(typescript@5.2.2) tslib: 2.6.2 typescript: 5.2.2 uglify-js: 3.17.4 transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' - supports-color dev: false diff --git a/sdk/apicenter/arm-apicenter/CHANGELOG.md b/sdk/apicenter/arm-apicenter/CHANGELOG.md index cc4bd78fdf68..bb94761a6859 100644 --- a/sdk/apicenter/arm-apicenter/CHANGELOG.md +++ b/sdk/apicenter/arm-apicenter/CHANGELOG.md @@ -1,5 +1,5 @@ # Release History -## 1.0.0-beta.1 (2023-08-16) +## 1.0.0 (2024-01-22) -The package of @azure/arm-apicenter is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/js/mgmt/quickstart ). +The package of @azure/arm-apicenter is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/apicenter/arm-apicenter/LICENSE b/sdk/apicenter/arm-apicenter/LICENSE index 3a1d9b6f24f7..7d5934740965 100644 --- a/sdk/apicenter/arm-apicenter/LICENSE +++ b/sdk/apicenter/arm-apicenter/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2023 Microsoft +Copyright (c) 2024 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/apicenter/arm-apicenter/README.md b/sdk/apicenter/arm-apicenter/README.md index 0d166c094d99..d25b302da1bc 100644 --- a/sdk/apicenter/arm-apicenter/README.md +++ b/sdk/apicenter/arm-apicenter/README.md @@ -6,7 +6,7 @@ Azure API Center Resource Provider. [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/apicenter/arm-apicenter) | [Package (NPM)](https://www.npmjs.com/package/@azure/arm-apicenter) | -[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-apicenter?view=azure-node-preview) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-apicenter) | [Samples](https://github.com/Azure-Samples/azure-samples-js-management) ## Getting started diff --git a/sdk/apicenter/arm-apicenter/_meta.json b/sdk/apicenter/arm-apicenter/_meta.json index d77db1002320..10d0972825fa 100644 --- a/sdk/apicenter/arm-apicenter/_meta.json +++ b/sdk/apicenter/arm-apicenter/_meta.json @@ -1,8 +1,8 @@ { - "commit": "d99f18b18405cd446f7abc2c9e6b3884f5c549f8", + "commit": "a6e9fd840dab1af060978cec6e36fcdb312c7710", "readme": "specification/apicenter/resource-manager/readme.md", - "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=F:\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\apicenter\\resource-manager\\readme.md --use=@autorest/typescript@6.0.5 --generate-sample=true", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/apicenter/resource-manager/readme.md --use=@autorest/typescript@^6.0.12", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.7.0", - "use": "@autorest/typescript@6.0.5" + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.4", + "use": "@autorest/typescript@^6.0.12" } \ No newline at end of file diff --git a/sdk/apicenter/arm-apicenter/assets.json b/sdk/apicenter/arm-apicenter/assets.json deleted file mode 100644 index 41fad2851cfd..000000000000 --- a/sdk/apicenter/arm-apicenter/assets.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "AssetsRepo": "Azure/azure-sdk-assets", - "AssetsRepoPrefixPath": "js", - "TagPrefix": "js/apicenter/arm-apicenter", - "Tag": "js/apicenter/arm-apicenter_a7b4c73e8e" -} diff --git a/sdk/apicenter/arm-apicenter/package.json b/sdk/apicenter/arm-apicenter/package.json index 150428e508fc..2e212989e30b 100644 --- a/sdk/apicenter/arm-apicenter/package.json +++ b/sdk/apicenter/arm-apicenter/package.json @@ -3,7 +3,7 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for AzureAPICenter.", - "version": "1.0.0-beta.1", + "version": "1.0.0", "engines": { "node": ">=18.0.0" }, @@ -11,7 +11,7 @@ "@azure/core-paging": "^1.2.0", "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", - "@azure/core-rest-pipeline": "^1.8.0", + "@azure/core-rest-pipeline": "^1.12.0", "tslib": "^2.2.0" }, "keywords": [ @@ -30,17 +30,20 @@ "mkdirp": "^2.1.2", "typescript": "~5.2.0", "uglify-js": "^3.4.9", - "rimraf": "^3.0.0", + "rimraf": "^5.0.0", "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", "@azure/identity": "^3.3.0", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "esm": "^3.2.18", "@types/chai": "^4.2.8", "chai": "^4.2.0", "cross-env": "^7.0.2", "@types/node": "^18.0.0", - "@azure/dev-tool": "^1.0.0" + "ts-node": "^10.0.0" }, "repository": { "type": "git", @@ -73,8 +76,7 @@ "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", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", "build:node": "echo skipped", "build:browser": "echo skipped", "build:test": "echo skipped", @@ -102,13 +104,5 @@ ] }, "autoPublish": true, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/apicenter/arm-apicenter", - "//sampleConfiguration": { - "productName": "", - "productSlugs": [ - "azure" - ], - "disableDocsMs": true, - "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-apicenter?view=azure-node-preview" - } -} + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/apicenter/arm-apicenter" +} \ No newline at end of file diff --git a/sdk/apicenter/arm-apicenter/review/arm-apicenter.api.md b/sdk/apicenter/arm-apicenter/review/arm-apicenter.api.md index fedb06b03bdf..c33b14c9a06d 100644 --- a/sdk/apicenter/arm-apicenter/review/arm-apicenter.api.md +++ b/sdk/apicenter/arm-apicenter/review/arm-apicenter.api.md @@ -11,19 +11,339 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging'; // @public export type ActionType = string; +// @public +export interface Api extends Resource { + properties?: ApiProperties; +} + +// @public +export interface ApiCollection { + readonly nextLink?: string; + readonly value?: Api[]; +} + +// @public +export interface ApiDefinition extends Resource { + properties?: ApiDefinitionProperties; +} + +// @public +export interface ApiDefinitionCollection { + readonly nextLink?: string; + readonly value?: ApiDefinition[]; +} + +// @public +export interface ApiDefinitionProperties { + description?: string; + readonly specification?: ApiDefinitionPropertiesSpecification; + title: string; +} + +// @public +export interface ApiDefinitionPropertiesSpecification { + name?: string; + version?: string; +} + +// @public +export interface ApiDefinitions { + createOrUpdate(resourceGroupName: string, serviceName: string, payload: ApiDefinition, options?: ApiDefinitionsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, serviceName: string, options?: ApiDefinitionsDeleteOptionalParams): Promise; + exportSpecification(resourceGroupName: string, serviceName: string, options?: ApiDefinitionsExportSpecificationOptionalParams): Promise; + get(resourceGroupName: string, serviceName: string, options?: ApiDefinitionsGetOptionalParams): Promise; + head(resourceGroupName: string, serviceName: string, options?: ApiDefinitionsHeadOptionalParams): Promise; + importSpecification(resourceGroupName: string, serviceName: string, payload: ApiSpecImportRequest, options?: ApiDefinitionsImportSpecificationOptionalParams): Promise; + list(resourceGroupName: string, serviceName: string, options?: ApiDefinitionsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ApiDefinitionsCreateOrUpdateHeaders { + eTag?: string; +} + +// @public +export interface ApiDefinitionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiDefinitionsCreateOrUpdateResponse = ApiDefinitionsCreateOrUpdateHeaders & ApiDefinition; + +// @public +export interface ApiDefinitionsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ApiDefinitionsExportSpecificationOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiDefinitionsExportSpecificationResponse = ApiSpecExportResult; + +// @public +export interface ApiDefinitionsGetHeaders { + eTag?: string; +} + +// @public +export interface ApiDefinitionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiDefinitionsGetResponse = ApiDefinitionsGetHeaders & ApiDefinition; + +// @public +export interface ApiDefinitionsHeadOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiDefinitionsHeadResponse = { + body: boolean; +}; + +// @public +export interface ApiDefinitionsImportSpecificationOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ApiDefinitionsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiDefinitionsListNextResponse = ApiDefinitionCollection; + +// @public +export interface ApiDefinitionsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiDefinitionsListResponse = ApiDefinitionCollection; + +// @public +export type ApiKind = string; + +// @public +export interface ApiProperties { + // (undocumented) + contacts?: Contact[]; + customProperties?: Record; + description?: string; + // (undocumented) + externalDocumentation?: ExternalDocumentation[]; + kind: ApiKind; + license?: License; + readonly lifecycleStage?: LifecycleStage; + summary?: string; + termsOfService?: TermsOfService; + title: string; +} + +// @public +export interface Apis { + createOrUpdate(resourceGroupName: string, serviceName: string, payload: Api, options?: ApisCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, serviceName: string, options?: ApisDeleteOptionalParams): Promise; + get(resourceGroupName: string, serviceName: string, options?: ApisGetOptionalParams): Promise; + head(resourceGroupName: string, serviceName: string, options?: ApisHeadOptionalParams): Promise; + list(resourceGroupName: string, serviceName: string, options?: ApisListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ApisCreateOrUpdateHeaders { + eTag?: string; +} + +// @public +export interface ApisCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApisCreateOrUpdateResponse = ApisCreateOrUpdateHeaders & Api; + +// @public +export interface ApisDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ApisGetHeaders { + eTag?: string; +} + +// @public +export interface ApisGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApisGetResponse = ApisGetHeaders & Api; + +// @public +export interface ApisHeadOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApisHeadResponse = { + body: boolean; +}; + +// @public +export interface ApisListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApisListNextResponse = ApiCollection; + +// @public +export interface ApisListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApisListResponse = ApiCollection; + +// @public +export interface ApiSpecExportResult { + // (undocumented) + format?: ApiSpecExportResultFormat; + value?: string; +} + +// @public +export type ApiSpecExportResultFormat = string; + +// @public +export interface ApiSpecImportRequest { + format?: ApiSpecImportSourceFormat; + specification?: ApiSpecImportRequestSpecification; + value?: string; +} + +// @public +export interface ApiSpecImportRequestSpecification { + name?: string; + version?: string; +} + +// @public +export type ApiSpecImportSourceFormat = string; + +// @public +export interface ApiVersion extends Resource { + properties?: ApiVersionProperties; +} + +// @public +export interface ApiVersionCollection { + readonly nextLink?: string; + readonly value?: ApiVersion[]; +} + +// @public +export interface ApiVersionProperties { + lifecycleStage: LifecycleStage; + title: string; +} + +// @public +export interface ApiVersions { + createOrUpdate(resourceGroupName: string, serviceName: string, payload: ApiVersion, options?: ApiVersionsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, serviceName: string, options?: ApiVersionsDeleteOptionalParams): Promise; + get(resourceGroupName: string, serviceName: string, options?: ApiVersionsGetOptionalParams): Promise; + head(resourceGroupName: string, serviceName: string, options?: ApiVersionsHeadOptionalParams): Promise; + list(resourceGroupName: string, serviceName: string, options?: ApiVersionsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ApiVersionsCreateOrUpdateHeaders { + eTag?: string; +} + +// @public +export interface ApiVersionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiVersionsCreateOrUpdateResponse = ApiVersionsCreateOrUpdateHeaders & ApiVersion; + +// @public +export interface ApiVersionsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ApiVersionsGetHeaders { + eTag?: string; +} + +// @public +export interface ApiVersionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiVersionsGetResponse = ApiVersionsGetHeaders & ApiVersion; + +// @public +export interface ApiVersionsHeadOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiVersionsHeadResponse = { + body: boolean; +}; + +// @public +export interface ApiVersionsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiVersionsListNextResponse = ApiVersionCollection; + +// @public +export interface ApiVersionsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ApiVersionsListResponse = ApiVersionCollection; + // @public (undocumented) export class AzureAPICenter extends coreClient.ServiceClient { // (undocumented) $host: string; - constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AzureAPICenterOptionalParams); + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, metadataSchemaName: string, workspaceName: string, apiName: string, versionName: string, definitionName: string, deploymentName: string, environmentName: string, options?: AzureAPICenterOptionalParams); + // (undocumented) + apiDefinitions: ApiDefinitions; + // (undocumented) + apiName: string; + // (undocumented) + apis: Apis; // (undocumented) apiVersion: string; // (undocumented) + apiVersions: ApiVersions; + // (undocumented) + definitionName: string; + // (undocumented) + deploymentName: string; + // (undocumented) + deployments: Deployments; + // (undocumented) + environmentName: string; + // (undocumented) + environments: Environments; + // (undocumented) + filter?: string; + // (undocumented) + metadataSchemaName: string; + // (undocumented) + metadataSchemas: MetadataSchemas; + // (undocumented) operations: Operations; // (undocumented) services: Services; // (undocumented) subscriptionId: string; + // (undocumented) + versionName: string; + // (undocumented) + workspaceName: string; + // (undocumented) + workspaces: Workspaces; } // @public @@ -31,11 +351,204 @@ export interface AzureAPICenterOptionalParams extends coreClient.ServiceClientOp $host?: string; apiVersion?: string; endpoint?: string; + filter?: string; +} + +// @public (undocumented) +export interface Contact { + email?: string; + name?: string; + url?: string; } // @public export type CreatedByType = string; +// @public +export interface Deployment extends Resource { + properties?: DeploymentProperties; +} + +// @public +export interface DeploymentCollection { + readonly nextLink?: string; + readonly value?: Deployment[]; +} + +// @public +export interface DeploymentProperties { + customProperties?: Record; + definitionId?: string; + description?: string; + environmentId?: string; + server?: DeploymentServer; + state?: DeploymentState; + title?: string; +} + +// @public +export interface Deployments { + createOrUpdate(resourceGroupName: string, serviceName: string, payload: Deployment, options?: DeploymentsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, serviceName: string, options?: DeploymentsDeleteOptionalParams): Promise; + get(resourceGroupName: string, serviceName: string, options?: DeploymentsGetOptionalParams): Promise; + head(resourceGroupName: string, serviceName: string, options?: DeploymentsHeadOptionalParams): Promise; + list(resourceGroupName: string, serviceName: string, options?: DeploymentsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface DeploymentsCreateOrUpdateHeaders { + eTag?: string; +} + +// @public +export interface DeploymentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentsCreateOrUpdateResponse = DeploymentsCreateOrUpdateHeaders & Deployment; + +// @public +export interface DeploymentsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface DeploymentServer { + runtimeUri?: string[]; +} + +// @public +export interface DeploymentsGetHeaders { + eTag?: string; +} + +// @public +export interface DeploymentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentsGetResponse = DeploymentsGetHeaders & Deployment; + +// @public +export interface DeploymentsHeadOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentsHeadResponse = { + body: boolean; +}; + +// @public +export interface DeploymentsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentsListNextResponse = DeploymentCollection; + +// @public +export interface DeploymentsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DeploymentsListResponse = DeploymentCollection; + +// @public +export type DeploymentState = string; + +// @public +export interface Environment extends Resource { + properties?: EnvironmentProperties; +} + +// @public +export interface EnvironmentCollection { + readonly nextLink?: string; + readonly value?: Environment[]; +} + +// @public +export type EnvironmentKind = string; + +// @public +export interface EnvironmentProperties { + customProperties?: Record; + description?: string; + kind: EnvironmentKind; + // (undocumented) + onboarding?: Onboarding; + server?: EnvironmentServer; + title: string; +} + +// @public +export interface Environments { + createOrUpdate(resourceGroupName: string, serviceName: string, payload: Environment, options?: EnvironmentsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, serviceName: string, options?: EnvironmentsDeleteOptionalParams): Promise; + get(resourceGroupName: string, serviceName: string, options?: EnvironmentsGetOptionalParams): Promise; + head(resourceGroupName: string, serviceName: string, options?: EnvironmentsHeadOptionalParams): Promise; + list(resourceGroupName: string, serviceName: string, options?: EnvironmentsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface EnvironmentsCreateOrUpdateHeaders { + eTag?: string; +} + +// @public +export interface EnvironmentsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnvironmentsCreateOrUpdateResponse = EnvironmentsCreateOrUpdateHeaders & Environment; + +// @public +export interface EnvironmentsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface EnvironmentServer { + // (undocumented) + managementPortalUri?: string[]; + type?: EnvironmentServerType; +} + +// @public +export type EnvironmentServerType = string; + +// @public +export interface EnvironmentsGetHeaders { + eTag?: string; +} + +// @public +export interface EnvironmentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnvironmentsGetResponse = EnvironmentsGetHeaders & Environment; + +// @public +export interface EnvironmentsHeadOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnvironmentsHeadResponse = { + body: boolean; +}; + +// @public +export interface EnvironmentsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnvironmentsListNextResponse = EnvironmentCollection; + +// @public +export interface EnvironmentsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnvironmentsListResponse = EnvironmentCollection; + // @public export interface ErrorAdditionalInfo { readonly info?: Record; @@ -56,6 +569,13 @@ export interface ErrorResponse { error?: ErrorDetail; } +// @public +export interface ExternalDocumentation { + description?: string; + title?: string; + url: string; +} + // @public export function getContinuationToken(page: unknown): string | undefined; @@ -64,6 +584,28 @@ export enum KnownActionType { Internal = "Internal" } +// @public +export enum KnownApiKind { + Graphql = "graphql", + Grpc = "grpc", + Rest = "rest", + Soap = "soap", + Webhook = "webhook", + Websocket = "websocket" +} + +// @public +export enum KnownApiSpecExportResultFormat { + Inline = "inline", + Link = "link" +} + +// @public +export enum KnownApiSpecImportSourceFormat { + Inline = "inline", + Link = "link" +} + // @public export enum KnownCreatedByType { Application = "Application", @@ -72,6 +614,42 @@ export enum KnownCreatedByType { User = "User" } +// @public +export enum KnownDeploymentState { + Active = "active", + Inactive = "inactive" +} + +// @public +export enum KnownEnvironmentKind { + Development = "development", + Production = "production", + Staging = "staging", + Testing = "testing" +} + +// @public +export enum KnownEnvironmentServerType { + ApigeeAPIManagement = "Apigee API Management", + AWSAPIGateway = "AWS API Gateway", + AzureAPIManagement = "Azure API Management", + AzureComputeService = "Azure compute service", + KongAPIGateway = "Kong API Gateway", + Kubernetes = "Kubernetes", + MuleSoftAPIManagement = "MuleSoft API Management" +} + +// @public +export enum KnownLifecycleStage { + Deprecated = "deprecated", + Design = "design", + Development = "development", + Preview = "preview", + Production = "production", + Retired = "retired", + Testing = "testing" +} + // @public export enum KnownManagedServiceIdentityType { None = "None", @@ -80,6 +658,19 @@ export enum KnownManagedServiceIdentityType { UserAssigned = "UserAssigned" } +// @public +export enum KnownMetadataAssignmentEntity { + Api = "api", + Deployment = "deployment", + Environment = "environment" +} + +// @public +export enum KnownMetadataSchemaExportFormat { + Inline = "inline", + Link = "link" +} + // @public export enum KnownOrigin { System = "system", @@ -94,6 +685,16 @@ export enum KnownProvisioningState { Succeeded = "Succeeded" } +// @public +export interface License { + identifier?: string; + name?: string; + url?: string; +} + +// @public +export type LifecycleStage = string; + // @public export interface ManagedServiceIdentity { readonly principalId?: string; @@ -107,6 +708,118 @@ export interface ManagedServiceIdentity { // @public export type ManagedServiceIdentityType = string; +// @public (undocumented) +export interface MetadataAssignment { + // (undocumented) + deprecated?: boolean; + entity?: MetadataAssignmentEntity; + // (undocumented) + required?: boolean; +} + +// @public +export type MetadataAssignmentEntity = string; + +// @public +export interface MetadataSchema extends Resource { + properties?: MetadataSchemaProperties; +} + +// @public +export interface MetadataSchemaCollection { + readonly nextLink?: string; + readonly value?: MetadataSchema[]; +} + +// @public +export type MetadataSchemaExportFormat = string; + +// @public +export interface MetadataSchemaExportRequest { + assignedTo?: MetadataAssignmentEntity; +} + +// @public +export interface MetadataSchemaExportResult { + // (undocumented) + format?: MetadataSchemaExportFormat; + value?: string; +} + +// @public +export interface MetadataSchemaProperties { + // (undocumented) + assignedTo?: MetadataAssignment[]; + schema: string; +} + +// @public +export interface MetadataSchemas { + createOrUpdate(resourceGroupName: string, serviceName: string, payload: MetadataSchema, options?: MetadataSchemasCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, serviceName: string, options?: MetadataSchemasDeleteOptionalParams): Promise; + get(resourceGroupName: string, serviceName: string, options?: MetadataSchemasGetOptionalParams): Promise; + head(resourceGroupName: string, serviceName: string, options?: MetadataSchemasHeadOptionalParams): Promise; + list(resourceGroupName: string, serviceName: string, options?: MetadataSchemasListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface MetadataSchemasCreateOrUpdateHeaders { + eTag?: string; +} + +// @public +export interface MetadataSchemasCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MetadataSchemasCreateOrUpdateResponse = MetadataSchemasCreateOrUpdateHeaders & MetadataSchema; + +// @public +export interface MetadataSchemasDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface MetadataSchemasGetHeaders { + eTag?: string; +} + +// @public +export interface MetadataSchemasGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MetadataSchemasGetResponse = MetadataSchemasGetHeaders & MetadataSchema; + +// @public +export interface MetadataSchemasHeadOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MetadataSchemasHeadResponse = { + body: boolean; +}; + +// @public +export interface MetadataSchemasListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MetadataSchemasListNextResponse = MetadataSchemaCollection; + +// @public +export interface MetadataSchemasListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MetadataSchemasListResponse = MetadataSchemaCollection; + +// @public (undocumented) +export interface Onboarding { + // (undocumented) + developerPortalUri?: string[]; + instructions?: string; +} + // @public export interface Operation { readonly actionType?: ActionType; @@ -166,7 +879,7 @@ export interface Resource { // @public export interface Service extends TrackedResource { identity?: ManagedServiceIdentity; - readonly provisioningState?: ProvisioningState; + properties?: ServiceProperties; } // @public @@ -175,10 +888,16 @@ export interface ServiceCollection { value: Service[]; } +// @public +export interface ServiceProperties { + readonly provisioningState?: ProvisioningState; +} + // @public export interface Services { createOrUpdate(resourceGroupName: string, serviceName: string, options?: ServicesCreateOrUpdateOptionalParams): Promise; delete(resourceGroupName: string, serviceName: string, options?: ServicesDeleteOptionalParams): Promise; + exportMetadataSchema(resourceGroupName: string, serviceName: string, payload: MetadataSchemaExportRequest, options?: ServicesExportMetadataSchemaOptionalParams): Promise; get(resourceGroupName: string, serviceName: string, options?: ServicesGetOptionalParams): Promise; listByResourceGroup(resourceGroupName: string, options?: ServicesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; listBySubscription(options?: ServicesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; @@ -187,7 +906,7 @@ export interface Services { // @public export interface ServicesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { - resource?: Service; + payload?: Service; } // @public @@ -197,6 +916,13 @@ export type ServicesCreateOrUpdateResponse = Service; export interface ServicesDeleteOptionalParams extends coreClient.OperationOptions { } +// @public +export interface ServicesExportMetadataSchemaOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ServicesExportMetadataSchemaResponse = MetadataSchemaExportResult; + // @public export interface ServicesGetOptionalParams extends coreClient.OperationOptions { } @@ -234,7 +960,7 @@ export type ServicesListBySubscriptionResponse = ServiceCollection; // @public export interface ServicesUpdateOptionalParams extends coreClient.OperationOptions { - parameters?: ServiceUpdate; + payload?: ServiceUpdate; } // @public @@ -242,7 +968,7 @@ export type ServicesUpdateResponse = Service; // @public export interface ServiceUpdate { - readonly provisioningState?: ProvisioningState; + properties?: ServiceProperties; } // @public @@ -255,6 +981,11 @@ export interface SystemData { lastModifiedByType?: CreatedByType; } +// @public +export interface TermsOfService { + url: string; +} + // @public export interface TrackedResource extends Resource { location: string; @@ -269,6 +1000,83 @@ export interface UserAssignedIdentity { readonly principalId?: string; } +// @public +export interface Workspace extends Resource { + properties?: WorkspaceProperties; +} + +// @public +export interface WorkspaceCollection { + readonly nextLink?: string; + readonly value?: Workspace[]; +} + +// @public +export interface WorkspaceProperties { + description?: string; + title: string; +} + +// @public +export interface Workspaces { + createOrUpdate(resourceGroupName: string, serviceName: string, payload: Workspace, options?: WorkspacesCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, serviceName: string, options?: WorkspacesDeleteOptionalParams): Promise; + get(resourceGroupName: string, serviceName: string, options?: WorkspacesGetOptionalParams): Promise; + head(resourceGroupName: string, serviceName: string, options?: WorkspacesHeadOptionalParams): Promise; + list(resourceGroupName: string, serviceName: string, options?: WorkspacesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface WorkspacesCreateOrUpdateHeaders { + eTag?: string; +} + +// @public +export interface WorkspacesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesCreateOrUpdateResponse = WorkspacesCreateOrUpdateHeaders & Workspace; + +// @public +export interface WorkspacesDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface WorkspacesGetHeaders { + eTag?: string; +} + +// @public +export interface WorkspacesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesGetResponse = WorkspacesGetHeaders & Workspace; + +// @public +export interface WorkspacesHeadOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesHeadResponse = { + body: boolean; +}; + +// @public +export interface WorkspacesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesListNextResponse = WorkspaceCollection; + +// @public +export interface WorkspacesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesListResponse = WorkspaceCollection; + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/apicenter/arm-apicenter/samples-dev/operationsListSample.ts b/sdk/apicenter/arm-apicenter/samples-dev/operationsListSample.ts deleted file mode 100644 index 80d069634b79..000000000000 --- a/sdk/apicenter/arm-apicenter/samples-dev/operationsListSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples-dev/servicesCreateOrUpdateSample.ts b/sdk/apicenter/arm-apicenter/samples-dev/servicesCreateOrUpdateSample.ts deleted file mode 100644 index fc5521a6b2be..000000000000 --- a/sdk/apicenter/arm-apicenter/samples-dev/servicesCreateOrUpdateSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Create or update service - * - * @summary Create or update service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_CreateOrUpdate.json - */ -async function servicesCreate() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.createOrUpdate( - resourceGroupName, - serviceName - ); - console.log(result); -} - -async function main() { - servicesCreate(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples-dev/servicesDeleteSample.ts b/sdk/apicenter/arm-apicenter/samples-dev/servicesDeleteSample.ts deleted file mode 100644 index 7be37362b69f..000000000000 --- a/sdk/apicenter/arm-apicenter/samples-dev/servicesDeleteSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Delete service - * - * @summary Delete service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Delete.json - */ -async function servicesDelete() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.delete(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesDelete(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples-dev/servicesGetSample.ts b/sdk/apicenter/arm-apicenter/samples-dev/servicesGetSample.ts deleted file mode 100644 index 7374fd731344..000000000000 --- a/sdk/apicenter/arm-apicenter/samples-dev/servicesGetSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get service - * - * @summary Get service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json - */ -async function servicesGet() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.get(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesGet(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples-dev/servicesListByResourceGroupSample.ts b/sdk/apicenter/arm-apicenter/samples-dev/servicesListByResourceGroupSample.ts deleted file mode 100644 index d2ad34d0bd80..000000000000 --- a/sdk/apicenter/arm-apicenter/samples-dev/servicesListByResourceGroupSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists services within a resource group - * - * @summary Lists services within a resource group - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListByResourceGroup.json - */ -async function servicesListByResourceGroup() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.services.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - servicesListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples-dev/servicesListBySubscriptionSample.ts b/sdk/apicenter/arm-apicenter/samples-dev/servicesListBySubscriptionSample.ts deleted file mode 100644 index 57ea59d66c5e..000000000000 --- a/sdk/apicenter/arm-apicenter/samples-dev/servicesListBySubscriptionSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists services within an Azure subscription. - * - * @summary Lists services within an Azure subscription. - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListBySubscription.json - */ -async function servicesListBySubscription() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.services.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - servicesListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples-dev/servicesUpdateSample.ts b/sdk/apicenter/arm-apicenter/samples-dev/servicesUpdateSample.ts deleted file mode 100644 index ab07861480bc..000000000000 --- a/sdk/apicenter/arm-apicenter/samples-dev/servicesUpdateSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Update service - * - * @summary Update service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Update.json - */ -async function servicesUpdate() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.update(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesUpdate(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/README.md b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/README.md deleted file mode 100644 index 460d6106daae..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# client library samples for JavaScript (Beta) - -These sample programs show how to use the JavaScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [operationsListSample.js][operationslistsample] | List the operations for the provider x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Operations_List.json | -| [servicesCreateOrUpdateSample.js][servicescreateorupdatesample] | Create or update service x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_CreateOrUpdate.json | -| [servicesDeleteSample.js][servicesdeletesample] | Delete service x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Delete.json | -| [servicesGetSample.js][servicesgetsample] | Get service x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json | -| [servicesListByResourceGroupSample.js][serviceslistbyresourcegroupsample] | Lists services within a resource group x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListByResourceGroup.json | -| [servicesListBySubscriptionSample.js][serviceslistbysubscriptionsample] | Lists services within an Azure subscription. x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListBySubscription.json | -| [servicesUpdateSample.js][servicesupdatesample] | Update service x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Update.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -3. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node operationsListSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx cross-env APICENTER_SUBSCRIPTION_ID="" node operationsListSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/operationsListSample.js -[servicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesCreateOrUpdateSample.js -[servicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesDeleteSample.js -[servicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesGetSample.js -[serviceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListByResourceGroupSample.js -[serviceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListBySubscriptionSample.js -[servicesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesUpdateSample.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-apicenter?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/apicenter/arm-apicenter/README.md diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/operationsListSample.js b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/operationsListSample.js deleted file mode 100644 index 3d24f801450e..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/operationsListSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureAPICenter } = require("@azure/arm-apicenter"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/package.json b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/package.json deleted file mode 100644 index 5ebde49ade83..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "@azure-samples/arm-apicenter-js-beta", - "private": true, - "version": "1.0.0", - "description": " client library samples for JavaScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/apicenter/arm-apicenter" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/apicenter/arm-apicenter", - "dependencies": { - "@azure/arm-apicenter": "next", - "dotenv": "latest", - "@azure/identity": "^2.0.1" - } -} diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/sample.env b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesCreateOrUpdateSample.js b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesCreateOrUpdateSample.js deleted file mode 100644 index 5e03075a53d4..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesCreateOrUpdateSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureAPICenter } = require("@azure/arm-apicenter"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Create or update service - * - * @summary Create or update service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_CreateOrUpdate.json - */ -async function servicesCreate() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.createOrUpdate(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesCreate(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesDeleteSample.js b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesDeleteSample.js deleted file mode 100644 index 44decf6e44da..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesDeleteSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureAPICenter } = require("@azure/arm-apicenter"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Delete service - * - * @summary Delete service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Delete.json - */ -async function servicesDelete() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.delete(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesDelete(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesGetSample.js b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesGetSample.js deleted file mode 100644 index 123e8fda4120..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesGetSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureAPICenter } = require("@azure/arm-apicenter"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Get service - * - * @summary Get service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json - */ -async function servicesGet() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.get(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesGet(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListByResourceGroupSample.js b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListByResourceGroupSample.js deleted file mode 100644 index eb773c864d00..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListByResourceGroupSample.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureAPICenter } = require("@azure/arm-apicenter"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists services within a resource group - * - * @summary Lists services within a resource group - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListByResourceGroup.json - */ -async function servicesListByResourceGroup() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.services.listByResourceGroup(resourceGroupName)) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - servicesListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListBySubscriptionSample.js b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListBySubscriptionSample.js deleted file mode 100644 index e1d743185cf0..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesListBySubscriptionSample.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureAPICenter } = require("@azure/arm-apicenter"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Lists services within an Azure subscription. - * - * @summary Lists services within an Azure subscription. - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListBySubscription.json - */ -async function servicesListBySubscription() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.services.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - servicesListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesUpdateSample.js b/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesUpdateSample.js deleted file mode 100644 index af94d80e530b..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/javascript/servicesUpdateSample.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -const { AzureAPICenter } = require("@azure/arm-apicenter"); -const { DefaultAzureCredential } = require("@azure/identity"); -require("dotenv").config(); - -/** - * This sample demonstrates how to Update service - * - * @summary Update service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Update.json - */ -async function servicesUpdate() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.update(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesUpdate(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/README.md b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/README.md deleted file mode 100644 index 7b484506e8d8..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# client library samples for TypeScript (Beta) - -These sample programs show how to use the TypeScript client libraries for in some common scenarios. - -| **File Name** | **Description** | -| ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [operationsListSample.ts][operationslistsample] | List the operations for the provider x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Operations_List.json | -| [servicesCreateOrUpdateSample.ts][servicescreateorupdatesample] | Create or update service x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_CreateOrUpdate.json | -| [servicesDeleteSample.ts][servicesdeletesample] | Delete service x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Delete.json | -| [servicesGetSample.ts][servicesgetsample] | Get service x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json | -| [servicesListByResourceGroupSample.ts][serviceslistbyresourcegroupsample] | Lists services within a resource group x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListByResourceGroup.json | -| [servicesListBySubscriptionSample.ts][serviceslistbysubscriptionsample] | Lists services within an Azure subscription. x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListBySubscription.json | -| [servicesUpdateSample.ts][servicesupdatesample] | Update service x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Update.json | - -## Prerequisites - -The sample programs are compatible with [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule). - -Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: - -```bash -npm install -g typescript -``` - -You need [an Azure subscription][freesub] to run these sample programs. - -Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. - -Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. - -## Setup - -To run the samples using the published version of the package: - -1. Install the dependencies using `npm`: - -```bash -npm install -``` - -2. Compile the samples: - -```bash -npm run build -``` - -3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. - -4. Run whichever samples you like (note that some samples may require additional setup, see the table above): - -```bash -node dist/operationsListSample.js -``` - -Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): - -```bash -npx cross-env APICENTER_SUBSCRIPTION_ID="" node dist/operationsListSample.js -``` - -## Next Steps - -Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. - -[operationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/operationsListSample.ts -[servicescreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesCreateOrUpdateSample.ts -[servicesdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesDeleteSample.ts -[servicesgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesGetSample.ts -[serviceslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListByResourceGroupSample.ts -[serviceslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListBySubscriptionSample.ts -[servicesupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesUpdateSample.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-apicenter?view=azure-node-preview -[freesub]: https://azure.microsoft.com/free/ -[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/apicenter/arm-apicenter/README.md -[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/package.json b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/package.json deleted file mode 100644 index f55b5279bf70..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "@azure-samples/arm-apicenter-ts-beta", - "private": true, - "version": "1.0.0", - "description": " client library samples for TypeScript (Beta)", - "engines": { - "node": ">=18.0.0" - }, - "scripts": { - "build": "tsc", - "prebuild": "rimraf dist/" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Azure/azure-sdk-for-js.git", - "directory": "sdk/apicenter/arm-apicenter" - }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], - "author": "Microsoft Corporation", - "license": "MIT", - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/apicenter/arm-apicenter", - "dependencies": { - "@azure/arm-apicenter": "next", - "dotenv": "latest", - "@azure/identity": "^2.0.1" - }, - "devDependencies": { - "@types/node": "^18.0.0", - "typescript": "~5.2.0", - "rimraf": "latest" - } -} diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/sample.env b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/sample.env deleted file mode 100644 index 672847a3fea0..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/sample.env +++ /dev/null @@ -1,4 +0,0 @@ -# App registration secret for AAD authentication -AZURE_CLIENT_SECRET= -AZURE_CLIENT_ID= -AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/operationsListSample.ts b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/operationsListSample.ts deleted file mode 100644 index 80d069634b79..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/operationsListSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to List the operations for the provider - * - * @summary List the operations for the provider - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Operations_List.json - */ -async function operationsList() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - operationsList(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesCreateOrUpdateSample.ts b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesCreateOrUpdateSample.ts deleted file mode 100644 index fc5521a6b2be..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesCreateOrUpdateSample.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Create or update service - * - * @summary Create or update service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_CreateOrUpdate.json - */ -async function servicesCreate() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.createOrUpdate( - resourceGroupName, - serviceName - ); - console.log(result); -} - -async function main() { - servicesCreate(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesDeleteSample.ts b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesDeleteSample.ts deleted file mode 100644 index 7be37362b69f..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesDeleteSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Delete service - * - * @summary Delete service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Delete.json - */ -async function servicesDelete() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.delete(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesDelete(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesGetSample.ts b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesGetSample.ts deleted file mode 100644 index 7374fd731344..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesGetSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Get service - * - * @summary Get service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Get.json - */ -async function servicesGet() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.get(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesGet(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListByResourceGroupSample.ts b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListByResourceGroupSample.ts deleted file mode 100644 index d2ad34d0bd80..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListByResourceGroupSample.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists services within a resource group - * - * @summary Lists services within a resource group - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListByResourceGroup.json - */ -async function servicesListByResourceGroup() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.services.listByResourceGroup( - resourceGroupName - )) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - servicesListByResourceGroup(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListBySubscriptionSample.ts b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListBySubscriptionSample.ts deleted file mode 100644 index 57ea59d66c5e..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesListBySubscriptionSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Lists services within an Azure subscription. - * - * @summary Lists services within an Azure subscription. - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_ListBySubscription.json - */ -async function servicesListBySubscription() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const resArray = new Array(); - for await (let item of client.services.listBySubscription()) { - resArray.push(item); - } - console.log(resArray); -} - -async function main() { - servicesListBySubscription(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesUpdateSample.ts b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesUpdateSample.ts deleted file mode 100644 index ab07861480bc..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/src/servicesUpdateSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -import { AzureAPICenter } from "@azure/arm-apicenter"; -import { DefaultAzureCredential } from "@azure/identity"; -import * as dotenv from "dotenv"; - -dotenv.config(); - -/** - * This sample demonstrates how to Update service - * - * @summary Update service - * x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/preview/2023-07-01-preview/examples/Services_Update.json - */ -async function servicesUpdate() { - const subscriptionId = - process.env["APICENTER_SUBSCRIPTION_ID"] || - "00000000-0000-0000-0000-000000000000"; - const resourceGroupName = - process.env["APICENTER_RESOURCE_GROUP"] || "contoso-resources"; - const serviceName = "contoso"; - const credential = new DefaultAzureCredential(); - const client = new AzureAPICenter(credential, subscriptionId); - const result = await client.services.update(resourceGroupName, serviceName); - console.log(result); -} - -async function main() { - servicesUpdate(); -} - -main().catch(console.error); diff --git a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/tsconfig.json b/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/tsconfig.json deleted file mode 100644 index e26ce2a6d8f7..000000000000 --- a/sdk/apicenter/arm-apicenter/samples/v1-beta/typescript/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "module": "commonjs", - "moduleResolution": "node", - "resolveJsonModule": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "alwaysStrict": true, - "outDir": "dist", - "rootDir": "src" - }, - "include": [ - "src/**.ts" - ] -} diff --git a/sdk/apicenter/arm-apicenter/src/azureAPICenter.ts b/sdk/apicenter/arm-apicenter/src/azureAPICenter.ts index 40682b022a8e..63334fa50248 100644 --- a/sdk/apicenter/arm-apicenter/src/azureAPICenter.ts +++ b/sdk/apicenter/arm-apicenter/src/azureAPICenter.ts @@ -11,28 +11,70 @@ import * as coreRestPipeline from "@azure/core-rest-pipeline"; import { PipelineRequest, PipelineResponse, - SendRequest + SendRequest, } from "@azure/core-rest-pipeline"; import * as coreAuth from "@azure/core-auth"; -import { OperationsImpl, ServicesImpl } from "./operations"; -import { Operations, Services } from "./operationsInterfaces"; +import { + OperationsImpl, + ServicesImpl, + MetadataSchemasImpl, + WorkspacesImpl, + ApisImpl, + ApiVersionsImpl, + ApiDefinitionsImpl, + DeploymentsImpl, + EnvironmentsImpl, +} from "./operations"; +import { + Operations, + Services, + MetadataSchemas, + Workspaces, + Apis, + ApiVersions, + ApiDefinitions, + Deployments, + Environments, +} from "./operationsInterfaces"; import { AzureAPICenterOptionalParams } from "./models"; export class AzureAPICenter extends coreClient.ServiceClient { $host: string; apiVersion: string; subscriptionId: string; + filter?: string; + metadataSchemaName: string; + workspaceName: string; + apiName: string; + versionName: string; + definitionName: string; + deploymentName: string; + environmentName: string; /** * Initializes a new instance of the AzureAPICenter class. * @param credentials Subscription credentials which uniquely identify client subscription. - * @param subscriptionId The ID of the target subscription. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param metadataSchemaName The name of the metadata schema. + * @param workspaceName The name of the workspace. + * @param apiName The name of the API. + * @param versionName The name of the API version. + * @param definitionName The name of the API definition. + * @param deploymentName The name of the API deployment. + * @param environmentName The name of the environment. * @param options The parameter options */ constructor( credentials: coreAuth.TokenCredential, subscriptionId: string, - options?: AzureAPICenterOptionalParams + metadataSchemaName: string, + workspaceName: string, + apiName: string, + versionName: string, + definitionName: string, + deploymentName: string, + environmentName: string, + options?: AzureAPICenterOptionalParams, ) { if (credentials === undefined) { throw new Error("'credentials' cannot be null"); @@ -40,6 +82,27 @@ export class AzureAPICenter extends coreClient.ServiceClient { if (subscriptionId === undefined) { throw new Error("'subscriptionId' cannot be null"); } + if (metadataSchemaName === undefined) { + throw new Error("'metadataSchemaName' cannot be null"); + } + if (workspaceName === undefined) { + throw new Error("'workspaceName' cannot be null"); + } + if (apiName === undefined) { + throw new Error("'apiName' cannot be null"); + } + if (versionName === undefined) { + throw new Error("'versionName' cannot be null"); + } + if (definitionName === undefined) { + throw new Error("'definitionName' cannot be null"); + } + if (deploymentName === undefined) { + throw new Error("'deploymentName' cannot be null"); + } + if (environmentName === undefined) { + throw new Error("'environmentName' cannot be null"); + } // Initializing default values for options if (!options) { @@ -47,10 +110,10 @@ export class AzureAPICenter extends coreClient.ServiceClient { } const defaults: AzureAPICenterOptionalParams = { requestContentType: "application/json; charset=utf-8", - credential: credentials + credential: credentials, }; - const packageDetails = `azsdk-js-arm-apicenter/1.0.0-beta.1`; + const packageDetails = `azsdk-js-arm-apicenter/1.0.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -60,20 +123,21 @@ export class AzureAPICenter extends coreClient.ServiceClient { ...defaults, ...options, userAgentOptions: { - userAgentPrefix + userAgentPrefix, }, endpoint: - options.endpoint ?? options.baseUri ?? "https://management.azure.com" + options.endpoint ?? options.baseUri ?? "https://management.azure.com", }; super(optionsWithDefaults); let bearerTokenAuthenticationPolicyFound: boolean = false; if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = + options.pipeline.getOrderedPolicies(); bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( (pipelinePolicy) => pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName + coreRestPipeline.bearerTokenAuthenticationPolicyName, ); } if ( @@ -83,7 +147,7 @@ export class AzureAPICenter extends coreClient.ServiceClient { !bearerTokenAuthenticationPolicyFound ) { this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName + name: coreRestPipeline.bearerTokenAuthenticationPolicyName, }); this.pipeline.addPolicy( coreRestPipeline.bearerTokenAuthenticationPolicy({ @@ -93,19 +157,33 @@ export class AzureAPICenter extends coreClient.ServiceClient { `${optionsWithDefaults.endpoint}/.default`, challengeCallbacks: { authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) + coreClient.authorizeRequestOnClaimChallenge, + }, + }), ); } // Parameter assignments this.subscriptionId = subscriptionId; + this.metadataSchemaName = metadataSchemaName; + this.workspaceName = workspaceName; + this.apiName = apiName; + this.versionName = versionName; + this.definitionName = definitionName; + this.deploymentName = deploymentName; + this.environmentName = environmentName; // Assigning values to Constant parameters this.$host = options.$host || "https://management.azure.com"; - this.apiVersion = options.apiVersion || "2023-07-01-preview"; + this.apiVersion = options.apiVersion || "2024-03-01"; this.operations = new OperationsImpl(this); this.services = new ServicesImpl(this); + this.metadataSchemas = new MetadataSchemasImpl(this); + this.workspaces = new WorkspacesImpl(this); + this.apis = new ApisImpl(this); + this.apiVersions = new ApiVersionsImpl(this); + this.apiDefinitions = new ApiDefinitionsImpl(this); + this.deployments = new DeploymentsImpl(this); + this.environments = new EnvironmentsImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); } @@ -118,7 +196,7 @@ export class AzureAPICenter extends coreClient.ServiceClient { name: "CustomApiVersionPolicy", async sendRequest( request: PipelineRequest, - next: SendRequest + next: SendRequest, ): Promise { const param = request.url.split("?"); if (param.length > 1) { @@ -132,11 +210,18 @@ export class AzureAPICenter extends coreClient.ServiceClient { request.url = param[0] + "?" + newParams.join("&"); } return next(request); - } + }, }; this.pipeline.addPolicy(apiVersionPolicy); } operations: Operations; services: Services; + metadataSchemas: MetadataSchemas; + workspaces: Workspaces; + apis: Apis; + apiVersions: ApiVersions; + apiDefinitions: ApiDefinitions; + deployments: Deployments; + environments: Environments; } diff --git a/sdk/apicenter/arm-apicenter/src/models/index.ts b/sdk/apicenter/arm-apicenter/src/models/index.ts index ceeef426587a..4c313e588549 100644 --- a/sdk/apicenter/arm-apicenter/src/models/index.ts +++ b/sdk/apicenter/arm-apicenter/src/models/index.ts @@ -129,6 +129,15 @@ export interface ServiceCollection { nextLink?: string; } +/** The properties of the service. */ +export interface ServiceProperties { + /** + * Provisioning state of the service. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + /** Managed service identity (system assigned and/or user assigned identities) */ export interface ManagedServiceIdentity { /** @@ -205,11 +214,307 @@ export interface SystemData { /** The service properties to be updated. */ export interface ServiceUpdate { + /** The properties of the service. */ + properties?: ServiceProperties; +} + +/** The metadata schema export request. */ +export interface MetadataSchemaExportRequest { + /** An entity the metadata schema is requested for. */ + assignedTo?: MetadataAssignmentEntity; +} + +/** The metadata schema export result. */ +export interface MetadataSchemaExportResult { + format?: MetadataSchemaExportFormat; + /** The result of the export operation. */ + value?: string; +} + +/** Paginated collection of metadata schemas. */ +export interface MetadataSchemaCollection { /** - * The status of the last operation. + * Page items. * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly provisioningState?: ProvisioningState; + readonly value?: MetadataSchema[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Metadata schema properties. */ +export interface MetadataSchemaProperties { + /** The schema defining the type. */ + schema: string; + assignedTo?: MetadataAssignment[]; +} + +export interface MetadataAssignment { + /** The entities this metadata schema component gets applied to. */ + entity?: MetadataAssignmentEntity; + required?: boolean; + deprecated?: boolean; +} + +/** Paginated collection of workspaces. */ +export interface WorkspaceCollection { + /** + * Page items. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Workspace[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Workspace properties. */ +export interface WorkspaceProperties { + /** Workspace title. */ + title: string; + /** Workspace description. */ + description?: string; +} + +/** Paginated collection of APIs. */ +export interface ApiCollection { + /** + * Page items. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Api[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** API properties. */ +export interface ApiProperties { + /** API title. */ + title: string; + /** Kind of API. For example, REST or GraphQL. */ + kind: ApiKind; + /** Description of the API. */ + description?: string; + /** Short description of the API. */ + summary?: string; + /** + * Current lifecycle stage of the API. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lifecycleStage?: LifecycleStage; + /** Terms of service for the API. */ + termsOfService?: TermsOfService; + externalDocumentation?: ExternalDocumentation[]; + contacts?: Contact[]; + /** The license information for the API. */ + license?: License; + /** The custom metadata defined for API catalog entities. */ + customProperties?: Record; +} + +/** Terms of service for the API. */ +export interface TermsOfService { + /** URL pointing to the terms of service. */ + url: string; +} + +/** Additional, external documentation for the API. */ +export interface ExternalDocumentation { + /** Title of the documentation. */ + title?: string; + /** Description of the documentation. */ + description?: string; + /** URL pointing to the documentation. */ + url: string; +} + +export interface Contact { + /** Name of the contact. */ + name?: string; + /** URL for the contact. */ + url?: string; + /** Email address of the contact. */ + email?: string; +} + +/** The license information for the API. */ +export interface License { + /** Name of the license. */ + name?: string; + /** URL pointing to the license details. The URL field is mutually exclusive of the identifier field. */ + url?: string; + /** SPDX license information for the API. The identifier field is mutually exclusive of the URL field. */ + identifier?: string; +} + +/** Paginated collection of API versions. */ +export interface ApiVersionCollection { + /** + * Page items. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: ApiVersion[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** API version properties entity. */ +export interface ApiVersionProperties { + /** API version title. */ + title: string; + /** Current lifecycle stage of the API. */ + lifecycleStage: LifecycleStage; +} + +/** Paginated collection of API definitions. */ +export interface ApiDefinitionCollection { + /** + * Page items. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: ApiDefinition[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** API definition properties entity. */ +export interface ApiDefinitionProperties { + /** API definition title. */ + title: string; + /** API definition description. */ + description?: string; + /** + * API specification details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly specification?: ApiDefinitionPropertiesSpecification; +} + +/** API specification details. */ +export interface ApiDefinitionPropertiesSpecification { + /** Specification name. */ + name?: string; + /** Specification version. */ + version?: string; +} + +/** The API specification source entity properties. */ +export interface ApiSpecImportRequest { + /** Value of the API specification source. */ + value?: string; + /** Format of the API specification source. */ + format?: ApiSpecImportSourceFormat; + /** API specification details. */ + specification?: ApiSpecImportRequestSpecification; +} + +/** API specification details. */ +export interface ApiSpecImportRequestSpecification { + /** Specification name. */ + name?: string; + /** Specification version. */ + version?: string; +} + +/** The API specification export result. */ +export interface ApiSpecExportResult { + format?: ApiSpecExportResultFormat; + /** The result of the export operation. */ + value?: string; +} + +/** Paginated collection of API deployments. */ +export interface DeploymentCollection { + /** + * Page items. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Deployment[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** API deployment entity properties. */ +export interface DeploymentProperties { + /** API deployment title */ + title?: string; + /** Description of the deployment. */ + description?: string; + /** API center-scoped environment resource ID. */ + environmentId?: string; + /** API center-scoped definition resource ID. */ + definitionId?: string; + /** State of API deployment. */ + state?: DeploymentState; + /** Server */ + server?: DeploymentServer; + /** The custom metadata defined for API catalog entities. */ + customProperties?: Record; +} + +/** Server */ +export interface DeploymentServer { + /** Base runtime URLs for this deployment. */ + runtimeUri?: string[]; +} + +/** Paginated collection of environments. */ +export interface EnvironmentCollection { + /** + * Page items. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Environment[]; + /** + * The link to the next page of items + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Environment properties entity. */ +export interface EnvironmentProperties { + /** Environment title. */ + title: string; + /** Description. */ + description?: string; + /** Environment kind. */ + kind: EnvironmentKind; + /** Server information of the environment. */ + server?: EnvironmentServer; + onboarding?: Onboarding; + /** The custom metadata defined for API catalog entities. */ + customProperties?: Record; +} + +/** Server information of the environment. */ +export interface EnvironmentServer { + /** Type of the server that represents the environment. */ + type?: EnvironmentServerType; + managementPortalUri?: string[]; +} + +export interface Onboarding { + /** Onboarding guide. */ + instructions?: string; + developerPortalUri?: string[]; } /** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ @@ -220,15 +525,138 @@ export interface TrackedResource extends Resource { location: string; } +/** Metadata schema entity. Used to define metadata for the entities in API catalog. */ +export interface MetadataSchema extends Resource { + /** Metadata schema properties. */ + properties?: MetadataSchemaProperties; +} + +/** Workspace entity. */ +export interface Workspace extends Resource { + /** Workspace properties. */ + properties?: WorkspaceProperties; +} + +/** API entity. */ +export interface Api extends Resource { + /** API properties. */ + properties?: ApiProperties; +} + +/** API version entity. */ +export interface ApiVersion extends Resource { + /** API version properties entity. */ + properties?: ApiVersionProperties; +} + +/** API definition entity. */ +export interface ApiDefinition extends Resource { + /** API definition properties entity. */ + properties?: ApiDefinitionProperties; +} + +/** API deployment entity. */ +export interface Deployment extends Resource { + /** API deployment entity properties. */ + properties?: DeploymentProperties; +} + +/** Environment entity. */ +export interface Environment extends Resource { + /** Environment properties entity. */ + properties?: EnvironmentProperties; +} + /** The service entity. */ export interface Service extends TrackedResource { - /** The identity of the service. */ + /** The properties of the service. */ + properties?: ServiceProperties; + /** Managed service identity (system assigned and/or user assigned identities) */ identity?: ManagedServiceIdentity; - /** - * The status of the last operation. - * NOTE: This property will not be serialized. It can only be populated by the server. - */ - readonly provisioningState?: ProvisioningState; +} + +/** Defines headers for MetadataSchemas_get operation. */ +export interface MetadataSchemasGetHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for MetadataSchemas_createOrUpdate operation. */ +export interface MetadataSchemasCreateOrUpdateHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Workspaces_get operation. */ +export interface WorkspacesGetHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Workspaces_createOrUpdate operation. */ +export interface WorkspacesCreateOrUpdateHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Apis_get operation. */ +export interface ApisGetHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Apis_createOrUpdate operation. */ +export interface ApisCreateOrUpdateHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for ApiVersions_get operation. */ +export interface ApiVersionsGetHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for ApiVersions_createOrUpdate operation. */ +export interface ApiVersionsCreateOrUpdateHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for ApiDefinitions_get operation. */ +export interface ApiDefinitionsGetHeaders { + /** Current entity state definition. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for ApiDefinitions_createOrUpdate operation. */ +export interface ApiDefinitionsCreateOrUpdateHeaders { + /** Current entity state definition. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Deployments_get operation. */ +export interface DeploymentsGetHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Deployments_createOrUpdate operation. */ +export interface DeploymentsCreateOrUpdateHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Environments_createOrUpdate operation. */ +export interface EnvironmentsCreateOrUpdateHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Environments_get operation. */ +export interface EnvironmentsGetHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; } /** Known values of {@link Origin} that the service accepts. */ @@ -238,7 +666,7 @@ export enum KnownOrigin { /** System */ System = "system", /** UserSystem */ - UserSystem = "user,system" + UserSystem = "user,system", } /** @@ -255,7 +683,7 @@ export type Origin = string; /** Known values of {@link ActionType} that the service accepts. */ export enum KnownActionType { /** Internal */ - Internal = "Internal" + Internal = "Internal", } /** @@ -274,7 +702,7 @@ export enum KnownProvisioningState { /** Failed */ Failed = "Failed", /** Canceled */ - Canceled = "Canceled" + Canceled = "Canceled", } /** @@ -297,7 +725,7 @@ export enum KnownManagedServiceIdentityType { /** UserAssigned */ UserAssigned = "UserAssigned", /** SystemAssignedUserAssigned */ - SystemAssignedUserAssigned = "SystemAssigned,UserAssigned" + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", } /** @@ -321,7 +749,7 @@ export enum KnownCreatedByType { /** ManagedIdentity */ ManagedIdentity = "ManagedIdentity", /** Key */ - Key = "Key" + Key = "Key", } /** @@ -336,6 +764,219 @@ export enum KnownCreatedByType { */ export type CreatedByType = string; +/** Known values of {@link MetadataAssignmentEntity} that the service accepts. */ +export enum KnownMetadataAssignmentEntity { + /** Api */ + Api = "api", + /** Environment */ + Environment = "environment", + /** Deployment */ + Deployment = "deployment", +} + +/** + * Defines values for MetadataAssignmentEntity. \ + * {@link KnownMetadataAssignmentEntity} can be used interchangeably with MetadataAssignmentEntity, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **api** \ + * **environment** \ + * **deployment** + */ +export type MetadataAssignmentEntity = string; + +/** Known values of {@link MetadataSchemaExportFormat} that the service accepts. */ +export enum KnownMetadataSchemaExportFormat { + /** The inlined content of a schema document. */ + Inline = "inline", + /** The link to a schema document. The URL is valid for 5 minutes. */ + Link = "link", +} + +/** + * Defines values for MetadataSchemaExportFormat. \ + * {@link KnownMetadataSchemaExportFormat} can be used interchangeably with MetadataSchemaExportFormat, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **inline**: The inlined content of a schema document. \ + * **link**: The link to a schema document. The URL is valid for 5 minutes. + */ +export type MetadataSchemaExportFormat = string; + +/** Known values of {@link ApiKind} that the service accepts. */ +export enum KnownApiKind { + /** Rest */ + Rest = "rest", + /** Graphql */ + Graphql = "graphql", + /** Grpc */ + Grpc = "grpc", + /** Soap */ + Soap = "soap", + /** Webhook */ + Webhook = "webhook", + /** Websocket */ + Websocket = "websocket", +} + +/** + * Defines values for ApiKind. \ + * {@link KnownApiKind} can be used interchangeably with ApiKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **rest** \ + * **graphql** \ + * **grpc** \ + * **soap** \ + * **webhook** \ + * **websocket** + */ +export type ApiKind = string; + +/** Known values of {@link LifecycleStage} that the service accepts. */ +export enum KnownLifecycleStage { + /** Design */ + Design = "design", + /** Development */ + Development = "development", + /** Testing */ + Testing = "testing", + /** Preview */ + Preview = "preview", + /** Production */ + Production = "production", + /** Deprecated */ + Deprecated = "deprecated", + /** Retired */ + Retired = "retired", +} + +/** + * Defines values for LifecycleStage. \ + * {@link KnownLifecycleStage} can be used interchangeably with LifecycleStage, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **design** \ + * **development** \ + * **testing** \ + * **preview** \ + * **production** \ + * **deprecated** \ + * **retired** + */ +export type LifecycleStage = string; + +/** Known values of {@link ApiSpecImportSourceFormat} that the service accepts. */ +export enum KnownApiSpecImportSourceFormat { + /** The inlined content of a specification document. */ + Inline = "inline", + /** The link to a specification document hosted on a publicly accessible internet address. */ + Link = "link", +} + +/** + * Defines values for ApiSpecImportSourceFormat. \ + * {@link KnownApiSpecImportSourceFormat} can be used interchangeably with ApiSpecImportSourceFormat, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **inline**: The inlined content of a specification document. \ + * **link**: The link to a specification document hosted on a publicly accessible internet address. + */ +export type ApiSpecImportSourceFormat = string; + +/** Known values of {@link ApiSpecExportResultFormat} that the service accepts. */ +export enum KnownApiSpecExportResultFormat { + /** The inlined content of a specification document. */ + Inline = "inline", + /** The link to the result of the export operation. The URL is valid for 5 minutes. */ + Link = "link", +} + +/** + * Defines values for ApiSpecExportResultFormat. \ + * {@link KnownApiSpecExportResultFormat} can be used interchangeably with ApiSpecExportResultFormat, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **inline**: The inlined content of a specification document. \ + * **link**: The link to the result of the export operation. The URL is valid for 5 minutes. + */ +export type ApiSpecExportResultFormat = string; + +/** Known values of {@link DeploymentState} that the service accepts. */ +export enum KnownDeploymentState { + /** Active */ + Active = "active", + /** Inactive */ + Inactive = "inactive", +} + +/** + * Defines values for DeploymentState. \ + * {@link KnownDeploymentState} can be used interchangeably with DeploymentState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **active** \ + * **inactive** + */ +export type DeploymentState = string; + +/** Known values of {@link EnvironmentKind} that the service accepts. */ +export enum KnownEnvironmentKind { + /** Development */ + Development = "development", + /** Testing */ + Testing = "testing", + /** Staging */ + Staging = "staging", + /** Production */ + Production = "production", +} + +/** + * Defines values for EnvironmentKind. \ + * {@link KnownEnvironmentKind} can be used interchangeably with EnvironmentKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **development** \ + * **testing** \ + * **staging** \ + * **production** + */ +export type EnvironmentKind = string; + +/** Known values of {@link EnvironmentServerType} that the service accepts. */ +export enum KnownEnvironmentServerType { + /** AzureAPIManagement */ + AzureAPIManagement = "Azure API Management", + /** AzureComputeService */ + AzureComputeService = "Azure compute service", + /** ApigeeAPIManagement */ + ApigeeAPIManagement = "Apigee API Management", + /** AWSAPIGateway */ + AWSAPIGateway = "AWS API Gateway", + /** KongAPIGateway */ + KongAPIGateway = "Kong API Gateway", + /** Kubernetes */ + Kubernetes = "Kubernetes", + /** MuleSoftAPIManagement */ + MuleSoftAPIManagement = "MuleSoft API Management", +} + +/** + * Defines values for EnvironmentServerType. \ + * {@link KnownEnvironmentServerType} can be used interchangeably with EnvironmentServerType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Azure API Management** \ + * **Azure compute service** \ + * **Apigee API Management** \ + * **AWS API Gateway** \ + * **Kong API Gateway** \ + * **Kubernetes** \ + * **MuleSoft API Management** + */ +export type EnvironmentServerType = string; + /** Optional parameters. */ export interface OperationsListOptionalParams extends coreClient.OperationOptions {} @@ -375,7 +1016,7 @@ export type ServicesGetResponse = Service; export interface ServicesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { /** The service entity. */ - resource?: Service; + payload?: Service; } /** Contains response data for the createOrUpdate operation. */ @@ -385,7 +1026,7 @@ export type ServicesCreateOrUpdateResponse = Service; export interface ServicesUpdateOptionalParams extends coreClient.OperationOptions { /** The service properties to be updated. */ - parameters?: ServiceUpdate; + payload?: ServiceUpdate; } /** Contains response data for the update operation. */ @@ -395,6 +1036,13 @@ export type ServicesUpdateResponse = Service; export interface ServicesDeleteOptionalParams extends coreClient.OperationOptions {} +/** Optional parameters. */ +export interface ServicesExportMetadataSchemaOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the exportMetadataSchema operation. */ +export type ServicesExportMetadataSchemaResponse = MetadataSchemaExportResult; + /** Optional parameters. */ export interface ServicesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions {} @@ -409,6 +1057,308 @@ export interface ServicesListByResourceGroupNextOptionalParams /** Contains response data for the listByResourceGroupNext operation. */ export type ServicesListByResourceGroupNextResponse = ServiceCollection; +/** Optional parameters. */ +export interface MetadataSchemasListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type MetadataSchemasListResponse = MetadataSchemaCollection; + +/** Optional parameters. */ +export interface MetadataSchemasGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type MetadataSchemasGetResponse = MetadataSchemasGetHeaders & + MetadataSchema; + +/** Optional parameters. */ +export interface MetadataSchemasCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type MetadataSchemasCreateOrUpdateResponse = + MetadataSchemasCreateOrUpdateHeaders & MetadataSchema; + +/** Optional parameters. */ +export interface MetadataSchemasDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface MetadataSchemasHeadOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the head operation. */ +export type MetadataSchemasHeadResponse = { + body: boolean; +}; + +/** Optional parameters. */ +export interface MetadataSchemasListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type MetadataSchemasListNextResponse = MetadataSchemaCollection; + +/** Optional parameters. */ +export interface WorkspacesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type WorkspacesListResponse = WorkspaceCollection; + +/** Optional parameters. */ +export interface WorkspacesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type WorkspacesGetResponse = WorkspacesGetHeaders & Workspace; + +/** Optional parameters. */ +export interface WorkspacesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type WorkspacesCreateOrUpdateResponse = WorkspacesCreateOrUpdateHeaders & + Workspace; + +/** Optional parameters. */ +export interface WorkspacesDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface WorkspacesHeadOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the head operation. */ +export type WorkspacesHeadResponse = { + body: boolean; +}; + +/** Optional parameters. */ +export interface WorkspacesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type WorkspacesListNextResponse = WorkspaceCollection; + +/** Optional parameters. */ +export interface ApisListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ApisListResponse = ApiCollection; + +/** Optional parameters. */ +export interface ApisGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ApisGetResponse = ApisGetHeaders & Api; + +/** Optional parameters. */ +export interface ApisCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type ApisCreateOrUpdateResponse = ApisCreateOrUpdateHeaders & Api; + +/** Optional parameters. */ +export interface ApisDeleteOptionalParams extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ApisHeadOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the head operation. */ +export type ApisHeadResponse = { + body: boolean; +}; + +/** Optional parameters. */ +export interface ApisListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ApisListNextResponse = ApiCollection; + +/** Optional parameters. */ +export interface ApiVersionsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ApiVersionsListResponse = ApiVersionCollection; + +/** Optional parameters. */ +export interface ApiVersionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ApiVersionsGetResponse = ApiVersionsGetHeaders & ApiVersion; + +/** Optional parameters. */ +export interface ApiVersionsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type ApiVersionsCreateOrUpdateResponse = + ApiVersionsCreateOrUpdateHeaders & ApiVersion; + +/** Optional parameters. */ +export interface ApiVersionsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ApiVersionsHeadOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the head operation. */ +export type ApiVersionsHeadResponse = { + body: boolean; +}; + +/** Optional parameters. */ +export interface ApiVersionsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ApiVersionsListNextResponse = ApiVersionCollection; + +/** Optional parameters. */ +export interface ApiDefinitionsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ApiDefinitionsListResponse = ApiDefinitionCollection; + +/** Optional parameters. */ +export interface ApiDefinitionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ApiDefinitionsGetResponse = ApiDefinitionsGetHeaders & + ApiDefinition; + +/** Optional parameters. */ +export interface ApiDefinitionsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type ApiDefinitionsCreateOrUpdateResponse = + ApiDefinitionsCreateOrUpdateHeaders & ApiDefinition; + +/** Optional parameters. */ +export interface ApiDefinitionsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ApiDefinitionsHeadOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the head operation. */ +export type ApiDefinitionsHeadResponse = { + body: boolean; +}; + +/** Optional parameters. */ +export interface ApiDefinitionsImportSpecificationOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface ApiDefinitionsExportSpecificationOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the exportSpecification operation. */ +export type ApiDefinitionsExportSpecificationResponse = ApiSpecExportResult; + +/** Optional parameters. */ +export interface ApiDefinitionsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ApiDefinitionsListNextResponse = ApiDefinitionCollection; + +/** Optional parameters. */ +export interface DeploymentsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type DeploymentsListResponse = DeploymentCollection; + +/** Optional parameters. */ +export interface DeploymentsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface DeploymentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type DeploymentsGetResponse = DeploymentsGetHeaders & Deployment; + +/** Optional parameters. */ +export interface DeploymentsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type DeploymentsCreateOrUpdateResponse = + DeploymentsCreateOrUpdateHeaders & Deployment; + +/** Optional parameters. */ +export interface DeploymentsHeadOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the head operation. */ +export type DeploymentsHeadResponse = { + body: boolean; +}; + +/** Optional parameters. */ +export interface DeploymentsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type DeploymentsListNextResponse = DeploymentCollection; + +/** Optional parameters. */ +export interface EnvironmentsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type EnvironmentsListResponse = EnvironmentCollection; + +/** Optional parameters. */ +export interface EnvironmentsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type EnvironmentsCreateOrUpdateResponse = + EnvironmentsCreateOrUpdateHeaders & Environment; + +/** Optional parameters. */ +export interface EnvironmentsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface EnvironmentsHeadOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the head operation. */ +export type EnvironmentsHeadResponse = { + body: boolean; +}; + +/** Optional parameters. */ +export interface EnvironmentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type EnvironmentsGetResponse = EnvironmentsGetHeaders & Environment; + +/** Optional parameters. */ +export interface EnvironmentsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type EnvironmentsListNextResponse = EnvironmentCollection; + /** Optional parameters. */ export interface AzureAPICenterOptionalParams extends coreClient.ServiceClientOptions { @@ -416,6 +1366,8 @@ export interface AzureAPICenterOptionalParams $host?: string; /** Api Version */ apiVersion?: string; + /** OData filter parameter. */ + filter?: string; /** Overrides client endpoint. */ endpoint?: string; } diff --git a/sdk/apicenter/arm-apicenter/src/models/mappers.ts b/sdk/apicenter/arm-apicenter/src/models/mappers.ts index 1e186610f695..a29680bfab56 100644 --- a/sdk/apicenter/arm-apicenter/src/models/mappers.ts +++ b/sdk/apicenter/arm-apicenter/src/models/mappers.ts @@ -21,20 +21,20 @@ export const OperationListResult: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Operation" - } - } - } + className: "Operation", + }, + }, + }, }, nextLink: { serializedName: "nextLink", readOnly: true, type: { - name: "String" - } - } - } - } + name: "String", + }, + }, + }, + }, }; export const Operation: coreClient.CompositeMapper = { @@ -46,39 +46,39 @@ export const Operation: coreClient.CompositeMapper = { serializedName: "name", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, isDataAction: { serializedName: "isDataAction", readOnly: true, type: { - name: "Boolean" - } + name: "Boolean", + }, }, display: { serializedName: "display", type: { name: "Composite", - className: "OperationDisplay" - } + className: "OperationDisplay", + }, }, origin: { serializedName: "origin", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, actionType: { serializedName: "actionType", readOnly: true, type: { - name: "String" - } - } - } - } + name: "String", + }, + }, + }, + }, }; export const OperationDisplay: coreClient.CompositeMapper = { @@ -90,32 +90,32 @@ export const OperationDisplay: coreClient.CompositeMapper = { serializedName: "provider", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, resource: { serializedName: "resource", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, operation: { serializedName: "operation", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, description: { serializedName: "description", readOnly: true, type: { - name: "String" - } - } - } - } + name: "String", + }, + }, + }, + }, }; export const ErrorResponse: coreClient.CompositeMapper = { @@ -127,11 +127,11 @@ export const ErrorResponse: coreClient.CompositeMapper = { serializedName: "error", type: { name: "Composite", - className: "ErrorDetail" - } - } - } - } + className: "ErrorDetail", + }, + }, + }, + }, }; export const ErrorDetail: coreClient.CompositeMapper = { @@ -143,22 +143,22 @@ export const ErrorDetail: coreClient.CompositeMapper = { serializedName: "code", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, message: { serializedName: "message", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, target: { serializedName: "target", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, details: { serializedName: "details", @@ -168,10 +168,10 @@ export const ErrorDetail: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "ErrorDetail" - } - } - } + className: "ErrorDetail", + }, + }, + }, }, additionalInfo: { serializedName: "additionalInfo", @@ -181,13 +181,13 @@ export const ErrorDetail: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "ErrorAdditionalInfo" - } - } - } - } - } - } + className: "ErrorAdditionalInfo", + }, + }, + }, + }, + }, + }, }; export const ErrorAdditionalInfo: coreClient.CompositeMapper = { @@ -199,19 +199,19 @@ export const ErrorAdditionalInfo: coreClient.CompositeMapper = { serializedName: "type", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, info: { serializedName: "info", readOnly: true, type: { name: "Dictionary", - value: { type: { name: "any" } } - } - } - } - } + value: { type: { name: "any" } }, + }, + }, + }, + }, }; export const ServiceCollection: coreClient.CompositeMapper = { @@ -227,19 +227,35 @@ export const ServiceCollection: coreClient.CompositeMapper = { element: { type: { name: "Composite", - className: "Service" - } - } - } + className: "Service", + }, + }, + }, }, nextLink: { serializedName: "nextLink", type: { - name: "String" - } - } - } - } + name: "String", + }, + }, + }, + }, +}; + +export const ServiceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServiceProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, }; export const ManagedServiceIdentity: coreClient.CompositeMapper = { @@ -251,34 +267,34 @@ export const ManagedServiceIdentity: coreClient.CompositeMapper = { serializedName: "principalId", readOnly: true, type: { - name: "Uuid" - } + name: "Uuid", + }, }, tenantId: { serializedName: "tenantId", readOnly: true, type: { - name: "Uuid" - } + name: "Uuid", + }, }, type: { serializedName: "type", required: true, type: { - name: "String" - } + name: "String", + }, }, userAssignedIdentities: { serializedName: "userAssignedIdentities", type: { name: "Dictionary", value: { - type: { name: "Composite", className: "UserAssignedIdentity" } - } - } - } - } - } + type: { name: "Composite", className: "UserAssignedIdentity" }, + }, + }, + }, + }, + }, }; export const UserAssignedIdentity: coreClient.CompositeMapper = { @@ -290,18 +306,18 @@ export const UserAssignedIdentity: coreClient.CompositeMapper = { serializedName: "principalId", readOnly: true, type: { - name: "Uuid" - } + name: "Uuid", + }, }, clientId: { serializedName: "clientId", readOnly: true, type: { - name: "Uuid" - } - } - } - } + name: "Uuid", + }, + }, + }, + }, }; export const Resource: coreClient.CompositeMapper = { @@ -313,32 +329,32 @@ export const Resource: coreClient.CompositeMapper = { serializedName: "id", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, name: { serializedName: "name", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, type: { serializedName: "type", readOnly: true, type: { - name: "String" - } + name: "String", + }, }, systemData: { serializedName: "systemData", type: { name: "Composite", - className: "SystemData" - } - } - } - } + className: "SystemData", + }, + }, + }, + }, }; export const SystemData: coreClient.CompositeMapper = { @@ -349,41 +365,41 @@ export const SystemData: coreClient.CompositeMapper = { createdBy: { serializedName: "createdBy", type: { - name: "String" - } + name: "String", + }, }, createdByType: { serializedName: "createdByType", type: { - name: "String" - } + name: "String", + }, }, createdAt: { serializedName: "createdAt", type: { - name: "DateTime" - } + name: "DateTime", + }, }, lastModifiedBy: { serializedName: "lastModifiedBy", type: { - name: "String" - } + name: "String", + }, }, lastModifiedByType: { serializedName: "lastModifiedByType", type: { - name: "String" - } + name: "String", + }, }, lastModifiedAt: { serializedName: "lastModifiedAt", type: { - name: "DateTime" - } - } - } - } + name: "DateTime", + }, + }, + }, + }, }; export const ServiceUpdate: coreClient.CompositeMapper = { @@ -391,61 +407,1286 @@ export const ServiceUpdate: coreClient.CompositeMapper = { name: "Composite", className: "ServiceUpdate", modelProperties: { - provisioningState: { - serializedName: "properties.provisioningState", + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ServiceProperties", + }, + }, + }, + }, +}; + +export const MetadataSchemaExportRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetadataSchemaExportRequest", + modelProperties: { + assignedTo: { + serializedName: "assignedTo", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const MetadataSchemaExportResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetadataSchemaExportResult", + modelProperties: { + format: { + serializedName: "format", + type: { + name: "String", + }, + }, + value: { + serializedName: "value", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const MetadataSchemaCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetadataSchemaCollection", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataSchema", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", readOnly: true, type: { - name: "String" - } - } - } - } + name: "String", + }, + }, + }, + }, }; -export const TrackedResource: coreClient.CompositeMapper = { +export const MetadataSchemaProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "TrackedResource", + className: "MetadataSchemaProperties", modelProperties: { - ...Resource.type.modelProperties, - tags: { - serializedName: "tags", + schema: { + serializedName: "schema", + required: true, type: { - name: "Dictionary", - value: { type: { name: "String" } } - } + name: "String", + }, }, - location: { - serializedName: "location", + assignedTo: { + serializedName: "assignedTo", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetadataAssignment", + }, + }, + }, + }, + }, + }, +}; + +export const MetadataAssignment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetadataAssignment", + modelProperties: { + entity: { + serializedName: "entity", + type: { + name: "String", + }, + }, + required: { + serializedName: "required", + type: { + name: "Boolean", + }, + }, + deprecated: { + serializedName: "deprecated", + type: { + name: "Boolean", + }, + }, + }, + }, +}; + +export const WorkspaceCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkspaceCollection", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Workspace", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const WorkspaceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkspaceProperties", + modelProperties: { + title: { + constraints: { + MaxLength: 50, + MinLength: 1, + }, + serializedName: "title", required: true, type: { - name: "String" - } - } - } - } + name: "String", + }, + }, + description: { + serializedName: "description", + type: { + name: "String", + }, + }, + }, + }, }; -export const Service: coreClient.CompositeMapper = { +export const ApiCollection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Service", + className: "ApiCollection", modelProperties: { - ...TrackedResource.type.modelProperties, - identity: { - serializedName: "identity", + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Api", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiProperties", + modelProperties: { + title: { + constraints: { + MaxLength: 50, + MinLength: 1, + }, + serializedName: "title", + required: true, + type: { + name: "String", + }, + }, + kind: { + serializedName: "kind", + required: true, + type: { + name: "String", + }, + }, + description: { + constraints: { + MaxLength: 1000, + }, + serializedName: "description", + type: { + name: "String", + }, + }, + summary: { + constraints: { + MaxLength: 200, + }, + serializedName: "summary", + type: { + name: "String", + }, + }, + lifecycleStage: { + serializedName: "lifecycleStage", + readOnly: true, + type: { + name: "String", + }, + }, + termsOfService: { + serializedName: "termsOfService", type: { name: "Composite", - className: "ManagedServiceIdentity" - } + className: "TermsOfService", + }, }, - provisioningState: { - serializedName: "properties.provisioningState", + externalDocumentation: { + constraints: { + MaxItems: 20, + }, + serializedName: "externalDocumentation", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ExternalDocumentation", + }, + }, + }, + }, + contacts: { + serializedName: "contacts", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Contact", + }, + }, + }, + }, + license: { + serializedName: "license", + type: { + name: "Composite", + className: "License", + }, + }, + customProperties: { + serializedName: "customProperties", + type: { + name: "Dictionary", + value: { type: { name: "any" } }, + }, + }, + }, + }, +}; + +export const TermsOfService: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TermsOfService", + modelProperties: { + url: { + constraints: { + MaxLength: 200, + }, + serializedName: "url", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ExternalDocumentation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExternalDocumentation", + modelProperties: { + title: { + constraints: { + MaxLength: 50, + }, + serializedName: "title", + type: { + name: "String", + }, + }, + description: { + constraints: { + MaxLength: 500, + }, + serializedName: "description", + type: { + name: "String", + }, + }, + url: { + constraints: { + MaxLength: 200, + }, + serializedName: "url", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const Contact: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Contact", + modelProperties: { + name: { + constraints: { + MaxLength: 100, + }, + serializedName: "name", + type: { + name: "String", + }, + }, + url: { + constraints: { + MaxLength: 200, + }, + serializedName: "url", + type: { + name: "String", + }, + }, + email: { + constraints: { + MaxLength: 100, + }, + serializedName: "email", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const License: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "License", + modelProperties: { + name: { + constraints: { + MaxLength: 100, + }, + serializedName: "name", + type: { + name: "String", + }, + }, + url: { + constraints: { + MaxLength: 200, + }, + serializedName: "url", + type: { + name: "String", + }, + }, + identifier: { + constraints: { + MaxLength: 50, + }, + serializedName: "identifier", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiVersionCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiVersionCollection", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApiVersion", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", readOnly: true, type: { - name: "String" - } - } - } - } + name: "String", + }, + }, + }, + }, +}; + +export const ApiVersionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiVersionProperties", + modelProperties: { + title: { + constraints: { + MaxLength: 50, + MinLength: 1, + }, + serializedName: "title", + required: true, + type: { + name: "String", + }, + }, + lifecycleStage: { + serializedName: "lifecycleStage", + required: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiDefinitionCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiDefinitionCollection", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApiDefinition", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiDefinitionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiDefinitionProperties", + modelProperties: { + title: { + constraints: { + MaxLength: 50, + MinLength: 1, + }, + serializedName: "title", + required: true, + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + type: { + name: "String", + }, + }, + specification: { + serializedName: "specification", + type: { + name: "Composite", + className: "ApiDefinitionPropertiesSpecification", + }, + }, + }, + }, +}; + +export const ApiDefinitionPropertiesSpecification: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "ApiDefinitionPropertiesSpecification", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + version: { + serializedName: "version", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const ApiSpecImportRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiSpecImportRequest", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "String", + }, + }, + format: { + serializedName: "format", + type: { + name: "String", + }, + }, + specification: { + serializedName: "specification", + type: { + name: "Composite", + className: "ApiSpecImportRequestSpecification", + }, + }, + }, + }, +}; + +export const ApiSpecImportRequestSpecification: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiSpecImportRequestSpecification", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String", + }, + }, + version: { + serializedName: "version", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiSpecExportResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiSpecExportResult", + modelProperties: { + format: { + serializedName: "format", + type: { + name: "String", + }, + }, + value: { + serializedName: "value", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const DeploymentCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentCollection", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Deployment", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const DeploymentProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentProperties", + modelProperties: { + title: { + constraints: { + MaxLength: 50, + MinLength: 1, + }, + serializedName: "title", + type: { + name: "String", + }, + }, + description: { + constraints: { + MaxLength: 500, + }, + serializedName: "description", + type: { + name: "String", + }, + }, + environmentId: { + serializedName: "environmentId", + type: { + name: "String", + }, + }, + definitionId: { + serializedName: "definitionId", + type: { + name: "String", + }, + }, + state: { + serializedName: "state", + type: { + name: "String", + }, + }, + server: { + serializedName: "server", + type: { + name: "Composite", + className: "DeploymentServer", + }, + }, + customProperties: { + serializedName: "customProperties", + type: { + name: "Dictionary", + value: { type: { name: "any" } }, + }, + }, + }, + }, +}; + +export const DeploymentServer: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentServer", + modelProperties: { + runtimeUri: { + serializedName: "runtimeUri", + type: { + name: "Sequence", + element: { + constraints: { + MaxLength: 200, + }, + type: { + name: "String", + }, + }, + }, + }, + }, + }, +}; + +export const EnvironmentCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EnvironmentCollection", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Environment", + }, + }, + }, + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String", + }, + }, + }, + }, +}; + +export const EnvironmentProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EnvironmentProperties", + modelProperties: { + title: { + constraints: { + MaxLength: 50, + MinLength: 1, + }, + serializedName: "title", + required: true, + type: { + name: "String", + }, + }, + description: { + serializedName: "description", + type: { + name: "String", + }, + }, + kind: { + serializedName: "kind", + required: true, + type: { + name: "String", + }, + }, + server: { + serializedName: "server", + type: { + name: "Composite", + className: "EnvironmentServer", + }, + }, + onboarding: { + serializedName: "onboarding", + type: { + name: "Composite", + className: "Onboarding", + }, + }, + customProperties: { + serializedName: "customProperties", + type: { + name: "Dictionary", + value: { type: { name: "any" } }, + }, + }, + }, + }, +}; + +export const EnvironmentServer: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EnvironmentServer", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "String", + }, + }, + managementPortalUri: { + constraints: { + MaxItems: 1, + }, + serializedName: "managementPortalUri", + type: { + name: "Sequence", + element: { + type: { + name: "String", + }, + }, + }, + }, + }, + }, +}; + +export const Onboarding: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Onboarding", + modelProperties: { + instructions: { + serializedName: "instructions", + type: { + name: "String", + }, + }, + developerPortalUri: { + constraints: { + MaxItems: 1, + }, + serializedName: "developerPortalUri", + type: { + name: "Sequence", + element: { + 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 MetadataSchema: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetadataSchema", + modelProperties: { + ...Resource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "MetadataSchemaProperties", + }, + }, + }, + }, +}; + +export const Workspace: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Workspace", + modelProperties: { + ...Resource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "WorkspaceProperties", + }, + }, + }, + }, +}; + +export const Api: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Api", + modelProperties: { + ...Resource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ApiProperties", + }, + }, + }, + }, +}; + +export const ApiVersion: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiVersion", + modelProperties: { + ...Resource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ApiVersionProperties", + }, + }, + }, + }, +}; + +export const ApiDefinition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiDefinition", + modelProperties: { + ...Resource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ApiDefinitionProperties", + }, + }, + }, + }, +}; + +export const Deployment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Deployment", + modelProperties: { + ...Resource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "DeploymentProperties", + }, + }, + }, + }, +}; + +export const Environment: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Environment", + modelProperties: { + ...Resource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "EnvironmentProperties", + }, + }, + }, + }, +}; + +export const Service: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Service", + modelProperties: { + ...TrackedResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ServiceProperties", + }, + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity", + }, + }, + }, + }, +}; + +export const MetadataSchemasGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MetadataSchemasGetHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const MetadataSchemasCreateOrUpdateHeaders: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "MetadataSchemasCreateOrUpdateHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, + }; + +export const WorkspacesGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkspacesGetHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const WorkspacesCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkspacesCreateOrUpdateHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApisGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApisGetHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApisCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApisCreateOrUpdateHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiVersionsGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiVersionsGetHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiVersionsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiVersionsCreateOrUpdateHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiDefinitionsGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiDefinitionsGetHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const ApiDefinitionsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiDefinitionsCreateOrUpdateHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const DeploymentsGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentsGetHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const DeploymentsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DeploymentsCreateOrUpdateHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const EnvironmentsCreateOrUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EnvironmentsCreateOrUpdateHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, +}; + +export const EnvironmentsGetHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EnvironmentsGetHeaders", + modelProperties: { + eTag: { + serializedName: "etag", + type: { + name: "String", + }, + }, + }, + }, }; diff --git a/sdk/apicenter/arm-apicenter/src/models/parameters.ts b/sdk/apicenter/arm-apicenter/src/models/parameters.ts index 86e9268ecae7..85174473acd2 100644 --- a/sdk/apicenter/arm-apicenter/src/models/parameters.ts +++ b/sdk/apicenter/arm-apicenter/src/models/parameters.ts @@ -9,11 +9,20 @@ import { OperationParameter, OperationURLParameter, - OperationQueryParameter + OperationQueryParameter, } from "@azure/core-client"; import { Service as ServiceMapper, - ServiceUpdate as ServiceUpdateMapper + ServiceUpdate as ServiceUpdateMapper, + MetadataSchemaExportRequest as MetadataSchemaExportRequestMapper, + MetadataSchema as MetadataSchemaMapper, + Workspace as WorkspaceMapper, + Api as ApiMapper, + ApiVersion as ApiVersionMapper, + ApiDefinition as ApiDefinitionMapper, + ApiSpecImportRequest as ApiSpecImportRequestMapper, + Deployment as DeploymentMapper, + Environment as EnvironmentMapper, } from "../models/mappers"; export const accept: OperationParameter = { @@ -23,9 +32,9 @@ export const accept: OperationParameter = { isConstant: true, serializedName: "Accept", type: { - name: "String" - } - } + name: "String", + }, + }, }; export const $host: OperationURLParameter = { @@ -34,22 +43,22 @@ export const $host: OperationURLParameter = { serializedName: "$host", required: true, type: { - name: "String" - } + name: "String", + }, }, - skipEncoding: true + skipEncoding: true, }; export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2023-07-01-preview", + defaultValue: "2024-03-01", isConstant: true, serializedName: "api-version", type: { - name: "String" - } - } + name: "String", + }, + }, }; export const nextLink: OperationURLParameter = { @@ -58,24 +67,21 @@ export const nextLink: OperationURLParameter = { serializedName: "nextLink", required: true, type: { - name: "String" - } + name: "String", + }, }, - skipEncoding: true + skipEncoding: true, }; export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { - constraints: { - MinLength: 1 - }, serializedName: "subscriptionId", required: true, type: { - name: "String" - } - } + name: "Uuid", + }, + }, }; export const resourceGroupName: OperationURLParameter = { @@ -83,28 +89,29 @@ export const resourceGroupName: OperationURLParameter = { mapper: { constraints: { MaxLength: 90, - MinLength: 1 + MinLength: 1, }, serializedName: "resourceGroupName", required: true, type: { - name: "String" - } - } + name: "String", + }, + }, }; export const serviceName: OperationURLParameter = { parameterPath: "serviceName", mapper: { constraints: { - Pattern: new RegExp("^[a-zA-Z0-9\\-]{1,64}$") + MaxLength: 90, + MinLength: 1, }, serializedName: "serviceName", required: true, type: { - name: "String" - } - } + name: "String", + }, + }, }; export const contentType: OperationParameter = { @@ -114,17 +121,177 @@ export const contentType: OperationParameter = { isConstant: true, serializedName: "Content-Type", type: { - name: "String" - } - } + name: "String", + }, + }, +}; + +export const payload: OperationParameter = { + parameterPath: ["options", "payload"], + mapper: ServiceMapper, +}; + +export const payload1: OperationParameter = { + parameterPath: ["options", "payload"], + mapper: ServiceUpdateMapper, +}; + +export const payload2: OperationParameter = { + parameterPath: "payload", + mapper: MetadataSchemaExportRequestMapper, +}; + +export const filter: OperationQueryParameter = { + parameterPath: "filter", + mapper: { + serializedName: "$filter", + type: { + name: "String", + }, + }, +}; + +export const metadataSchemaName: OperationURLParameter = { + parameterPath: "metadataSchemaName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "metadataSchemaName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const payload3: OperationParameter = { + parameterPath: "payload", + mapper: MetadataSchemaMapper, +}; + +export const workspaceName: OperationURLParameter = { + parameterPath: "workspaceName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "workspaceName", + required: true, + type: { + name: "String", + }, + }, }; -export const resource: OperationParameter = { - parameterPath: ["options", "resource"], - mapper: ServiceMapper +export const payload4: OperationParameter = { + parameterPath: "payload", + mapper: WorkspaceMapper, }; -export const parameters: OperationParameter = { - parameterPath: ["options", "parameters"], - mapper: ServiceUpdateMapper +export const apiName: OperationURLParameter = { + parameterPath: "apiName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "apiName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const payload5: OperationParameter = { + parameterPath: "payload", + mapper: ApiMapper, +}; + +export const versionName: OperationURLParameter = { + parameterPath: "versionName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "versionName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const payload6: OperationParameter = { + parameterPath: "payload", + mapper: ApiVersionMapper, +}; + +export const definitionName: OperationURLParameter = { + parameterPath: "definitionName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "definitionName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const payload7: OperationParameter = { + parameterPath: "payload", + mapper: ApiDefinitionMapper, +}; + +export const payload8: OperationParameter = { + parameterPath: "payload", + mapper: ApiSpecImportRequestMapper, +}; + +export const deploymentName: OperationURLParameter = { + parameterPath: "deploymentName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "deploymentName", + required: true, + type: { + name: "String", + }, + }, +}; + +export const payload9: OperationParameter = { + parameterPath: "payload", + mapper: DeploymentMapper, +}; + +export const payload10: OperationParameter = { + parameterPath: "payload", + mapper: EnvironmentMapper, +}; + +export const environmentName: OperationURLParameter = { + parameterPath: "environmentName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1, + }, + serializedName: "environmentName", + required: true, + type: { + name: "String", + }, + }, }; diff --git a/sdk/apicenter/arm-apicenter/src/operations/apiDefinitions.ts b/sdk/apicenter/arm-apicenter/src/operations/apiDefinitions.ts new file mode 100644 index 000000000000..145c4fd847a7 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operations/apiDefinitions.ts @@ -0,0 +1,473 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { ApiDefinitions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureAPICenter } from "../azureAPICenter"; +import { + ApiDefinition, + ApiDefinitionsListNextOptionalParams, + ApiDefinitionsListOptionalParams, + ApiDefinitionsListResponse, + ApiDefinitionsGetOptionalParams, + ApiDefinitionsGetResponse, + ApiDefinitionsCreateOrUpdateOptionalParams, + ApiDefinitionsCreateOrUpdateResponse, + ApiDefinitionsDeleteOptionalParams, + ApiDefinitionsHeadOptionalParams, + ApiDefinitionsHeadResponse, + ApiSpecImportRequest, + ApiDefinitionsImportSpecificationOptionalParams, + ApiDefinitionsExportSpecificationOptionalParams, + ApiDefinitionsExportSpecificationResponse, + ApiDefinitionsListNextResponse, +} from "../models"; + +/// +/** Class containing ApiDefinitions operations. */ +export class ApiDefinitionsImpl implements ApiDefinitions { + private readonly client: AzureAPICenter; + + /** + * Initialize a new instance of the class ApiDefinitions class. + * @param client Reference to the service client + */ + constructor(client: AzureAPICenter) { + this.client = client; + } + + /** + * Returns a collection of API definitions. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, serviceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + serviceName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: ApiDefinitionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, serviceName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + serviceName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + serviceName, + options, + )) { + yield* page; + } + } + + /** + * Returns a collection of API definitions. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + listOperationSpec, + ); + } + + /** + * Returns details of the API definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + getOperationSpec, + ); + } + + /** + * Creates new or updates existing API definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload API definition entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: ApiDefinition, + options?: ApiDefinitionsCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + createOrUpdateOperationSpec, + ); + } + + /** + * Deletes specified API definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + deleteOperationSpec, + ); + } + + /** + * Checks if specified API definition exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsHeadOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + headOperationSpec, + ); + } + + /** + * Imports the API specification. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload The API specification source entity. + * @param options The options parameters. + */ + importSpecification( + resourceGroupName: string, + serviceName: string, + payload: ApiSpecImportRequest, + options?: ApiDefinitionsImportSpecificationOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + importSpecificationOperationSpec, + ); + } + + /** + * Exports the API specification. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + exportSpecification( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsExportSpecificationOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + exportSpecificationOperationSpec, + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + serviceName: string, + nextLink: string, + options?: ApiDefinitionsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiDefinitionCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiDefinition, + headersMapper: Mappers.ApiDefinitionsGetHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + Parameters.definitionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ApiDefinition, + headersMapper: Mappers.ApiDefinitionsCreateOrUpdateHeaders, + }, + 201: { + bodyMapper: Mappers.ApiDefinition, + headersMapper: Mappers.ApiDefinitionsCreateOrUpdateHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload7, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + Parameters.definitionName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + Parameters.definitionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const headOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}", + httpMethod: "HEAD", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + Parameters.definitionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const importSpecificationOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/importSpecification", + httpMethod: "POST", + responses: { + 200: {}, + 202: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload8, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + Parameters.definitionName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const exportSpecificationOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}/definitions/{definitionName}/exportSpecification", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ApiSpecExportResult, + }, + 202: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + Parameters.definitionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiDefinitionCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/apicenter/arm-apicenter/src/operations/apiVersions.ts b/sdk/apicenter/arm-apicenter/src/operations/apiVersions.ts new file mode 100644 index 000000000000..654d9cee1624 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operations/apiVersions.ts @@ -0,0 +1,375 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { ApiVersions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureAPICenter } from "../azureAPICenter"; +import { + ApiVersion, + ApiVersionsListNextOptionalParams, + ApiVersionsListOptionalParams, + ApiVersionsListResponse, + ApiVersionsGetOptionalParams, + ApiVersionsGetResponse, + ApiVersionsCreateOrUpdateOptionalParams, + ApiVersionsCreateOrUpdateResponse, + ApiVersionsDeleteOptionalParams, + ApiVersionsHeadOptionalParams, + ApiVersionsHeadResponse, + ApiVersionsListNextResponse, +} from "../models"; + +/// +/** Class containing ApiVersions operations. */ +export class ApiVersionsImpl implements ApiVersions { + private readonly client: AzureAPICenter; + + /** + * Initialize a new instance of the class ApiVersions class. + * @param client Reference to the service client + */ + constructor(client: AzureAPICenter) { + this.client = client; + } + + /** + * Returns a collection of API versions. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, serviceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + serviceName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: ApiVersionsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, serviceName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + serviceName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + serviceName, + options, + )) { + yield* page; + } + } + + /** + * Returns a collection of API versions. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + listOperationSpec, + ); + } + + /** + * Returns details of the API version. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + getOperationSpec, + ); + } + + /** + * Creates new or updates existing API version. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload API version entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: ApiVersion, + options?: ApiVersionsCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + createOrUpdateOperationSpec, + ); + } + + /** + * Deletes specified API version + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + deleteOperationSpec, + ); + } + + /** + * Checks if specified API version exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsHeadOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + headOperationSpec, + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + serviceName: string, + nextLink: string, + options?: ApiVersionsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiVersionCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiVersion, + headersMapper: Mappers.ApiVersionsGetHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ApiVersion, + headersMapper: Mappers.ApiVersionsCreateOrUpdateHeaders, + }, + 201: { + bodyMapper: Mappers.ApiVersion, + headersMapper: Mappers.ApiVersionsCreateOrUpdateHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload6, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const headOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/versions/{versionName}", + httpMethod: "HEAD", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.versionName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiVersionCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/apicenter/arm-apicenter/src/operations/apis.ts b/sdk/apicenter/arm-apicenter/src/operations/apis.ts new file mode 100644 index 000000000000..20b1ce984173 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operations/apis.ts @@ -0,0 +1,369 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Apis } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureAPICenter } from "../azureAPICenter"; +import { + Api, + ApisListNextOptionalParams, + ApisListOptionalParams, + ApisListResponse, + ApisGetOptionalParams, + ApisGetResponse, + ApisCreateOrUpdateOptionalParams, + ApisCreateOrUpdateResponse, + ApisDeleteOptionalParams, + ApisHeadOptionalParams, + ApisHeadResponse, + ApisListNextResponse, +} from "../models"; + +/// +/** Class containing Apis operations. */ +export class ApisImpl implements Apis { + private readonly client: AzureAPICenter; + + /** + * Initialize a new instance of the class Apis class. + * @param client Reference to the service client + */ + constructor(client: AzureAPICenter) { + this.client = client; + } + + /** + * Returns a collection of APIs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + serviceName: string, + options?: ApisListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, serviceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + serviceName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + serviceName: string, + options?: ApisListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: ApisListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, serviceName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + serviceName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + serviceName: string, + options?: ApisListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + serviceName, + options, + )) { + yield* page; + } + } + + /** + * Returns a collection of APIs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + serviceName: string, + options?: ApisListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + listOperationSpec, + ); + } + + /** + * Returns details of the API. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: ApisGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + getOperationSpec, + ); + } + + /** + * Creates new or updates existing API. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload API entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: Api, + options?: ApisCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + createOrUpdateOperationSpec, + ); + } + + /** + * Deletes specified API. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: ApisDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + deleteOperationSpec, + ); + } + + /** + * Checks if specified API exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: ApisHeadOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + headOperationSpec, + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + serviceName: string, + nextLink: string, + options?: ApisListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Api, + headersMapper: Mappers.ApisGetHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Api, + headersMapper: Mappers.ApisCreateOrUpdateHeaders, + }, + 201: { + bodyMapper: Mappers.Api, + headersMapper: Mappers.ApisCreateOrUpdateHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload5, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const headOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}", + httpMethod: "HEAD", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/apicenter/arm-apicenter/src/operations/deployments.ts b/sdk/apicenter/arm-apicenter/src/operations/deployments.ts new file mode 100644 index 000000000000..1768acae6f85 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operations/deployments.ts @@ -0,0 +1,375 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Deployments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureAPICenter } from "../azureAPICenter"; +import { + Deployment, + DeploymentsListNextOptionalParams, + DeploymentsListOptionalParams, + DeploymentsListResponse, + DeploymentsDeleteOptionalParams, + DeploymentsGetOptionalParams, + DeploymentsGetResponse, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsCreateOrUpdateResponse, + DeploymentsHeadOptionalParams, + DeploymentsHeadResponse, + DeploymentsListNextResponse, +} from "../models"; + +/// +/** Class containing Deployments operations. */ +export class DeploymentsImpl implements Deployments { + private readonly client: AzureAPICenter; + + /** + * Initialize a new instance of the class Deployments class. + * @param client Reference to the service client + */ + constructor(client: AzureAPICenter) { + this.client = client; + } + + /** + * Returns a collection of API deployments. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, serviceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + serviceName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: DeploymentsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, serviceName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + serviceName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + serviceName, + options, + )) { + yield* page; + } + } + + /** + * Returns a collection of API deployments. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + listOperationSpec, + ); + } + + /** + * Deletes API deployment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + deleteOperationSpec, + ); + } + + /** + * Returns details of the API deployment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + getOperationSpec, + ); + } + + /** + * Creates new or updates existing API deployment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload API deployment entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: Deployment, + options?: DeploymentsCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + createOrUpdateOperationSpec, + ); + } + + /** + * Checks if specified API deployment exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsHeadOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + headOperationSpec, + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + serviceName: string, + nextLink: string, + options?: DeploymentsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.deploymentName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Deployment, + headersMapper: Mappers.DeploymentsGetHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.deploymentName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Deployment, + headersMapper: Mappers.DeploymentsCreateOrUpdateHeaders, + }, + 201: { + bodyMapper: Mappers.Deployment, + headersMapper: Mappers.DeploymentsCreateOrUpdateHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload9, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.deploymentName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const headOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/apis/{apiName}/deployments/{deploymentName}", + httpMethod: "HEAD", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + Parameters.deploymentName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.DeploymentCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.apiName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/apicenter/arm-apicenter/src/operations/environments.ts b/sdk/apicenter/arm-apicenter/src/operations/environments.ts new file mode 100644 index 000000000000..b4a94c335365 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operations/environments.ts @@ -0,0 +1,369 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Environments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureAPICenter } from "../azureAPICenter"; +import { + Environment, + EnvironmentsListNextOptionalParams, + EnvironmentsListOptionalParams, + EnvironmentsListResponse, + EnvironmentsCreateOrUpdateOptionalParams, + EnvironmentsCreateOrUpdateResponse, + EnvironmentsDeleteOptionalParams, + EnvironmentsHeadOptionalParams, + EnvironmentsHeadResponse, + EnvironmentsGetOptionalParams, + EnvironmentsGetResponse, + EnvironmentsListNextResponse, +} from "../models"; + +/// +/** Class containing Environments operations. */ +export class EnvironmentsImpl implements Environments { + private readonly client: AzureAPICenter; + + /** + * Initialize a new instance of the class Environments class. + * @param client Reference to the service client + */ + constructor(client: AzureAPICenter) { + this.client = client; + } + + /** + * Returns a collection of environments. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, serviceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + serviceName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: EnvironmentsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, serviceName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + serviceName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + serviceName, + options, + )) { + yield* page; + } + } + + /** + * Returns a collection of environments. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + listOperationSpec, + ); + } + + /** + * Creates new or updates existing environment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload Environment entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: Environment, + options?: EnvironmentsCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + createOrUpdateOperationSpec, + ); + } + + /** + * Deletes the environment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + deleteOperationSpec, + ); + } + + /** + * Checks if specified environment exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsHeadOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + headOperationSpec, + ); + } + + /** + * Returns details of the environment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + getOperationSpec, + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + serviceName: string, + nextLink: string, + options?: EnvironmentsListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EnvironmentCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Environment, + headersMapper: Mappers.EnvironmentsCreateOrUpdateHeaders, + }, + 201: { + bodyMapper: Mappers.Environment, + headersMapper: Mappers.EnvironmentsCreateOrUpdateHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload10, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.environmentName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.environmentName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const headOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + httpMethod: "HEAD", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.environmentName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}/environments/{environmentName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Environment, + headersMapper: Mappers.EnvironmentsGetHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + Parameters.environmentName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.EnvironmentCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/apicenter/arm-apicenter/src/operations/index.ts b/sdk/apicenter/arm-apicenter/src/operations/index.ts index 8ea6c50645ed..2e1ee73fe33e 100644 --- a/sdk/apicenter/arm-apicenter/src/operations/index.ts +++ b/sdk/apicenter/arm-apicenter/src/operations/index.ts @@ -8,3 +8,10 @@ export * from "./operations"; export * from "./services"; +export * from "./metadataSchemas"; +export * from "./workspaces"; +export * from "./apis"; +export * from "./apiVersions"; +export * from "./apiDefinitions"; +export * from "./deployments"; +export * from "./environments"; diff --git a/sdk/apicenter/arm-apicenter/src/operations/metadataSchemas.ts b/sdk/apicenter/arm-apicenter/src/operations/metadataSchemas.ts new file mode 100644 index 000000000000..4d99287b4067 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operations/metadataSchemas.ts @@ -0,0 +1,363 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { MetadataSchemas } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureAPICenter } from "../azureAPICenter"; +import { + MetadataSchema, + MetadataSchemasListNextOptionalParams, + MetadataSchemasListOptionalParams, + MetadataSchemasListResponse, + MetadataSchemasGetOptionalParams, + MetadataSchemasGetResponse, + MetadataSchemasCreateOrUpdateOptionalParams, + MetadataSchemasCreateOrUpdateResponse, + MetadataSchemasDeleteOptionalParams, + MetadataSchemasHeadOptionalParams, + MetadataSchemasHeadResponse, + MetadataSchemasListNextResponse, +} from "../models"; + +/// +/** Class containing MetadataSchemas operations. */ +export class MetadataSchemasImpl implements MetadataSchemas { + private readonly client: AzureAPICenter; + + /** + * Initialize a new instance of the class MetadataSchemas class. + * @param client Reference to the service client + */ + constructor(client: AzureAPICenter) { + this.client = client; + } + + /** + * Returns a collection of metadata schemas. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, serviceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + serviceName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: MetadataSchemasListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, serviceName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + serviceName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + serviceName, + options, + )) { + yield* page; + } + } + + /** + * Returns a collection of metadata schemas. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + listOperationSpec, + ); + } + + /** + * Returns details of the metadata schema. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + getOperationSpec, + ); + } + + /** + * Creates new or updates existing metadata schema. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload Metadata schema entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: MetadataSchema, + options?: MetadataSchemasCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + createOrUpdateOperationSpec, + ); + } + + /** + * Deletes specified metadata schema. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + deleteOperationSpec, + ); + } + + /** + * Checks if specified metadata schema exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasHeadOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + headOperationSpec, + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + serviceName: string, + nextLink: string, + options?: MetadataSchemasListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetadataSchemaCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetadataSchema, + headersMapper: Mappers.MetadataSchemasGetHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.metadataSchemaName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.MetadataSchema, + headersMapper: Mappers.MetadataSchemasCreateOrUpdateHeaders, + }, + 201: { + bodyMapper: Mappers.MetadataSchema, + headersMapper: Mappers.MetadataSchemasCreateOrUpdateHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.metadataSchemaName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.metadataSchemaName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const headOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/metadataSchemas/{metadataSchemaName}", + httpMethod: "HEAD", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.metadataSchemaName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MetadataSchemaCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/apicenter/arm-apicenter/src/operations/operations.ts b/sdk/apicenter/arm-apicenter/src/operations/operations.ts index c901c74ef9eb..6720acd4aa0c 100644 --- a/sdk/apicenter/arm-apicenter/src/operations/operations.ts +++ b/sdk/apicenter/arm-apicenter/src/operations/operations.ts @@ -18,7 +18,7 @@ import { OperationsListNextOptionalParams, OperationsListOptionalParams, OperationsListResponse, - OperationsListNextResponse + OperationsListNextResponse, } from "../models"; /// @@ -35,11 +35,11 @@ export class OperationsImpl implements Operations { } /** - * List the operations for the provider + * Returns a collection of resource provider operations. * @param options The options parameters. */ public list( - options?: OperationsListOptionalParams + options?: OperationsListOptionalParams, ): PagedAsyncIterableIterator { const iter = this.listPagingAll(options); return { @@ -54,13 +54,13 @@ export class OperationsImpl implements Operations { throw new Error("maxPageSize is not supported by this operation."); } return this.listPagingPage(options, settings); - } + }, }; } private async *listPagingPage( options?: OperationsListOptionalParams, - settings?: PageSettings + settings?: PageSettings, ): AsyncIterableIterator { let result: OperationsListResponse; let continuationToken = settings?.continuationToken; @@ -81,7 +81,7 @@ export class OperationsImpl implements Operations { } private async *listPagingAll( - options?: OperationsListOptionalParams + options?: OperationsListOptionalParams, ): AsyncIterableIterator { for await (const page of this.listPagingPage(options)) { yield* page; @@ -89,11 +89,11 @@ export class OperationsImpl implements Operations { } /** - * List the operations for the provider + * Returns a collection of resource provider operations. * @param options The options parameters. */ private _list( - options?: OperationsListOptionalParams + options?: OperationsListOptionalParams, ): Promise { return this.client.sendOperationRequest({ options }, listOperationSpec); } @@ -105,11 +105,11 @@ export class OperationsImpl implements Operations { */ private _listNext( nextLink: string, - options?: OperationsListNextOptionalParams + options?: OperationsListNextOptionalParams, ): Promise { return this.client.sendOperationRequest( { nextLink, options }, - listNextOperationSpec + listNextOperationSpec, ); } } @@ -121,29 +121,29 @@ const listOperationSpec: coreClient.OperationSpec = { httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.OperationListResult + bodyMapper: Mappers.OperationListResult, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host], headerParameters: [Parameters.accept], - serializer + serializer, }; const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.OperationListResult + bodyMapper: Mappers.OperationListResult, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, urlParameters: [Parameters.$host, Parameters.nextLink], headerParameters: [Parameters.accept], - serializer + serializer, }; diff --git a/sdk/apicenter/arm-apicenter/src/operations/services.ts b/sdk/apicenter/arm-apicenter/src/operations/services.ts index d82b6d489c05..fe87fcd233d5 100644 --- a/sdk/apicenter/arm-apicenter/src/operations/services.ts +++ b/sdk/apicenter/arm-apicenter/src/operations/services.ts @@ -28,8 +28,11 @@ import { ServicesUpdateOptionalParams, ServicesUpdateResponse, ServicesDeleteOptionalParams, + MetadataSchemaExportRequest, + ServicesExportMetadataSchemaOptionalParams, + ServicesExportMetadataSchemaResponse, ServicesListBySubscriptionNextResponse, - ServicesListByResourceGroupNextResponse + ServicesListByResourceGroupNextResponse, } from "../models"; /// @@ -50,7 +53,7 @@ export class ServicesImpl implements Services { * @param options The options parameters. */ public listBySubscription( - options?: ServicesListBySubscriptionOptionalParams + options?: ServicesListBySubscriptionOptionalParams, ): PagedAsyncIterableIterator { const iter = this.listBySubscriptionPagingAll(options); return { @@ -65,13 +68,13 @@ export class ServicesImpl implements Services { throw new Error("maxPageSize is not supported by this operation."); } return this.listBySubscriptionPagingPage(options, settings); - } + }, }; } private async *listBySubscriptionPagingPage( options?: ServicesListBySubscriptionOptionalParams, - settings?: PageSettings + settings?: PageSettings, ): AsyncIterableIterator { let result: ServicesListBySubscriptionResponse; let continuationToken = settings?.continuationToken; @@ -92,7 +95,7 @@ export class ServicesImpl implements Services { } private async *listBySubscriptionPagingAll( - options?: ServicesListBySubscriptionOptionalParams + options?: ServicesListBySubscriptionOptionalParams, ): AsyncIterableIterator { for await (const page of this.listBySubscriptionPagingPage(options)) { yield* page; @@ -100,13 +103,13 @@ export class ServicesImpl implements Services { } /** - * Lists services within a resource group + * Returns a collection of services within the resource group. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ public listByResourceGroup( resourceGroupName: string, - options?: ServicesListByResourceGroupOptionalParams + options?: ServicesListByResourceGroupOptionalParams, ): PagedAsyncIterableIterator { const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); return { @@ -123,16 +126,16 @@ export class ServicesImpl implements Services { return this.listByResourceGroupPagingPage( resourceGroupName, options, - settings + settings, ); - } + }, }; } private async *listByResourceGroupPagingPage( resourceGroupName: string, options?: ServicesListByResourceGroupOptionalParams, - settings?: PageSettings + settings?: PageSettings, ): AsyncIterableIterator { let result: ServicesListByResourceGroupResponse; let continuationToken = settings?.continuationToken; @@ -147,7 +150,7 @@ export class ServicesImpl implements Services { result = await this._listByResourceGroupNext( resourceGroupName, continuationToken, - options + options, ); continuationToken = result.nextLink; let page = result.value || []; @@ -158,11 +161,11 @@ export class ServicesImpl implements Services { private async *listByResourceGroupPagingAll( resourceGroupName: string, - options?: ServicesListByResourceGroupOptionalParams + options?: ServicesListByResourceGroupOptionalParams, ): AsyncIterableIterator { for await (const page of this.listByResourceGroupPagingPage( resourceGroupName, - options + options, )) { yield* page; } @@ -173,94 +176,113 @@ export class ServicesImpl implements Services { * @param options The options parameters. */ private _listBySubscription( - options?: ServicesListBySubscriptionOptionalParams + options?: ServicesListBySubscriptionOptionalParams, ): Promise { return this.client.sendOperationRequest( { options }, - listBySubscriptionOperationSpec + listBySubscriptionOperationSpec, ); } /** - * Lists services within a resource group + * Returns a collection of services within the resource group. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ private _listByResourceGroup( resourceGroupName: string, - options?: ServicesListByResourceGroupOptionalParams + options?: ServicesListByResourceGroupOptionalParams, ): Promise { return this.client.sendOperationRequest( { resourceGroupName, options }, - listByResourceGroupOperationSpec + listByResourceGroupOperationSpec, ); } /** - * Get service + * Returns details of the service. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name + * @param serviceName The name of Azure API Center service. * @param options The options parameters. */ get( resourceGroupName: string, serviceName: string, - options?: ServicesGetOptionalParams + options?: ServicesGetOptionalParams, ): Promise { return this.client.sendOperationRequest( { resourceGroupName, serviceName, options }, - getOperationSpec + getOperationSpec, ); } /** - * Create or update service + * Creates new or updates existing API. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name + * @param serviceName The name of Azure API Center service. * @param options The options parameters. */ createOrUpdate( resourceGroupName: string, serviceName: string, - options?: ServicesCreateOrUpdateOptionalParams + options?: ServicesCreateOrUpdateOptionalParams, ): Promise { return this.client.sendOperationRequest( { resourceGroupName, serviceName, options }, - createOrUpdateOperationSpec + createOrUpdateOperationSpec, ); } /** - * Update service + * Updates existing service. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name + * @param serviceName The name of Azure API Center service. * @param options The options parameters. */ update( resourceGroupName: string, serviceName: string, - options?: ServicesUpdateOptionalParams + options?: ServicesUpdateOptionalParams, ): Promise { return this.client.sendOperationRequest( { resourceGroupName, serviceName, options }, - updateOperationSpec + updateOperationSpec, ); } /** - * Delete service + * Deletes specified service. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name + * @param serviceName The name of Azure API Center service. * @param options The options parameters. */ delete( resourceGroupName: string, serviceName: string, - options?: ServicesDeleteOptionalParams + options?: ServicesDeleteOptionalParams, ): Promise { return this.client.sendOperationRequest( { resourceGroupName, serviceName, options }, - deleteOperationSpec + deleteOperationSpec, + ); + } + + /** + * Exports the effective metadata schema. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload The metadata schema request details. + * @param options The options parameters. + */ + exportMetadataSchema( + resourceGroupName: string, + serviceName: string, + payload: MetadataSchemaExportRequest, + options?: ServicesExportMetadataSchemaOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + exportMetadataSchemaOperationSpec, ); } @@ -271,11 +293,11 @@ export class ServicesImpl implements Services { */ private _listBySubscriptionNext( nextLink: string, - options?: ServicesListBySubscriptionNextOptionalParams + options?: ServicesListBySubscriptionNextOptionalParams, ): Promise { return this.client.sendOperationRequest( { nextLink, options }, - listBySubscriptionNextOperationSpec + listBySubscriptionNextOperationSpec, ); } @@ -288,11 +310,11 @@ export class ServicesImpl implements Services { private _listByResourceGroupNext( resourceGroupName: string, nextLink: string, - options?: ServicesListByResourceGroupNextOptionalParams + options?: ServicesListByResourceGroupNextOptionalParams, ): Promise { return this.client.sendOperationRequest( { resourceGroupName, nextLink, options }, - listByResourceGroupNextOperationSpec + listByResourceGroupNextOperationSpec, ); } } @@ -300,173 +322,191 @@ export class ServicesImpl implements Services { const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); const listBySubscriptionOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services", + path: "/subscriptions/{subscriptionId}/providers/Microsoft.ApiCenter/services", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ServiceCollection + bodyMapper: Mappers.ServiceCollection, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, queryParameters: [Parameters.apiVersion], urlParameters: [Parameters.$host, Parameters.subscriptionId], headerParameters: [Parameters.accept], - serializer + serializer, }; const listByResourceGroupOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services", + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ServiceCollection + bodyMapper: Mappers.ServiceCollection, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, - Parameters.resourceGroupName + Parameters.resourceGroupName, ], headerParameters: [Parameters.accept], - serializer + serializer, }; const getOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.Service + bodyMapper: Mappers.Service, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.serviceName + Parameters.serviceName, ], headerParameters: [Parameters.accept], - serializer + serializer, }; const createOrUpdateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", httpMethod: "PUT", responses: { 200: { - bodyMapper: Mappers.Service + bodyMapper: Mappers.Service, }, 201: { - bodyMapper: Mappers.Service + bodyMapper: Mappers.Service, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, - requestBody: Parameters.resource, + requestBody: Parameters.payload, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.serviceName + Parameters.serviceName, ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", - serializer + serializer, }; const updateOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", httpMethod: "PATCH", responses: { 200: { - bodyMapper: Mappers.Service + bodyMapper: Mappers.Service, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, - requestBody: Parameters.parameters, + requestBody: Parameters.payload1, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.serviceName + Parameters.serviceName, ], headerParameters: [Parameters.accept, Parameters.contentType], mediaType: "json", - serializer + serializer, }; const deleteOperationSpec: coreClient.OperationSpec = { - path: - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}", httpMethod: "DELETE", responses: { 200: {}, 204: {}, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, queryParameters: [Parameters.apiVersion], urlParameters: [ Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.serviceName + Parameters.serviceName, ], headerParameters: [Parameters.accept], - serializer + serializer, +}; +const exportMetadataSchemaOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/exportMetadataSchema", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.MetadataSchemaExportResult, + }, + 202: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, }; const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ServiceCollection + bodyMapper: Mappers.ServiceCollection, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, urlParameters: [ Parameters.$host, Parameters.nextLink, - Parameters.subscriptionId + Parameters.subscriptionId, ], headerParameters: [Parameters.accept], - serializer + serializer, }; const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", httpMethod: "GET", responses: { 200: { - bodyMapper: Mappers.ServiceCollection + bodyMapper: Mappers.ServiceCollection, }, default: { - bodyMapper: Mappers.ErrorResponse - } + bodyMapper: Mappers.ErrorResponse, + }, }, urlParameters: [ Parameters.$host, Parameters.nextLink, Parameters.subscriptionId, - Parameters.resourceGroupName + Parameters.resourceGroupName, ], headerParameters: [Parameters.accept], - serializer + serializer, }; diff --git a/sdk/apicenter/arm-apicenter/src/operations/workspaces.ts b/sdk/apicenter/arm-apicenter/src/operations/workspaces.ts new file mode 100644 index 000000000000..985c364d4763 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operations/workspaces.ts @@ -0,0 +1,363 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Workspaces } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureAPICenter } from "../azureAPICenter"; +import { + Workspace, + WorkspacesListNextOptionalParams, + WorkspacesListOptionalParams, + WorkspacesListResponse, + WorkspacesGetOptionalParams, + WorkspacesGetResponse, + WorkspacesCreateOrUpdateOptionalParams, + WorkspacesCreateOrUpdateResponse, + WorkspacesDeleteOptionalParams, + WorkspacesHeadOptionalParams, + WorkspacesHeadResponse, + WorkspacesListNextResponse, +} from "../models"; + +/// +/** Class containing Workspaces operations. */ +export class WorkspacesImpl implements Workspaces { + private readonly client: AzureAPICenter; + + /** + * Initialize a new instance of the class Workspaces class. + * @param client Reference to the service client + */ + constructor(client: AzureAPICenter) { + this.client = client; + } + + /** + * Returns a collection of workspaces. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesListOptionalParams, + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, serviceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage( + resourceGroupName, + serviceName, + options, + settings, + ); + }, + }; + } + + private async *listPagingPage( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: WorkspacesListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(resourceGroupName, serviceName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + serviceName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + serviceName, + options, + )) { + yield* page; + } + } + + /** + * Returns a collection of workspaces. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesListOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + listOperationSpec, + ); + } + + /** + * Returns details of the workspace. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesGetOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + getOperationSpec, + ); + } + + /** + * Creates new or updates existing workspace. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload Workspace entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: Workspace, + options?: WorkspacesCreateOrUpdateOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, payload, options }, + createOrUpdateOperationSpec, + ); + } + + /** + * Deletes specified workspace. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesDeleteOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + deleteOperationSpec, + ); + } + + /** + * Checks if specified workspace exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesHeadOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, options }, + headOperationSpec, + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + serviceName: string, + nextLink: string, + options?: WorkspacesListNextOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, serviceName, nextLink, options }, + listNextOperationSpec, + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkspaceCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const getOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Workspace, + headersMapper: Mappers.WorkspacesGetHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Workspace, + headersMapper: Mappers.WorkspacesCreateOrUpdateHeaders, + }, + 201: { + bodyMapper: Mappers.Workspace, + headersMapper: Mappers.WorkspacesCreateOrUpdateHeaders, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: Parameters.payload4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer, +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const headOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiCenter/services/{serviceName}/workspaces/{workspaceName}", + httpMethod: "HEAD", + responses: { + 200: {}, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + Parameters.workspaceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkspaceCollection, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.serviceName, + ], + headerParameters: [Parameters.accept], + serializer, +}; diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apiDefinitions.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apiDefinitions.ts new file mode 100644 index 000000000000..9f0dda24a7c0 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apiDefinitions.ts @@ -0,0 +1,110 @@ +/* + * 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 { + ApiDefinition, + ApiDefinitionsListOptionalParams, + ApiDefinitionsGetOptionalParams, + ApiDefinitionsGetResponse, + ApiDefinitionsCreateOrUpdateOptionalParams, + ApiDefinitionsCreateOrUpdateResponse, + ApiDefinitionsDeleteOptionalParams, + ApiDefinitionsHeadOptionalParams, + ApiDefinitionsHeadResponse, + ApiSpecImportRequest, + ApiDefinitionsImportSpecificationOptionalParams, + ApiDefinitionsExportSpecificationOptionalParams, + ApiDefinitionsExportSpecificationResponse, +} from "../models"; + +/// +/** Interface representing a ApiDefinitions. */ +export interface ApiDefinitions { + /** + * Returns a collection of API definitions. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Returns details of the API definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsGetOptionalParams, + ): Promise; + /** + * Creates new or updates existing API definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload API definition entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: ApiDefinition, + options?: ApiDefinitionsCreateOrUpdateOptionalParams, + ): Promise; + /** + * Deletes specified API definition. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsDeleteOptionalParams, + ): Promise; + /** + * Checks if specified API definition exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsHeadOptionalParams, + ): Promise; + /** + * Imports the API specification. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload The API specification source entity. + * @param options The options parameters. + */ + importSpecification( + resourceGroupName: string, + serviceName: string, + payload: ApiSpecImportRequest, + options?: ApiDefinitionsImportSpecificationOptionalParams, + ): Promise; + /** + * Exports the API specification. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + exportSpecification( + resourceGroupName: string, + serviceName: string, + options?: ApiDefinitionsExportSpecificationOptionalParams, + ): Promise; +} diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apiVersions.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apiVersions.ts new file mode 100644 index 000000000000..4085f0730b54 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apiVersions.ts @@ -0,0 +1,82 @@ +/* + * 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 { + ApiVersion, + ApiVersionsListOptionalParams, + ApiVersionsGetOptionalParams, + ApiVersionsGetResponse, + ApiVersionsCreateOrUpdateOptionalParams, + ApiVersionsCreateOrUpdateResponse, + ApiVersionsDeleteOptionalParams, + ApiVersionsHeadOptionalParams, + ApiVersionsHeadResponse, +} from "../models"; + +/// +/** Interface representing a ApiVersions. */ +export interface ApiVersions { + /** + * Returns a collection of API versions. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Returns details of the API version. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsGetOptionalParams, + ): Promise; + /** + * Creates new or updates existing API version. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload API version entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: ApiVersion, + options?: ApiVersionsCreateOrUpdateOptionalParams, + ): Promise; + /** + * Deletes specified API version + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsDeleteOptionalParams, + ): Promise; + /** + * Checks if specified API version exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: ApiVersionsHeadOptionalParams, + ): Promise; +} diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apis.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apis.ts new file mode 100644 index 000000000000..4f25b1af7b8e --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/apis.ts @@ -0,0 +1,82 @@ +/* + * 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 { + Api, + ApisListOptionalParams, + ApisGetOptionalParams, + ApisGetResponse, + ApisCreateOrUpdateOptionalParams, + ApisCreateOrUpdateResponse, + ApisDeleteOptionalParams, + ApisHeadOptionalParams, + ApisHeadResponse, +} from "../models"; + +/// +/** Interface representing a Apis. */ +export interface Apis { + /** + * Returns a collection of APIs. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + serviceName: string, + options?: ApisListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Returns details of the API. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: ApisGetOptionalParams, + ): Promise; + /** + * Creates new or updates existing API. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload API entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: Api, + options?: ApisCreateOrUpdateOptionalParams, + ): Promise; + /** + * Deletes specified API. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: ApisDeleteOptionalParams, + ): Promise; + /** + * Checks if specified API exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: ApisHeadOptionalParams, + ): Promise; +} diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/deployments.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/deployments.ts new file mode 100644 index 000000000000..08ca7b28982f --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/deployments.ts @@ -0,0 +1,82 @@ +/* + * 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 { + Deployment, + DeploymentsListOptionalParams, + DeploymentsDeleteOptionalParams, + DeploymentsGetOptionalParams, + DeploymentsGetResponse, + DeploymentsCreateOrUpdateOptionalParams, + DeploymentsCreateOrUpdateResponse, + DeploymentsHeadOptionalParams, + DeploymentsHeadResponse, +} from "../models"; + +/// +/** Interface representing a Deployments. */ +export interface Deployments { + /** + * Returns a collection of API deployments. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Deletes API deployment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsDeleteOptionalParams, + ): Promise; + /** + * Returns details of the API deployment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsGetOptionalParams, + ): Promise; + /** + * Creates new or updates existing API deployment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload API deployment entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: Deployment, + options?: DeploymentsCreateOrUpdateOptionalParams, + ): Promise; + /** + * Checks if specified API deployment exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: DeploymentsHeadOptionalParams, + ): Promise; +} diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/environments.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/environments.ts new file mode 100644 index 000000000000..909e842c8101 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/environments.ts @@ -0,0 +1,82 @@ +/* + * 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 { + Environment, + EnvironmentsListOptionalParams, + EnvironmentsCreateOrUpdateOptionalParams, + EnvironmentsCreateOrUpdateResponse, + EnvironmentsDeleteOptionalParams, + EnvironmentsHeadOptionalParams, + EnvironmentsHeadResponse, + EnvironmentsGetOptionalParams, + EnvironmentsGetResponse, +} from "../models"; + +/// +/** Interface representing a Environments. */ +export interface Environments { + /** + * Returns a collection of environments. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Creates new or updates existing environment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload Environment entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: Environment, + options?: EnvironmentsCreateOrUpdateOptionalParams, + ): Promise; + /** + * Deletes the environment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsDeleteOptionalParams, + ): Promise; + /** + * Checks if specified environment exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsHeadOptionalParams, + ): Promise; + /** + * Returns details of the environment. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: EnvironmentsGetOptionalParams, + ): Promise; +} diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/index.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/index.ts index 8ea6c50645ed..2e1ee73fe33e 100644 --- a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/index.ts +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/index.ts @@ -8,3 +8,10 @@ export * from "./operations"; export * from "./services"; +export * from "./metadataSchemas"; +export * from "./workspaces"; +export * from "./apis"; +export * from "./apiVersions"; +export * from "./apiDefinitions"; +export * from "./deployments"; +export * from "./environments"; diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/metadataSchemas.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/metadataSchemas.ts new file mode 100644 index 000000000000..cc8072553810 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/metadataSchemas.ts @@ -0,0 +1,82 @@ +/* + * 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 { + MetadataSchema, + MetadataSchemasListOptionalParams, + MetadataSchemasGetOptionalParams, + MetadataSchemasGetResponse, + MetadataSchemasCreateOrUpdateOptionalParams, + MetadataSchemasCreateOrUpdateResponse, + MetadataSchemasDeleteOptionalParams, + MetadataSchemasHeadOptionalParams, + MetadataSchemasHeadResponse, +} from "../models"; + +/// +/** Interface representing a MetadataSchemas. */ +export interface MetadataSchemas { + /** + * Returns a collection of metadata schemas. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Returns details of the metadata schema. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasGetOptionalParams, + ): Promise; + /** + * Creates new or updates existing metadata schema. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload Metadata schema entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: MetadataSchema, + options?: MetadataSchemasCreateOrUpdateOptionalParams, + ): Promise; + /** + * Deletes specified metadata schema. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasDeleteOptionalParams, + ): Promise; + /** + * Checks if specified metadata schema exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: MetadataSchemasHeadOptionalParams, + ): Promise; +} diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/operations.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/operations.ts index 5cf5581845bd..752ab2274cf9 100644 --- a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/operations.ts +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/operations.ts @@ -13,10 +13,10 @@ import { Operation, OperationsListOptionalParams } from "../models"; /** Interface representing a Operations. */ export interface Operations { /** - * List the operations for the provider + * Returns a collection of resource provider operations. * @param options The options parameters. */ list( - options?: OperationsListOptionalParams + options?: OperationsListOptionalParams, ): PagedAsyncIterableIterator; } diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/services.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/services.ts index 2dbc51e5684a..a97912730817 100644 --- a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/services.ts +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/services.ts @@ -17,7 +17,10 @@ import { ServicesCreateOrUpdateResponse, ServicesUpdateOptionalParams, ServicesUpdateResponse, - ServicesDeleteOptionalParams + ServicesDeleteOptionalParams, + MetadataSchemaExportRequest, + ServicesExportMetadataSchemaOptionalParams, + ServicesExportMetadataSchemaResponse, } from "../models"; /// @@ -28,59 +31,72 @@ export interface Services { * @param options The options parameters. */ listBySubscription( - options?: ServicesListBySubscriptionOptionalParams + options?: ServicesListBySubscriptionOptionalParams, ): PagedAsyncIterableIterator; /** - * Lists services within a resource group + * Returns a collection of services within the resource group. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param options The options parameters. */ listByResourceGroup( resourceGroupName: string, - options?: ServicesListByResourceGroupOptionalParams + options?: ServicesListByResourceGroupOptionalParams, ): PagedAsyncIterableIterator; /** - * Get service + * Returns details of the service. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name + * @param serviceName The name of Azure API Center service. * @param options The options parameters. */ get( resourceGroupName: string, serviceName: string, - options?: ServicesGetOptionalParams + options?: ServicesGetOptionalParams, ): Promise; /** - * Create or update service + * Creates new or updates existing API. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name + * @param serviceName The name of Azure API Center service. * @param options The options parameters. */ createOrUpdate( resourceGroupName: string, serviceName: string, - options?: ServicesCreateOrUpdateOptionalParams + options?: ServicesCreateOrUpdateOptionalParams, ): Promise; /** - * Update service + * Updates existing service. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name + * @param serviceName The name of Azure API Center service. * @param options The options parameters. */ update( resourceGroupName: string, serviceName: string, - options?: ServicesUpdateOptionalParams + options?: ServicesUpdateOptionalParams, ): Promise; /** - * Delete service + * Deletes specified service. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serviceName Service name + * @param serviceName The name of Azure API Center service. * @param options The options parameters. */ delete( resourceGroupName: string, serviceName: string, - options?: ServicesDeleteOptionalParams + options?: ServicesDeleteOptionalParams, ): Promise; + /** + * Exports the effective metadata schema. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload The metadata schema request details. + * @param options The options parameters. + */ + exportMetadataSchema( + resourceGroupName: string, + serviceName: string, + payload: MetadataSchemaExportRequest, + options?: ServicesExportMetadataSchemaOptionalParams, + ): Promise; } diff --git a/sdk/apicenter/arm-apicenter/src/operationsInterfaces/workspaces.ts b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/workspaces.ts new file mode 100644 index 000000000000..691750adfedd --- /dev/null +++ b/sdk/apicenter/arm-apicenter/src/operationsInterfaces/workspaces.ts @@ -0,0 +1,82 @@ +/* + * 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 { + Workspace, + WorkspacesListOptionalParams, + WorkspacesGetOptionalParams, + WorkspacesGetResponse, + WorkspacesCreateOrUpdateOptionalParams, + WorkspacesCreateOrUpdateResponse, + WorkspacesDeleteOptionalParams, + WorkspacesHeadOptionalParams, + WorkspacesHeadResponse, +} from "../models"; + +/// +/** Interface representing a Workspaces. */ +export interface Workspaces { + /** + * Returns a collection of workspaces. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesListOptionalParams, + ): PagedAsyncIterableIterator; + /** + * Returns details of the workspace. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesGetOptionalParams, + ): Promise; + /** + * Creates new or updates existing workspace. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param payload Workspace entity. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + serviceName: string, + payload: Workspace, + options?: WorkspacesCreateOrUpdateOptionalParams, + ): Promise; + /** + * Deletes specified workspace. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesDeleteOptionalParams, + ): Promise; + /** + * Checks if specified workspace exists. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceName The name of Azure API Center service. + * @param options The options parameters. + */ + head( + resourceGroupName: string, + serviceName: string, + options?: WorkspacesHeadOptionalParams, + ): Promise; +} diff --git a/sdk/apicenter/arm-apicenter/src/pagingHelper.ts b/sdk/apicenter/arm-apicenter/src/pagingHelper.ts index 269a2b9814b5..205cccc26592 100644 --- a/sdk/apicenter/arm-apicenter/src/pagingHelper.ts +++ b/sdk/apicenter/arm-apicenter/src/pagingHelper.ts @@ -28,7 +28,7 @@ export function getContinuationToken(page: unknown): string | undefined { export function setContinuationToken( page: unknown, - continuationToken: string | undefined + continuationToken: string | undefined, ): void { if (typeof page !== "object" || page === null || !continuationToken) { return; diff --git a/sdk/apicenter/arm-apicenter/test/apicenter_operations_test.spec.ts b/sdk/apicenter/arm-apicenter/test/apicenter_operations_test.spec.ts deleted file mode 100644 index c371f3c0b9f5..000000000000 --- a/sdk/apicenter/arm-apicenter/test/apicenter_operations_test.spec.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -import { - env, - Recorder, - RecorderStartOptions, - delay, - isPlaybackMode, -} from "@azure-tools/test-recorder"; -import { createTestCredential } from "@azure-tools/test-credential"; -import { assert } from "chai"; -import { Context } from "mocha"; -import { AzureAPICenter } from "../src/azureAPICenter"; - -const replaceableVariables: Record = { - AZURE_CLIENT_ID: "azure_client_id", - AZURE_CLIENT_SECRET: "azure_client_secret", - AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", - SUBSCRIPTION_ID: "azure_subscription_id" -}; - -const recorderOptions: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables -}; - -export const testPollingOptions = { - updateIntervalInMs: isPlaybackMode() ? 0 : undefined, -}; - -describe("AzureAPICenter test", () => { - let recorder: Recorder; - let subscriptionId: string; - let client: AzureAPICenter; - let location: string; - let resourceGroup: string; - let resourceName: string; - - beforeEach(async function (this: Context) { - recorder = new Recorder(this.currentTest); - await recorder.start(recorderOptions); - subscriptionId = env.SUBSCRIPTION_ID || ''; - // This is an example of how the environment variables are used - const credential = createTestCredential(); - client = new AzureAPICenter(credential, subscriptionId, recorder.configureClientOptions({})); - location = "eastus"; - resourceGroup = "myjstest"; - resourceName = "testresource" - }); - - afterEach(async function () { - await recorder.stop(); - }); - - it("operation list test", async function () { - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - }); -}) diff --git a/sdk/apicenter/arm-apicenter/test/sampleTest.ts b/sdk/apicenter/arm-apicenter/test/sampleTest.ts new file mode 100644 index 000000000000..d64be981b694 --- /dev/null +++ b/sdk/apicenter/arm-apicenter/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env, +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function (this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function () { + await recorder.stop(); + }); + + it("sample test", async function () { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/apicenter/arm-apicenter/tsconfig.json b/sdk/apicenter/arm-apicenter/tsconfig.json index eb48a45d313a..3e6ae96443f3 100644 --- a/sdk/apicenter/arm-apicenter/tsconfig.json +++ b/sdk/apicenter/arm-apicenter/tsconfig.json @@ -15,17 +15,11 @@ ], "declaration": true, "outDir": "./dist-esm", - "importHelpers": true, - "paths": { - "@azure/arm-apicenter": [ - "./src/index" - ] - } + "importHelpers": true }, "include": [ "./src/**/*.ts", - "./test/**/*.ts", - "samples-dev/**/*.ts" + "./test/**/*.ts" ], "exclude": [ "node_modules"