diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index f10690b25978..c7b7770b481d 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -126,6 +126,7 @@ specifiers: '@rush-temp/arm-powerbiembedded': file:./projects/arm-powerbiembedded.tgz '@rush-temp/arm-privatedns': file:./projects/arm-privatedns.tgz '@rush-temp/arm-purview': file:./projects/arm-purview.tgz + '@rush-temp/arm-quantum': file:./projects/arm-quantum.tgz '@rush-temp/arm-quota': file:./projects/arm-quota.tgz '@rush-temp/arm-recoveryservices': file:./projects/arm-recoveryservices.tgz '@rush-temp/arm-recoveryservices-siterecovery': file:./projects/arm-recoveryservices-siterecovery.tgz @@ -400,6 +401,7 @@ dependencies: '@rush-temp/arm-powerbiembedded': file:projects/arm-powerbiembedded.tgz '@rush-temp/arm-privatedns': file:projects/arm-privatedns.tgz '@rush-temp/arm-purview': file:projects/arm-purview.tgz + '@rush-temp/arm-quantum': file:projects/arm-quantum.tgz '@rush-temp/arm-quota': file:projects/arm-quota.tgz '@rush-temp/arm-recoveryservices': file:projects/arm-recoveryservices.tgz '@rush-temp/arm-recoveryservices-siterecovery': file:projects/arm-recoveryservices-siterecovery.tgz @@ -12346,6 +12348,33 @@ packages: - supports-color dev: false + file:projects/arm-quantum.tgz: + resolution: {integrity: sha512-KQ2UREXN9EEI7mBwrOWmiWd7QAQ8bHMVvgpedsSf4BHTtLuD9n7HUofnbzbPWlZ0uqzlewg6YElB4xYLX7i7/w==, tarball: file:projects/arm-quantum.tgz} + name: '@rush-temp/arm-quantum' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@azure/identity': 2.0.4 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.15.2 + transitivePeerDependencies: + - debug + - encoding + - supports-color + dev: false + file:projects/arm-quota.tgz: resolution: {integrity: sha512-G76riDA+P354TProQEK2WZwCqO/KguhSsIPO24R6f/cjHBqZfPlCKjZ9iDidTIQUPkKptfSQo7PA1sO3t/xn9Q==, tarball: file:projects/arm-quota.tgz} name: '@rush-temp/arm-quota' @@ -16529,7 +16558,7 @@ packages: dev: false file:projects/schema-registry-avro.tgz: - resolution: {integrity: sha512-ADG9wO8rIljoktGdVnP+v8jdrxc43TL0hQgHi7cSXkrJxFGGB6M8XqcDhuT8hYCLfLkRzCwpwH7VSnsjBDVdpg==, tarball: file:projects/schema-registry-avro.tgz} + resolution: {integrity: sha512-9TumFphoGCJiaHQVfz2Z9AsSbhal4ZtZWx7L9fG19JdfEZKJT5uUykYq81plFNWAReFMs83oFPUO//K+BhRuLQ==, tarball: file:projects/schema-registry-avro.tgz} name: '@rush-temp/schema-registry-avro' version: 0.0.0 dependencies: @@ -17674,7 +17703,7 @@ packages: dev: false file:projects/web-pubsub.tgz: - resolution: {integrity: sha512-7qvVc3+mTZX3L5BoserPH04Nwu7kDUUNR5KCtK+ugSa+uTQ5jM0uPXJ3sxgajKuLX+a63eftQtMg2Zcf9K3HZw==, tarball: file:projects/web-pubsub.tgz} + resolution: {integrity: sha512-vAYE6Sk0Olihti+uB+3ac0P3Y+d/XtBXwF2rq0PblaciuLhY/J/3+Y9dpOYDpgTiTyZuAmm+7DDRAq8AYkSETQ==, tarball: file:projects/web-pubsub.tgz} name: '@rush-temp/web-pubsub' version: 0.0.0 dependencies: diff --git a/rush.json b/rush.json index 757c504cb898..5f0b69d22493 100644 --- a/rush.json +++ b/rush.json @@ -1,7 +1,7 @@ /** * This is the main configuration file for Rush. * For full documentation, please see https://rushjs.io - */ { + */{ "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json", /** * (Required) This specifies the version of the Rush engine to be used in this repo. @@ -1680,6 +1680,11 @@ "packageName": "@azure/arm-hardwaresecuritymodules", "projectFolder": "sdk/hardwaresecuritymodules/arm-hardwaresecuritymodules", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-quantum", + "projectFolder": "sdk/quantum/arm-quantum", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/quantum/arm-quantum/CHANGELOG.md b/sdk/quantum/arm-quantum/CHANGELOG.md new file mode 100644 index 000000000000..16435cd936ed --- /dev/null +++ b/sdk/quantum/arm-quantum/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-04-08) + +The package of @azure/arm-quantum 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/quantum/arm-quantum/LICENSE b/sdk/quantum/arm-quantum/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/quantum/arm-quantum/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/quantum/arm-quantum/README.md b/sdk/quantum/arm-quantum/README.md new file mode 100644 index 000000000000..dc1e3428227a --- /dev/null +++ b/sdk/quantum/arm-quantum/README.md @@ -0,0 +1,98 @@ +# Azure Quantum Management client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Quantum Management client. + + + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/quantum/arm-quantum) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-quantum) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-quantum?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-quantum` package + +Install the Azure Quantum Management client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-quantum +``` + +### Create and authenticate a `AzureQuantumManagementClient` + +To create a client object to access the Azure Quantum Management API, you will need the `endpoint` of your Azure Quantum Management resource and a `credential`. The Azure Quantum Management client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Quantum Management resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure Quantum Management** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { AzureQuantumManagementClient } = require("@azure/arm-quantum"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new AzureQuantumManagementClient(new DefaultAzureCredential(), subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### AzureQuantumManagementClient + +`AzureQuantumManagementClient` is the primary interface for developers using the Azure Quantum Management client library. Explore the methods on this client object to understand the different features of the Azure Quantum Management service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fquantum%2Farm-quantum%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/quantum/arm-quantum/_meta.json b/sdk/quantum/arm-quantum/_meta.json new file mode 100644 index 000000000000..7f42c5f1c8c0 --- /dev/null +++ b/sdk/quantum/arm-quantum/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "211006238f3b07a46f938d8920e6bafc9dc64374", + "readme": "specification/quantum/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --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/quantum/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220105.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.2.6", + "use": "@autorest/typescript@6.0.0-alpha.16.20220105.1" +} \ No newline at end of file diff --git a/sdk/quantum/arm-quantum/api-extractor.json b/sdk/quantum/arm-quantum/api-extractor.json new file mode 100644 index 000000000000..6a4126f26a2d --- /dev/null +++ b/sdk/quantum/arm-quantum/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-quantum.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/quantum/arm-quantum/package.json b/sdk/quantum/arm-quantum/package.json new file mode 100644 index 000000000000..ebfdc9a1f1fd --- /dev/null +++ b/sdk/quantum/arm-quantum/package.json @@ -0,0 +1,102 @@ +{ + "name": "@azure/arm-quantum", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for AzureQuantumManagementClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=12.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-quantum.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", + "rollup-plugin-sourcemaps": "^0.4.2", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/quantum/arm-quantum", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/quantum/arm-quantum/review/arm-quantum.api.md b/sdk/quantum/arm-quantum/review/arm-quantum.api.md new file mode 100644 index 000000000000..b59b89950809 --- /dev/null +++ b/sdk/quantum/arm-quantum/review/arm-quantum.api.md @@ -0,0 +1,443 @@ +## API Report File for "@azure/arm-quantum" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public (undocumented) +export class AzureQuantumManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AzureQuantumManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + offerings: Offerings; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; + // (undocumented) + workspace: Workspace; + // (undocumented) + workspaces: Workspaces; +} + +// @public +export interface AzureQuantumManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface CheckNameAvailabilityParameters { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResult { + readonly message?: string; + nameAvailable?: boolean; + reason?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownProvisioningStatus { + // (undocumented) + Failed = "Failed", + // (undocumented) + ProviderDeleting = "ProviderDeleting", + // (undocumented) + ProviderLaunching = "ProviderLaunching", + // (undocumented) + ProviderProvisioning = "ProviderProvisioning", + // (undocumented) + ProviderUpdating = "ProviderUpdating", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownResourceIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned" +} + +// @public +export enum KnownStatus { + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Launching = "Launching", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownUsableStatus { + // (undocumented) + No = "No", + // (undocumented) + Partial = "Partial", + // (undocumented) + Yes = "Yes" +} + +// @public +export interface Offerings { + list(locationName: string, options?: OfferingsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OfferingsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OfferingsListNextResponse = OfferingsListResult; + +// @public +export interface OfferingsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OfferingsListResponse = OfferingsListResult; + +// @public +export interface OfferingsListResult { + nextLink?: string; + value?: ProviderDescription[]; +} + +// @public +export interface Operation { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsList { + nextLink?: string; + value: Operation[]; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationsList; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationsList; + +// @public +export interface PricingDetail { + id?: string; + value?: string; +} + +// @public +export interface PricingDimension { + id?: string; + name?: string; +} + +// @public +export interface Provider { + applicationName?: string; + instanceUri?: string; + providerId?: string; + providerSku?: string; + provisioningState?: Status; + resourceUsageId?: string; +} + +// @public +export interface ProviderDescription { + id?: string; + readonly name?: string; + properties?: ProviderProperties; +} + +// @public +export interface ProviderProperties { + aad?: ProviderPropertiesAad; + readonly company?: string; + readonly defaultEndpoint?: string; + readonly description?: string; + managedApplication?: ProviderPropertiesManagedApplication; + pricingDimensions?: PricingDimension[]; + readonly providerType?: string; + quotaDimensions?: QuotaDimension[]; + skus?: SkuDescription[]; + targets?: TargetDescription[]; +} + +// @public +export interface ProviderPropertiesAad { + readonly applicationId?: string; + readonly tenantId?: string; +} + +// @public +export interface ProviderPropertiesManagedApplication { + readonly offerId?: string; + readonly publisherId?: string; +} + +// @public +export type ProvisioningStatus = string; + +// @public +export type QuantumWorkspace = TrackedResource & { + identity?: QuantumWorkspaceIdentity; + readonly systemData?: SystemData; + providers?: Provider[]; + readonly usable?: UsableStatus; + readonly provisioningState?: ProvisioningStatus; + storageAccount?: string; + readonly endpointUri?: string; +}; + +// @public +export interface QuantumWorkspaceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: ResourceIdentityType; +} + +// @public +export interface QuotaDimension { + description?: string; + id?: string; + name?: string; + period?: string; + quota?: number; + scope?: string; + unit?: string; + unitPlural?: string; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export type ResourceIdentityType = string; + +// @public +export interface SkuDescription { + autoAdd?: boolean; + description?: string; + id?: string; + name?: string; + pricingDetails?: PricingDetail[]; + quotaDimensions?: QuotaDimension[]; + restrictedAccessUri?: string; + targets?: string[]; + version?: string; +} + +// @public +export type Status = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TagsObject { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface TargetDescription { + acceptedContentEncodings?: string[]; + acceptedDataFormats?: string[]; + aliases?: string[]; + description?: string; + id?: string; + name?: string; +} + +// @public +export type TrackedResource = Resource & { + tags?: { + [propertyName: string]: string; + }; + location: string; +}; + +// @public +export type UsableStatus = string; + +// @public +export interface Workspace { + checkNameAvailability(locationName: string, checkNameAvailabilityParameters: CheckNameAvailabilityParameters, options?: WorkspaceCheckNameAvailabilityOptionalParams): Promise; +} + +// @public +export interface WorkspaceCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspaceCheckNameAvailabilityResponse = CheckNameAvailabilityResult; + +// @public +export interface WorkspaceListResult { + nextLink?: string; + value?: QuantumWorkspace[]; +} + +// @public +export interface Workspaces { + beginCreateOrUpdate(resourceGroupName: string, workspaceName: string, quantumWorkspace: QuantumWorkspace, options?: WorkspacesCreateOrUpdateOptionalParams): Promise, WorkspacesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, workspaceName: string, quantumWorkspace: QuantumWorkspace, options?: WorkspacesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, workspaceName: string, options?: WorkspacesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, workspaceName: string, options?: WorkspacesDeleteOptionalParams): Promise; + get(resourceGroupName: string, workspaceName: string, options?: WorkspacesGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: WorkspacesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: WorkspacesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + updateTags(resourceGroupName: string, workspaceName: string, workspaceTags: TagsObject, options?: WorkspacesUpdateTagsOptionalParams): Promise; +} + +// @public +export interface WorkspacesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type WorkspacesCreateOrUpdateResponse = QuantumWorkspace; + +// @public +export interface WorkspacesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface WorkspacesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesGetResponse = QuantumWorkspace; + +// @public +export interface WorkspacesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesListByResourceGroupNextResponse = WorkspaceListResult; + +// @public +export interface WorkspacesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesListByResourceGroupResponse = WorkspaceListResult; + +// @public +export interface WorkspacesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesListBySubscriptionNextResponse = WorkspaceListResult; + +// @public +export interface WorkspacesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesListBySubscriptionResponse = WorkspaceListResult; + +// @public +export interface WorkspacesUpdateTagsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkspacesUpdateTagsResponse = QuantumWorkspace; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/quantum/arm-quantum/rollup.config.js b/sdk/quantum/arm-quantum/rollup.config.js new file mode 100644 index 000000000000..9be1955eb7f1 --- /dev/null +++ b/sdk/quantum/arm-quantum/rollup.config.js @@ -0,0 +1,188 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/quantum/arm-quantum/src/azureQuantumManagementClient.ts b/sdk/quantum/arm-quantum/src/azureQuantumManagementClient.ts new file mode 100644 index 000000000000..c1543a25e334 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/azureQuantumManagementClient.ts @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + WorkspacesImpl, + OfferingsImpl, + OperationsImpl, + WorkspaceImpl +} from "./operations"; +import { + Workspaces, + Offerings, + Operations, + Workspace +} from "./operationsInterfaces"; +import { AzureQuantumManagementClientOptionalParams } from "./models"; + +export class AzureQuantumManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the AzureQuantumManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The Azure subscription ID. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: AzureQuantumManagementClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: AzureQuantumManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-quantum/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-04-05-preview"; + this.workspaces = new WorkspacesImpl(this); + this.offerings = new OfferingsImpl(this); + this.operations = new OperationsImpl(this); + this.workspace = new WorkspaceImpl(this); + } + + workspaces: Workspaces; + offerings: Offerings; + operations: Operations; + workspace: Workspace; +} diff --git a/sdk/quantum/arm-quantum/src/index.ts b/sdk/quantum/arm-quantum/src/index.ts new file mode 100644 index 000000000000..71aaa2c8a2f8 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export * from "./models"; +export { AzureQuantumManagementClient } from "./azureQuantumManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/quantum/arm-quantum/src/lroImpl.ts b/sdk/quantum/arm-quantum/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/quantum/arm-quantum/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/quantum/arm-quantum/src/models/index.ts b/sdk/quantum/arm-quantum/src/models/index.ts new file mode 100644 index 000000000000..262b7a7bda52 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/models/index.ts @@ -0,0 +1,598 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +/** Information about a Provider. A Provider is an entity that offers Targets to run Azure Quantum Jobs. */ +export interface Provider { + /** Unique id of this provider. */ + providerId?: string; + /** The sku associated with pricing information for this provider. */ + providerSku?: string; + /** A Uri identifying the specific instance of this provider. */ + instanceUri?: string; + /** The provider's marketplace application display name. */ + applicationName?: string; + /** Provisioning status field */ + provisioningState?: Status; + /** Id to track resource usage for the provider. */ + resourceUsageId?: string; +} + +/** Managed Identity information. */ +export interface QuantumWorkspaceIdentity { + /** + * The principal ID of resource identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID of resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** The identity type. */ + type?: ResourceIdentityType; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** Tags object for patch operations. */ +export interface TagsObject { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** The response of a list Workspaces operation. */ +export interface WorkspaceListResult { + /** Result of a list Workspaces operation. */ + value?: QuantumWorkspace[]; + /** Link to the next set of results. Not empty if Value contains incomplete list of Workspaces. */ + nextLink?: string; +} + +/** The response of a list Providers operation. */ +export interface OfferingsListResult { + /** Result of a list Providers operation. */ + value?: ProviderDescription[]; + /** Link to the next set of results. Not empty if Value contains incomplete list of Providers. */ + nextLink?: string; +} + +/** Information about an offering. A provider offering is an entity that offers Targets to run Azure Quantum Jobs. */ +export interface ProviderDescription { + /** Unique provider's id. */ + id?: string; + /** + * Provider's display name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** A list of provider-specific properties. */ + properties?: ProviderProperties; +} + +/** Provider properties. */ +export interface ProviderProperties { + /** + * A description about this provider. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; + /** + * Provider type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly providerType?: string; + /** + * Company name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly company?: string; + /** + * Provider's default endpoint. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly defaultEndpoint?: string; + /** Azure Active Directory info. */ + aad?: ProviderPropertiesAad; + /** Provider's Managed-Application info */ + managedApplication?: ProviderPropertiesManagedApplication; + /** The list of targets available from this provider. */ + targets?: TargetDescription[]; + /** The list of skus available from this provider. */ + skus?: SkuDescription[]; + /** The list of quota dimensions from the provider. */ + quotaDimensions?: QuotaDimension[]; + /** The list of pricing dimensions from the provider. */ + pricingDimensions?: PricingDimension[]; +} + +/** Azure Active Directory info. */ +export interface ProviderPropertiesAad { + /** + * Provider's application id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly applicationId?: string; + /** + * Provider's tenant id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; +} + +/** Provider's Managed-Application info */ +export interface ProviderPropertiesManagedApplication { + /** + * Provider's publisher id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly publisherId?: string; + /** + * Provider's offer id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly offerId?: string; +} + +/** Information about a Target. A target is the component that can process a specific type of Job. */ +export interface TargetDescription { + /** Unique target id. */ + id?: string; + /** The list of aliases for the target. */ + aliases?: string[]; + /** Display name of this target. */ + name?: string; + /** A description about this target. */ + description?: string; + /** List of data formats accepted by this target. */ + acceptedDataFormats?: string[]; + /** List of content encodings accepted by this target. */ + acceptedContentEncodings?: string[]; +} + +/** Information about a specific sku. */ +export interface SkuDescription { + /** Unique sku id. */ + id?: string; + /** Display name of this sku. */ + name?: string; + /** Display name of this sku. */ + version?: string; + /** Description about this sku. */ + description?: string; + /** Uri to subscribe to the restricted access sku. */ + restrictedAccessUri?: string; + /** Flag to indicate whether the sku should be automatically added during workspace creation. */ + autoAdd?: boolean; + /** The list of targets available for this sku. */ + targets?: string[]; + /** The list of quota dimensions for this sku. */ + quotaDimensions?: QuotaDimension[]; + /** The list of pricing details for the sku. */ + pricingDetails?: PricingDetail[]; +} + +/** Information about a specific quota dimension. */ +export interface QuotaDimension { + /** Unique id of this dimension. */ + id?: string; + /** The scope of this quota dimension. */ + scope?: string; + /** The reset period of this quota dimension. */ + period?: string; + /** The max limit of this dimension. */ + quota?: number; + /** The display name of this quota dimension. */ + name?: string; + /** A description about this quota dimension. */ + description?: string; + /** The standard unit of measurement used for this quota dimension. */ + unit?: string; + /** The standard unit of measurement used for this quota dimension in plural form. */ + unitPlural?: string; +} + +/** Detailed pricing information for an sku. */ +export interface PricingDetail { + /** Unique id for this pricing information. */ + id?: string; + /** The unit cost of this sku. */ + value?: string; +} + +/** Information about pricing dimension. */ +export interface PricingDimension { + /** Unique id of this pricing dimension. */ + id?: string; + /** The display name of this pricing dimension. */ + name?: string; +} + +/** Lists the operations available. */ +export interface OperationsList { + /** Url to follow for getting next page of operations. */ + nextLink?: string; + /** Array of operations */ + value: Operation[]; +} + +/** Operation provided by provider */ +export interface Operation { + /** Name of the operation */ + name?: string; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; + /** Properties of the operation */ + display?: OperationDisplay; +} + +/** Properties of the operation */ +export interface OperationDisplay { + /** Provider name */ + provider?: string; + /** Resource name */ + resource?: string; + /** Operation name */ + operation?: string; + /** Description of the operation */ + description?: string; +} + +/** Details of check name availability request body. */ +export interface CheckNameAvailabilityParameters { + /** Name for checking availability. */ + name?: string; + /** The resource type of Quantum Workspace. */ + type?: string; +} + +/** Result of check name availability. */ +export interface CheckNameAvailabilityResult { + /** Indicator of availability of the Quantum Workspace resource name. */ + nameAvailable?: boolean; + /** The reason of unavailability. */ + reason?: string; + /** + * The detailed info regarding the reason associated with the Namespace. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export type TrackedResource = Resource & { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +}; + +/** The resource proxy definition object for quantum workspace. */ +export type QuantumWorkspace = TrackedResource & { + /** Managed Identity information. */ + identity?: QuantumWorkspaceIdentity; + /** + * System metadata + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** List of Providers selected for this Workspace */ + providers?: Provider[]; + /** + * Whether the current workspace is ready to accept Jobs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly usable?: UsableStatus; + /** + * Provisioning status field + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningStatus; + /** ARM Resource Id of the storage account associated with this workspace. */ + storageAccount?: string; + /** + * The URI of the workspace endpoint. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly endpointUri?: string; +}; + +/** Known values of {@link Status} that the service accepts. */ +export enum KnownStatus { + Succeeded = "Succeeded", + Launching = "Launching", + Updating = "Updating", + Deleting = "Deleting", + Deleted = "Deleted", + Failed = "Failed" +} + +/** + * Defines values for Status. \ + * {@link KnownStatus} can be used interchangeably with Status, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Launching** \ + * **Updating** \ + * **Deleting** \ + * **Deleted** \ + * **Failed** + */ +export type Status = string; + +/** Known values of {@link UsableStatus} that the service accepts. */ +export enum KnownUsableStatus { + Yes = "Yes", + No = "No", + Partial = "Partial" +} + +/** + * Defines values for UsableStatus. \ + * {@link KnownUsableStatus} can be used interchangeably with UsableStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Yes** \ + * **No** \ + * **Partial** + */ +export type UsableStatus = string; + +/** Known values of {@link ProvisioningStatus} that the service accepts. */ +export enum KnownProvisioningStatus { + Succeeded = "Succeeded", + ProviderLaunching = "ProviderLaunching", + ProviderUpdating = "ProviderUpdating", + ProviderDeleting = "ProviderDeleting", + ProviderProvisioning = "ProviderProvisioning", + Failed = "Failed" +} + +/** + * Defines values for ProvisioningStatus. \ + * {@link KnownProvisioningStatus} can be used interchangeably with ProvisioningStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **ProviderLaunching** \ + * **ProviderUpdating** \ + * **ProviderDeleting** \ + * **ProviderProvisioning** \ + * **Failed** + */ +export type ProvisioningStatus = string; + +/** Known values of {@link ResourceIdentityType} that the service accepts. */ +export enum KnownResourceIdentityType { + SystemAssigned = "SystemAssigned", + None = "None" +} + +/** + * Defines values for ResourceIdentityType. \ + * {@link KnownResourceIdentityType} can be used interchangeably with ResourceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SystemAssigned** \ + * **None** + */ +export type ResourceIdentityType = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Optional parameters. */ +export interface WorkspacesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type WorkspacesGetResponse = QuantumWorkspace; + +/** Optional parameters. */ +export interface WorkspacesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type WorkspacesCreateOrUpdateResponse = QuantumWorkspace; + +/** Optional parameters. */ +export interface WorkspacesUpdateTagsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the updateTags operation. */ +export type WorkspacesUpdateTagsResponse = QuantumWorkspace; + +/** Optional parameters. */ +export interface WorkspacesDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface WorkspacesListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type WorkspacesListBySubscriptionResponse = WorkspaceListResult; + +/** Optional parameters. */ +export interface WorkspacesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type WorkspacesListByResourceGroupResponse = WorkspaceListResult; + +/** Optional parameters. */ +export interface WorkspacesListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type WorkspacesListBySubscriptionNextResponse = WorkspaceListResult; + +/** Optional parameters. */ +export interface WorkspacesListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type WorkspacesListByResourceGroupNextResponse = WorkspaceListResult; + +/** Optional parameters. */ +export interface OfferingsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OfferingsListResponse = OfferingsListResult; + +/** Optional parameters. */ +export interface OfferingsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OfferingsListNextResponse = OfferingsListResult; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationsList; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationsList; + +/** Optional parameters. */ +export interface WorkspaceCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkNameAvailability operation. */ +export type WorkspaceCheckNameAvailabilityResponse = CheckNameAvailabilityResult; + +/** Optional parameters. */ +export interface AzureQuantumManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/quantum/arm-quantum/src/models/mappers.ts b/sdk/quantum/arm-quantum/src/models/mappers.ts new file mode 100644 index 000000000000..8890bcb06343 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/models/mappers.ts @@ -0,0 +1,963 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const Provider: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Provider", + modelProperties: { + providerId: { + serializedName: "providerId", + type: { + name: "String" + } + }, + providerSku: { + serializedName: "providerSku", + type: { + name: "String" + } + }, + instanceUri: { + serializedName: "instanceUri", + type: { + name: "String" + } + }, + applicationName: { + serializedName: "applicationName", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + }, + resourceUsageId: { + serializedName: "resourceUsageId", + type: { + name: "String" + } + } + } + } +}; + +export const QuantumWorkspaceIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuantumWorkspaceIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const TagsObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TagsObject", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const WorkspaceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkspaceListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QuantumWorkspace" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OfferingsListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OfferingsListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProviderDescription" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ProviderDescription: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderDescription", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ProviderProperties" + } + } + } + } +}; + +export const ProviderProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderProperties", + modelProperties: { + description: { + serializedName: "description", + readOnly: true, + type: { + name: "String" + } + }, + providerType: { + serializedName: "providerType", + readOnly: true, + type: { + name: "String" + } + }, + company: { + serializedName: "company", + readOnly: true, + type: { + name: "String" + } + }, + defaultEndpoint: { + serializedName: "defaultEndpoint", + readOnly: true, + type: { + name: "String" + } + }, + aad: { + serializedName: "aad", + type: { + name: "Composite", + className: "ProviderPropertiesAad" + } + }, + managedApplication: { + serializedName: "managedApplication", + type: { + name: "Composite", + className: "ProviderPropertiesManagedApplication" + } + }, + targets: { + serializedName: "targets", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TargetDescription" + } + } + } + }, + skus: { + serializedName: "skus", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuDescription" + } + } + } + }, + quotaDimensions: { + serializedName: "quotaDimensions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QuotaDimension" + } + } + } + }, + pricingDimensions: { + serializedName: "pricingDimensions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PricingDimension" + } + } + } + } + } + } +}; + +export const ProviderPropertiesAad: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderPropertiesAad", + modelProperties: { + applicationId: { + serializedName: "applicationId", + readOnly: true, + type: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProviderPropertiesManagedApplication: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderPropertiesManagedApplication", + modelProperties: { + publisherId: { + serializedName: "publisherId", + readOnly: true, + type: { + name: "String" + } + }, + offerId: { + serializedName: "offerId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const TargetDescription: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TargetDescription", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + aliases: { + serializedName: "aliases", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + acceptedDataFormats: { + serializedName: "acceptedDataFormats", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + acceptedContentEncodings: { + serializedName: "acceptedContentEncodings", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const SkuDescription: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SkuDescription", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + restrictedAccessUri: { + serializedName: "restrictedAccessUri", + type: { + name: "String" + } + }, + autoAdd: { + serializedName: "autoAdd", + type: { + name: "Boolean" + } + }, + targets: { + serializedName: "targets", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + quotaDimensions: { + serializedName: "quotaDimensions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QuotaDimension" + } + } + } + }, + pricingDetails: { + serializedName: "pricingDetails", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PricingDetail" + } + } + } + } + } + } +}; + +export const QuotaDimension: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaDimension", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + scope: { + serializedName: "scope", + type: { + name: "String" + } + }, + period: { + serializedName: "period", + type: { + name: "String" + } + }, + quota: { + serializedName: "quota", + type: { + name: "Number" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", + type: { + name: "String" + } + }, + unitPlural: { + serializedName: "unitPlural", + type: { + name: "String" + } + } + } + } +}; + +export const PricingDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PricingDetail", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const PricingDimension: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PricingDimension", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const OperationsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationsList", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityParameters", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + defaultValue: "Microsoft.Quantum/Workspaces", + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityResult", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const QuantumWorkspace: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuantumWorkspace", + modelProperties: { + ...TrackedResource.type.modelProperties, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "QuantumWorkspaceIdentity" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + providers: { + serializedName: "properties.providers", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Provider" + } + } + } + }, + usable: { + serializedName: "properties.usable", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + storageAccount: { + serializedName: "properties.storageAccount", + type: { + name: "String" + } + }, + endpointUri: { + serializedName: "properties.endpointUri", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/quantum/arm-quantum/src/models/parameters.ts b/sdk/quantum/arm-quantum/src/models/parameters.ts new file mode 100644 index 000000000000..b68a252b8716 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/models/parameters.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + QuantumWorkspace as QuantumWorkspaceMapper, + TagsObject as TagsObjectMapper, + CheckNameAvailabilityParameters as CheckNameAvailabilityParametersMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-04-05-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const workspaceName: OperationURLParameter = { + parameterPath: "workspaceName", + mapper: { + serializedName: "workspaceName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const quantumWorkspace: OperationParameter = { + parameterPath: "quantumWorkspace", + mapper: QuantumWorkspaceMapper +}; + +export const workspaceTags: OperationParameter = { + parameterPath: "workspaceTags", + mapper: TagsObjectMapper +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const locationName: OperationURLParameter = { + parameterPath: "locationName", + mapper: { + serializedName: "locationName", + required: true, + type: { + name: "String" + } + } +}; + +export const checkNameAvailabilityParameters: OperationParameter = { + parameterPath: "checkNameAvailabilityParameters", + mapper: CheckNameAvailabilityParametersMapper +}; diff --git a/sdk/quantum/arm-quantum/src/operations/index.ts b/sdk/quantum/arm-quantum/src/operations/index.ts new file mode 100644 index 000000000000..2cd904eff132 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operations/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./workspaces"; +export * from "./offerings"; +export * from "./operations"; +export * from "./workspace"; diff --git a/sdk/quantum/arm-quantum/src/operations/offerings.ts b/sdk/quantum/arm-quantum/src/operations/offerings.ts new file mode 100644 index 000000000000..61c9e72c2ab3 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operations/offerings.ts @@ -0,0 +1,158 @@ +/* + * 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 { Offerings } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuantumManagementClient } from "../azureQuantumManagementClient"; +import { + ProviderDescription, + OfferingsListNextOptionalParams, + OfferingsListOptionalParams, + OfferingsListResponse, + OfferingsListNextResponse +} from "../models"; + +/// +/** Class containing Offerings operations. */ +export class OfferingsImpl implements Offerings { + private readonly client: AzureQuantumManagementClient; + + /** + * Initialize a new instance of the class Offerings class. + * @param client Reference to the service client + */ + constructor(client: AzureQuantumManagementClient) { + this.client = client; + } + + /** + * Returns the list of all provider offerings available for the given location. + * @param locationName Location. + * @param options The options parameters. + */ + public list( + locationName: string, + options?: OfferingsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(locationName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(locationName, options); + } + }; + } + + private async *listPagingPage( + locationName: string, + options?: OfferingsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(locationName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(locationName, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + locationName: string, + options?: OfferingsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(locationName, options)) { + yield* page; + } + } + + /** + * Returns the list of all provider offerings available for the given location. + * @param locationName Location. + * @param options The options parameters. + */ + private _list( + locationName: string, + options?: OfferingsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { locationName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param locationName Location. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + locationName: string, + nextLink: string, + options?: OfferingsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { locationName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/offerings", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OfferingsListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OfferingsListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.locationName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quantum/arm-quantum/src/operations/operations.ts b/sdk/quantum/arm-quantum/src/operations/operations.ts new file mode 100644 index 000000000000..06dfa4141a76 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operations/operations.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuantumManagementClient } from "../azureQuantumManagementClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: AzureQuantumManagementClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: AzureQuantumManagementClient) { + this.client = client; + } + + /** + * Returns list of operations. + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Returns list of operations. + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Quantum/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationsList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quantum/arm-quantum/src/operations/workspace.ts b/sdk/quantum/arm-quantum/src/operations/workspace.ts new file mode 100644 index 000000000000..b71304e338d8 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operations/workspace.ts @@ -0,0 +1,74 @@ +/* + * 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 { Workspace } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuantumManagementClient } from "../azureQuantumManagementClient"; +import { + CheckNameAvailabilityParameters, + WorkspaceCheckNameAvailabilityOptionalParams, + WorkspaceCheckNameAvailabilityResponse +} from "../models"; + +/** Class containing Workspace operations. */ +export class WorkspaceImpl implements Workspace { + private readonly client: AzureQuantumManagementClient; + + /** + * Initialize a new instance of the class Workspace class. + * @param client Reference to the service client + */ + constructor(client: AzureQuantumManagementClient) { + this.client = client; + } + + /** + * Check the availability of the resource name. + * @param locationName Location. + * @param checkNameAvailabilityParameters The name and type of the resource. + * @param options The options parameters. + */ + checkNameAvailability( + locationName: string, + checkNameAvailabilityParameters: CheckNameAvailabilityParameters, + options?: WorkspaceCheckNameAvailabilityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { locationName, checkNameAvailabilityParameters, options }, + checkNameAvailabilityOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Quantum/locations/{locationName}/checkNameAvailability", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckNameAvailabilityResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.checkNameAvailabilityParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.locationName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/quantum/arm-quantum/src/operations/workspaces.ts b/sdk/quantum/arm-quantum/src/operations/workspaces.ts new file mode 100644 index 000000000000..9f920d3ff9c3 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operations/workspaces.ts @@ -0,0 +1,595 @@ +/* + * 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 { Workspaces } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureQuantumManagementClient } from "../azureQuantumManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + QuantumWorkspace, + WorkspacesListBySubscriptionNextOptionalParams, + WorkspacesListBySubscriptionOptionalParams, + WorkspacesListByResourceGroupNextOptionalParams, + WorkspacesListByResourceGroupOptionalParams, + WorkspacesGetOptionalParams, + WorkspacesGetResponse, + WorkspacesCreateOrUpdateOptionalParams, + WorkspacesCreateOrUpdateResponse, + TagsObject, + WorkspacesUpdateTagsOptionalParams, + WorkspacesUpdateTagsResponse, + WorkspacesDeleteOptionalParams, + WorkspacesListBySubscriptionResponse, + WorkspacesListByResourceGroupResponse, + WorkspacesListBySubscriptionNextResponse, + WorkspacesListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing Workspaces operations. */ +export class WorkspacesImpl implements Workspaces { + private readonly client: AzureQuantumManagementClient; + + /** + * Initialize a new instance of the class Workspaces class. + * @param client Reference to the service client + */ + constructor(client: AzureQuantumManagementClient) { + this.client = client; + } + + /** + * Gets the list of Workspaces within a Subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: WorkspacesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: WorkspacesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listBySubscriptionPagingAll( + options?: WorkspacesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Gets the list of Workspaces within a resource group. + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: WorkspacesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: WorkspacesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: WorkspacesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Returns the Workspace resource associated with the given name. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + options?: WorkspacesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, options }, + getOperationSpec + ); + } + + /** + * Creates or updates a workspace resource. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param quantumWorkspace Workspace details. + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + workspaceName: string, + quantumWorkspace: QuantumWorkspace, + options?: WorkspacesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + WorkspacesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, workspaceName, quantumWorkspace, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Creates or updates a workspace resource. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param quantumWorkspace Workspace details. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + workspaceName: string, + quantumWorkspace: QuantumWorkspace, + options?: WorkspacesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + workspaceName, + quantumWorkspace, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates an existing workspace's tags. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param workspaceTags Parameters supplied to update tags. + * @param options The options parameters. + */ + updateTags( + resourceGroupName: string, + workspaceName: string, + workspaceTags: TagsObject, + options?: WorkspacesUpdateTagsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, workspaceTags, options }, + updateTagsOperationSpec + ); + } + + /** + * Deletes a Workspace resource. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + workspaceName: string, + options?: WorkspacesDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, workspaceName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Deletes a Workspace resource. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + workspaceName: string, + options?: WorkspacesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + workspaceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Gets the list of Workspaces within a Subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: WorkspacesListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Gets the list of Workspaces within a resource group. + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: WorkspacesListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: WorkspacesListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: WorkspacesListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.QuantumWorkspace + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.QuantumWorkspace + }, + 201: { + bodyMapper: Mappers.QuantumWorkspace + }, + 202: { + bodyMapper: Mappers.QuantumWorkspace + }, + 204: { + bodyMapper: Mappers.QuantumWorkspace + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.quantumWorkspace, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateTagsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.QuantumWorkspace + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.workspaceTags, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces/{workspaceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Quantum/workspaces", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkspaceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Quantum/workspaces", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkspaceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkspaceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.WorkspaceListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/quantum/arm-quantum/src/operationsInterfaces/index.ts b/sdk/quantum/arm-quantum/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..2cd904eff132 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operationsInterfaces/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./workspaces"; +export * from "./offerings"; +export * from "./operations"; +export * from "./workspace"; diff --git a/sdk/quantum/arm-quantum/src/operationsInterfaces/offerings.ts b/sdk/quantum/arm-quantum/src/operationsInterfaces/offerings.ts new file mode 100644 index 000000000000..8ae818d90725 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operationsInterfaces/offerings.ts @@ -0,0 +1,24 @@ +/* + * 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 { ProviderDescription, OfferingsListOptionalParams } from "../models"; + +/// +/** Interface representing a Offerings. */ +export interface Offerings { + /** + * Returns the list of all provider offerings available for the given location. + * @param locationName Location. + * @param options The options parameters. + */ + list( + locationName: string, + options?: OfferingsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/quantum/arm-quantum/src/operationsInterfaces/operations.ts b/sdk/quantum/arm-quantum/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..0c50b09b459e --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Returns list of operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/quantum/arm-quantum/src/operationsInterfaces/workspace.ts b/sdk/quantum/arm-quantum/src/operationsInterfaces/workspace.ts new file mode 100644 index 000000000000..04e44aaa243d --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operationsInterfaces/workspace.ts @@ -0,0 +1,28 @@ +/* + * 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 { + CheckNameAvailabilityParameters, + WorkspaceCheckNameAvailabilityOptionalParams, + WorkspaceCheckNameAvailabilityResponse +} from "../models"; + +/** Interface representing a Workspace. */ +export interface Workspace { + /** + * Check the availability of the resource name. + * @param locationName Location. + * @param checkNameAvailabilityParameters The name and type of the resource. + * @param options The options parameters. + */ + checkNameAvailability( + locationName: string, + checkNameAvailabilityParameters: CheckNameAvailabilityParameters, + options?: WorkspaceCheckNameAvailabilityOptionalParams + ): Promise; +} diff --git a/sdk/quantum/arm-quantum/src/operationsInterfaces/workspaces.ts b/sdk/quantum/arm-quantum/src/operationsInterfaces/workspaces.ts new file mode 100644 index 000000000000..dbde5e46ff88 --- /dev/null +++ b/sdk/quantum/arm-quantum/src/operationsInterfaces/workspaces.ts @@ -0,0 +1,121 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + QuantumWorkspace, + WorkspacesListBySubscriptionOptionalParams, + WorkspacesListByResourceGroupOptionalParams, + WorkspacesGetOptionalParams, + WorkspacesGetResponse, + WorkspacesCreateOrUpdateOptionalParams, + WorkspacesCreateOrUpdateResponse, + TagsObject, + WorkspacesUpdateTagsOptionalParams, + WorkspacesUpdateTagsResponse, + WorkspacesDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a Workspaces. */ +export interface Workspaces { + /** + * Gets the list of Workspaces within a Subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: WorkspacesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the list of Workspaces within a resource group. + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: WorkspacesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns the Workspace resource associated with the given name. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + options?: WorkspacesGetOptionalParams + ): Promise; + /** + * Creates or updates a workspace resource. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param quantumWorkspace Workspace details. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + workspaceName: string, + quantumWorkspace: QuantumWorkspace, + options?: WorkspacesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + WorkspacesCreateOrUpdateResponse + > + >; + /** + * Creates or updates a workspace resource. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param quantumWorkspace Workspace details. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + workspaceName: string, + quantumWorkspace: QuantumWorkspace, + options?: WorkspacesCreateOrUpdateOptionalParams + ): Promise; + /** + * Updates an existing workspace's tags. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param workspaceTags Parameters supplied to update tags. + * @param options The options parameters. + */ + updateTags( + resourceGroupName: string, + workspaceName: string, + workspaceTags: TagsObject, + options?: WorkspacesUpdateTagsOptionalParams + ): Promise; + /** + * Deletes a Workspace resource. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + workspaceName: string, + options?: WorkspacesDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes a Workspace resource. + * @param resourceGroupName The name of the resource group. + * @param workspaceName The name of the quantum workspace resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + workspaceName: string, + options?: WorkspacesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/quantum/arm-quantum/test/sampleTest.ts b/sdk/quantum/arm-quantum/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/quantum/arm-quantum/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/quantum/arm-quantum/tsconfig.json b/sdk/quantum/arm-quantum/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/quantum/arm-quantum/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/quantum/ci.mgmt.yml b/sdk/quantum/ci.mgmt.yml new file mode 100644 index 000000000000..b9627cdd0cd6 --- /dev/null +++ b/sdk/quantum/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/quantum/arm-quantum + - sdk/quantum/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/quantum/arm-quantum + - sdk/quantum/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: quantum + Artifacts: + - name: azure-arm-quantum + safeName: azurearmquantum + \ No newline at end of file diff --git a/sdk/quantum/ci.yml b/sdk/quantum/ci.yml index 2586f92bc7ab..00bd5c983d6d 100644 --- a/sdk/quantum/ci.yml +++ b/sdk/quantum/ci.yml @@ -1,6 +1,5 @@ -# DO NOT EDIT THIS FILE -# This file is generated automatically and any changes will be lost. - +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + trigger: branches: include: @@ -11,7 +10,9 @@ trigger: include: - sdk/quantum/ - eng/common/ - + exclude: + - sdk/quantum/arm-quantum + - sdk/quantum/ci.mgmt.yml pr: branches: include: @@ -22,7 +23,9 @@ pr: paths: include: - sdk/quantum/ - + exclude: + - sdk/quantum/arm-quantum + - sdk/quantum/ci.mgmt.yml extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: