diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 826f4eb84101..3dd0e7fd8c17 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -45,6 +45,7 @@ specifiers: '@rush-temp/arm-mysql': file:./projects/arm-mysql.tgz '@rush-temp/arm-network': file:./projects/arm-network.tgz '@rush-temp/arm-notificationhubs': file:./projects/arm-notificationhubs.tgz + '@rush-temp/arm-oep': file:./projects/arm-oep.tgz '@rush-temp/arm-operationalinsights': file:./projects/arm-operationalinsights.tgz '@rush-temp/arm-operations': file:./projects/arm-operations.tgz '@rush-temp/arm-orbital': file:./projects/arm-orbital.tgz @@ -217,6 +218,7 @@ dependencies: '@rush-temp/arm-mysql': file:projects/arm-mysql.tgz '@rush-temp/arm-network': file:projects/arm-network.tgz '@rush-temp/arm-notificationhubs': file:projects/arm-notificationhubs.tgz + '@rush-temp/arm-oep': file:projects/arm-oep.tgz '@rush-temp/arm-operationalinsights': file:projects/arm-operationalinsights.tgz '@rush-temp/arm-operations': file:projects/arm-operations.tgz '@rush-temp/arm-orbital': file:projects/arm-orbital.tgz @@ -1598,6 +1600,7 @@ packages: /@opentelemetry/node/0.22.0_@opentelemetry+api@1.0.3: resolution: {integrity: sha512-+HhGbDruQ7cwejVOIYyxRa28uosnG8W95NiQZ6qE8PXXPsDSyGeftAPbtYpGit0H2f5hrVcMlwmWHeAo9xkSLA==} engines: {node: '>=8.0.0'} + deprecated: Package renamed to @opentelemetry/sdk-trace-node peerDependencies: '@opentelemetry/api': ^1.0.0 dependencies: @@ -8978,6 +8981,27 @@ packages: uglify-js: 3.14.3 dev: false + file:projects/arm-oep.tgz: + resolution: {integrity: sha512-njAvwJw2q+zQaLmVOfkEDSp3xIxnooAwO0RY/TSR69xHFSH+rMeR0GDQlTw0sM9UwrCgHiCtLjXcfxTyOvBRlw==, tarball: file:projects/arm-oep.tgz} + name: '@rush-temp/arm-oep' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.18.19 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.3 + dev: false + file:projects/arm-operationalinsights.tgz: resolution: {integrity: sha512-aCOEc9JiPgRSPW5sSz+jEIATAz64iWyKGgCEEIx7/MeTgkvw2BRcfA5Hod2fNS+nOP3KCIeH/Pqbqc+if65uQw==, tarball: file:projects/arm-operationalinsights.tgz} name: '@rush-temp/arm-operationalinsights' diff --git a/rush.json b/rush.json index 31b7a12df147..2a7d652a526d 100644 --- a/rush.json +++ b/rush.json @@ -1170,6 +1170,11 @@ "packageName": "@azure/arm-msi", "projectFolder": "sdk/msi/arm-msi", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-oep", + "projectFolder": "sdk/oep/arm-oep", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/oep/arm-oep/CHANGELOG.md b/sdk/oep/arm-oep/CHANGELOG.md new file mode 100644 index 000000000000..bacebc998883 --- /dev/null +++ b/sdk/oep/arm-oep/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-12-20) + +The package of @azure/arm-oep 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/oep/arm-oep/LICENSE b/sdk/oep/arm-oep/LICENSE new file mode 100644 index 000000000000..ccb63b166732 --- /dev/null +++ b/sdk/oep/arm-oep/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/oep/arm-oep/README.md b/sdk/oep/arm-oep/README.md new file mode 100644 index 000000000000..d037d7f90034 --- /dev/null +++ b/sdk/oep/arm-oep/README.md @@ -0,0 +1,98 @@ +# Azure Open Energy Platform Management client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Open Energy Platform Management client. + +Open Energy Platform Management Service APIs + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/oep/arm-oep) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-oep) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-oep) | +[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-oep` package + +Install the Azure Open Energy Platform Management client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-oep +``` + +### Create and authenticate a `OpenEnergyPlatformManagementServiceAPIs` + +To create a client object to access the Azure Open Energy Platform Management API, you will need the `endpoint` of your Azure Open Energy Platform Management resource and a `credential`. The Azure Open Energy Platform Management client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Open Energy Platform 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 Open Energy Platform 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 { OpenEnergyPlatformManagementServiceAPIs } = require("@azure/arm-oep"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new OpenEnergyPlatformManagementServiceAPIs(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 + +### OpenEnergyPlatformManagementServiceAPIs + +`OpenEnergyPlatformManagementServiceAPIs` is the primary interface for developers using the Azure Open Energy Platform Management client library. Explore the methods on this client object to understand the different features of the Azure Open Energy Platform 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%2Foep%2Farm-oep%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/oep/arm-oep/_meta.json b/sdk/oep/arm-oep/_meta.json new file mode 100644 index 000000000000..7b6f304cccd7 --- /dev/null +++ b/sdk/oep/arm-oep/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "be864eed86d67e5e608b3fff21c3d45ee68aa51f", + "readme": "specification/oep/resource-manager/readme.md", + "autorest_command": "autorest --version=3.1.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/oep/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20211130.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20211130.1" +} \ No newline at end of file diff --git a/sdk/oep/arm-oep/api-extractor.json b/sdk/oep/arm-oep/api-extractor.json new file mode 100644 index 000000000000..02816260bb0b --- /dev/null +++ b/sdk/oep/arm-oep/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-oep.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/oep/arm-oep/package.json b/sdk/oep/arm-oep/package.json new file mode 100644 index 000000000000..60d8bd31c634 --- /dev/null +++ b/sdk/oep/arm-oep/package.json @@ -0,0 +1,92 @@ +{ + "name": "@azure/arm-oep", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for OpenEnergyPlatformManagementServiceAPIs.", + "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-oep.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/oep/arm-oep", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "autoPublish": true +} diff --git a/sdk/oep/arm-oep/review/arm-oep.api.md b/sdk/oep/arm-oep/review/arm-oep.api.md new file mode 100644 index 000000000000..0d316a172eab --- /dev/null +++ b/sdk/oep/arm-oep/review/arm-oep.api.md @@ -0,0 +1,262 @@ +## API Report File for "@azure/arm-oep" + +> 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 interface CheckNameAvailabilityRequest { + // (undocumented) + name: string; + // (undocumented) + type: string; +} + +// @public (undocumented) +export interface CheckNameAvailabilityResponse { + readonly message?: string; + readonly nameAvailable?: boolean; + readonly reason?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface EnergyServices { + beginCreate(resourceGroupName: string, resourceName: string, options?: EnergyServicesCreateOptionalParams): Promise, EnergyServicesCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, resourceName: string, options?: EnergyServicesCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, options?: EnergyServicesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, options?: EnergyServicesDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, options?: EnergyServicesGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: EnergyServicesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: EnergyServicesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + // (undocumented) + update(resourceGroupName: string, resourceName: string, options?: EnergyServicesUpdateOptionalParams): Promise; +} + +// @public +export interface EnergyServicesCreateOptionalParams extends coreClient.OperationOptions { + body?: OepResource; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type EnergyServicesCreateResponse = OepResource; + +// @public +export interface EnergyServicesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface EnergyServicesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnergyServicesGetResponse = OepResource; + +// @public +export interface EnergyServicesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnergyServicesListByResourceGroupNextResponse = OepResourceList; + +// @public +export interface EnergyServicesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnergyServicesListByResourceGroupResponse = OepResourceList; + +// @public +export interface EnergyServicesListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnergyServicesListBySubscriptionNextResponse = OepResourceList; + +// @public +export interface EnergyServicesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnergyServicesListBySubscriptionResponse = OepResourceList; + +// @public +export interface EnergyServicesUpdateOptionalParams extends coreClient.OperationOptions { + body?: OepPatchResource; +} + +// @public +export type EnergyServicesUpdateResponse = OepResource; + +// @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 (undocumented) +export interface Item { + // (undocumented) + name?: string; +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Unknown = "Unknown", + // (undocumented) + Updating = "Updating" +} + +// @public +export interface Locations { + checkNameAvailability(body: CheckNameAvailabilityRequest, options?: LocationsCheckNameAvailabilityOptionalParams): Promise; +} + +// @public +export interface LocationsCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LocationsCheckNameAvailabilityResponse = CheckNameAvailabilityResponse; + +// @public +export type OepPatchResource = TrackedResourceUpdate & {}; + +// @public (undocumented) +export interface OepProperties { + // (undocumented) + authAppId?: string; + // (undocumented) + dataPartitionNames?: Item[]; + readonly dnsName?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public (undocumented) +export type OepResource = Resource & { + properties?: OepProperties; + tags?: { + [propertyName: string]: string; + }; + location: string; +}; + +// @public +export interface OepResourceList { + nextLink?: string; + value?: OepResource[]; +} + +// @public (undocumented) +export class OpenEnergyPlatformManagementServiceAPIs extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: OpenEnergyPlatformManagementServiceAPIsOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + energyServices: EnergyServices; + // (undocumented) + locations: Locations; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface OpenEnergyPlatformManagementServiceAPIsOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): Promise; +} + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ProvisioningState = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResourceUpdate { + tags?: { + [propertyName: string]: string; + }; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/oep/arm-oep/rollup.config.js b/sdk/oep/arm-oep/rollup.config.js new file mode 100644 index 000000000000..9be1955eb7f1 --- /dev/null +++ b/sdk/oep/arm-oep/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/oep/arm-oep/src/index.ts b/sdk/oep/arm-oep/src/index.ts new file mode 100644 index 000000000000..b523f21fb4a2 --- /dev/null +++ b/sdk/oep/arm-oep/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 { OpenEnergyPlatformManagementServiceAPIs } from "./openEnergyPlatformManagementServiceAPIs"; +export * from "./operationsInterfaces"; diff --git a/sdk/oep/arm-oep/src/lroImpl.ts b/sdk/oep/arm-oep/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/oep/arm-oep/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/oep/arm-oep/src/models/index.ts b/sdk/oep/arm-oep/src/models/index.ts new file mode 100644 index 000000000000..ec1cdf6390a3 --- /dev/null +++ b/sdk/oep/arm-oep/src/models/index.ts @@ -0,0 +1,286 @@ +/* + * 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 interface CheckNameAvailabilityRequest { + name: string; + type: string; +} + +export interface CheckNameAvailabilityResponse { + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly nameAvailable?: boolean; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly reason?: string; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly message?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** The list of oep resources. */ +export interface OepResourceList { + /** The link used to get the next page of oep resources list. */ + nextLink?: string; + /** The list of oep resources. */ + value?: OepResource[]; +} + +export interface OepProperties { + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly dnsName?: string; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly provisioningState?: ProvisioningState; + authAppId?: string; + dataPartitionNames?: Item[]; +} + +export interface Item { + name?: string; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** The resource model definition used for updating a tracked ARM resource. */ +export interface TrackedResourceUpdate { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +export type OepResource = Resource & { + properties?: OepProperties; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Geo-location where the resource lives. */ + location: string; +}; + +/** OepResource patch properties */ +export type OepPatchResource = TrackedResourceUpdate & {}; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Unknown = "Unknown", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Updating = "Updating" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Creating** \ + * **Deleting** \ + * **Updating** + */ +export type ProvisioningState = 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 LocationsCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkNameAvailability operation. */ +export type LocationsCheckNameAvailabilityResponse = CheckNameAvailabilityResponse; + +/** Optional parameters. */ +export interface EnergyServicesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type EnergyServicesListByResourceGroupResponse = OepResourceList; + +/** Optional parameters. */ +export interface EnergyServicesListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type EnergyServicesListBySubscriptionResponse = OepResourceList; + +/** Optional parameters. */ +export interface EnergyServicesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type EnergyServicesGetResponse = OepResource; + +/** Optional parameters. */ +export interface EnergyServicesCreateOptionalParams + extends coreClient.OperationOptions { + /** Request body. */ + body?: OepResource; + /** 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 create operation. */ +export type EnergyServicesCreateResponse = OepResource; + +/** Optional parameters. */ +export interface EnergyServicesUpdateOptionalParams + extends coreClient.OperationOptions { + /** OepResource patch properties */ + body?: OepPatchResource; +} + +/** Contains response data for the update operation. */ +export type EnergyServicesUpdateResponse = OepResource; + +/** Optional parameters. */ +export interface EnergyServicesDeleteOptionalParams + 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 EnergyServicesListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type EnergyServicesListByResourceGroupNextResponse = OepResourceList; + +/** Optional parameters. */ +export interface EnergyServicesListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type EnergyServicesListBySubscriptionNextResponse = OepResourceList; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface OpenEnergyPlatformManagementServiceAPIsOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/oep/arm-oep/src/models/mappers.ts b/sdk/oep/arm-oep/src/models/mappers.ts new file mode 100644 index 000000000000..ee96ca1016a3 --- /dev/null +++ b/sdk/oep/arm-oep/src/models/mappers.ts @@ -0,0 +1,380 @@ +/* + * 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 CheckNameAvailabilityRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityRequest", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityResponse", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + readOnly: true, + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + 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 OepResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OepResourceList", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OepResource" + } + } + } + } + } + } +}; + +export const OepProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OepProperties", + modelProperties: { + dnsName: { + serializedName: "dnsName", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + authAppId: { + serializedName: "authAppId", + type: { + name: "String" + } + }, + dataPartitionNames: { + serializedName: "dataPartitionNames", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Item" + } + } + } + } + } + } +}; + +export const Item: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Item", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const TrackedResourceUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResourceUpdate", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const OepResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OepResource", + modelProperties: { + ...Resource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "OepProperties" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const OepPatchResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OepPatchResource", + modelProperties: { + ...TrackedResourceUpdate.type.modelProperties + } + } +}; diff --git a/sdk/oep/arm-oep/src/models/parameters.ts b/sdk/oep/arm-oep/src/models/parameters.ts new file mode 100644 index 000000000000..b53ea7dc6109 --- /dev/null +++ b/sdk/oep/arm-oep/src/models/parameters.ts @@ -0,0 +1,133 @@ +/* + * 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 { + CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper, + OepResource as OepResourceMapper, + OepPatchResource as OepPatchResourceMapper +} from "../models/mappers"; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const body: OperationParameter = { + parameterPath: "body", + mapper: CheckNameAvailabilityRequestMapper +}; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2021-06-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const body1: OperationParameter = { + parameterPath: ["options", "body"], + mapper: OepResourceMapper +}; + +export const body2: OperationParameter = { + parameterPath: ["options", "body"], + mapper: OepPatchResourceMapper +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; diff --git a/sdk/oep/arm-oep/src/openEnergyPlatformManagementServiceAPIs.ts b/sdk/oep/arm-oep/src/openEnergyPlatformManagementServiceAPIs.ts new file mode 100644 index 000000000000..d4e4b2ace21a --- /dev/null +++ b/sdk/oep/arm-oep/src/openEnergyPlatformManagementServiceAPIs.ts @@ -0,0 +1,83 @@ +/* + * 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 { + LocationsImpl, + EnergyServicesImpl, + OperationsImpl +} from "./operations"; +import { Locations, EnergyServices, Operations } from "./operationsInterfaces"; +import { OpenEnergyPlatformManagementServiceAPIsOptionalParams } from "./models"; + +export class OpenEnergyPlatformManagementServiceAPIs extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; + + /** + * Initializes a new instance of the OpenEnergyPlatformManagementServiceAPIs class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: OpenEnergyPlatformManagementServiceAPIsOptionalParams + ) { + 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: OpenEnergyPlatformManagementServiceAPIsOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-oep/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 || "2021-06-01-preview"; + this.locations = new LocationsImpl(this); + this.energyServices = new EnergyServicesImpl(this); + this.operations = new OperationsImpl(this); + } + + locations: Locations; + energyServices: EnergyServices; + operations: Operations; +} diff --git a/sdk/oep/arm-oep/src/operations/energyServices.ts b/sdk/oep/arm-oep/src/operations/energyServices.ts new file mode 100644 index 000000000000..e60d481e4412 --- /dev/null +++ b/sdk/oep/arm-oep/src/operations/energyServices.ts @@ -0,0 +1,564 @@ +/* + * 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 { EnergyServices } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { OpenEnergyPlatformManagementServiceAPIs } from "../openEnergyPlatformManagementServiceAPIs"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + OepResource, + EnergyServicesListByResourceGroupNextOptionalParams, + EnergyServicesListByResourceGroupOptionalParams, + EnergyServicesListBySubscriptionNextOptionalParams, + EnergyServicesListBySubscriptionOptionalParams, + EnergyServicesListByResourceGroupResponse, + EnergyServicesListBySubscriptionResponse, + EnergyServicesGetOptionalParams, + EnergyServicesGetResponse, + EnergyServicesCreateOptionalParams, + EnergyServicesCreateResponse, + EnergyServicesUpdateOptionalParams, + EnergyServicesUpdateResponse, + EnergyServicesDeleteOptionalParams, + EnergyServicesListByResourceGroupNextResponse, + EnergyServicesListBySubscriptionNextResponse +} from "../models"; + +/// +/** Class containing EnergyServices operations. */ +export class EnergyServicesImpl implements EnergyServices { + private readonly client: OpenEnergyPlatformManagementServiceAPIs; + + /** + * Initialize a new instance of the class EnergyServices class. + * @param client Reference to the service client + */ + constructor(client: OpenEnergyPlatformManagementServiceAPIs) { + this.client = client; + } + + /** + * Returns list of oep resources.. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: EnergyServicesListByResourceGroupOptionalParams + ): 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?: EnergyServicesListByResourceGroupOptionalParams + ): 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?: EnergyServicesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * @param options The options parameters. + */ + public listBySubscription( + options?: EnergyServicesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: EnergyServicesListBySubscriptionOptionalParams + ): 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?: EnergyServicesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Returns list of oep resources.. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: EnergyServicesListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * @param options The options parameters. + */ + private _listBySubscription( + options?: EnergyServicesListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * Returns oep resource for a given name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + getOperationSpec + ); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + EnergyServicesCreateResponse + > + > { + 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, resourceName, options }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + resourceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + updateOperationSpec + ); + } + + /** + * Deletes oep resource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesDeleteOptionalParams + ): 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, resourceName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Deletes oep resource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + resourceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: EnergyServicesListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: EnergyServicesListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OepResourceList + }, + default: {} + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/energyServices", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OepResourceList + }, + default: {} + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices/{resourceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OepResource + }, + default: {} + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices/{resourceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.OepResource + }, + 201: { + bodyMapper: Mappers.OepResource + }, + 202: { + bodyMapper: Mappers.OepResource + }, + 204: { + bodyMapper: Mappers.OepResource + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.body1, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices/{resourceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.OepResource + }, + default: {} + }, + requestBody: Parameters.body2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OpenEnergyPlatform/energyServices/{resourceName}", + httpMethod: "DELETE", + responses: { 200: {}, 201: {}, 202: {}, 204: {}, default: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OepResourceList + }, + default: {} + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OepResourceList + }, + default: {} + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/oep/arm-oep/src/operations/index.ts b/sdk/oep/arm-oep/src/operations/index.ts new file mode 100644 index 000000000000..49d8b592415b --- /dev/null +++ b/sdk/oep/arm-oep/src/operations/index.ts @@ -0,0 +1,11 @@ +/* + * 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 "./locations"; +export * from "./energyServices"; +export * from "./operations"; diff --git a/sdk/oep/arm-oep/src/operations/locations.ts b/sdk/oep/arm-oep/src/operations/locations.ts new file mode 100644 index 000000000000..3354d9ff5cb6 --- /dev/null +++ b/sdk/oep/arm-oep/src/operations/locations.ts @@ -0,0 +1,67 @@ +/* + * 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 { Locations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { OpenEnergyPlatformManagementServiceAPIs } from "../openEnergyPlatformManagementServiceAPIs"; +import { + CheckNameAvailabilityRequest, + LocationsCheckNameAvailabilityOptionalParams, + LocationsCheckNameAvailabilityResponse +} from "../models"; + +/** Class containing Locations operations. */ +export class LocationsImpl implements Locations { + private readonly client: OpenEnergyPlatformManagementServiceAPIs; + + /** + * Initialize a new instance of the class Locations class. + * @param client Reference to the service client + */ + constructor(client: OpenEnergyPlatformManagementServiceAPIs) { + this.client = client; + } + + /** + * Checks the name availability of the resource with requested resource name. + * @param body NameAvailabilityRequest object. + * @param options The options parameters. + */ + checkNameAvailability( + body: CheckNameAvailabilityRequest, + options?: LocationsCheckNameAvailabilityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { body, options }, + checkNameAvailabilityOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.OpenEnergyPlatform/checkNameAvailability", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckNameAvailabilityResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.body, + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; diff --git a/sdk/oep/arm-oep/src/operations/operations.ts b/sdk/oep/arm-oep/src/operations/operations.ts new file mode 100644 index 000000000000..0b7b5112b831 --- /dev/null +++ b/sdk/oep/arm-oep/src/operations/operations.ts @@ -0,0 +1,46 @@ +/* + * 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 { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { OpenEnergyPlatformManagementServiceAPIs } from "../openEnergyPlatformManagementServiceAPIs"; +import { OperationsListOptionalParams } from "../models"; + +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: OpenEnergyPlatformManagementServiceAPIs; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: OpenEnergyPlatformManagementServiceAPIs) { + this.client = client; + } + + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * @param options The options parameters. + */ + list(options?: OperationsListOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.OpenEnergyPlatform/operations", + httpMethod: "GET", + responses: { 200: {}, default: {} }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + serializer +}; diff --git a/sdk/oep/arm-oep/src/operationsInterfaces/energyServices.ts b/sdk/oep/arm-oep/src/operationsInterfaces/energyServices.ts new file mode 100644 index 000000000000..a948c0be71e5 --- /dev/null +++ b/sdk/oep/arm-oep/src/operationsInterfaces/energyServices.ts @@ -0,0 +1,113 @@ +/* + * 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 { + OepResource, + EnergyServicesListByResourceGroupOptionalParams, + EnergyServicesListBySubscriptionOptionalParams, + EnergyServicesGetOptionalParams, + EnergyServicesGetResponse, + EnergyServicesCreateOptionalParams, + EnergyServicesCreateResponse, + EnergyServicesUpdateOptionalParams, + EnergyServicesUpdateResponse, + EnergyServicesDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a EnergyServices. */ +export interface EnergyServices { + /** + * Returns list of oep resources.. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: EnergyServicesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Lists a collection of oep resources under the given Azure Subscription ID. + * @param options The options parameters. + */ + listBySubscription( + options?: EnergyServicesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns oep resource for a given name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesGetOptionalParams + ): Promise; + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + EnergyServicesCreateResponse + > + >; + /** + * Method that gets called if subscribed for ResourceCreationBegin trigger. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesCreateOptionalParams + ): Promise; + /** + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesUpdateOptionalParams + ): Promise; + /** + * Deletes oep resource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes oep resource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The resource name. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: EnergyServicesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/oep/arm-oep/src/operationsInterfaces/index.ts b/sdk/oep/arm-oep/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..49d8b592415b --- /dev/null +++ b/sdk/oep/arm-oep/src/operationsInterfaces/index.ts @@ -0,0 +1,11 @@ +/* + * 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 "./locations"; +export * from "./energyServices"; +export * from "./operations"; diff --git a/sdk/oep/arm-oep/src/operationsInterfaces/locations.ts b/sdk/oep/arm-oep/src/operationsInterfaces/locations.ts new file mode 100644 index 000000000000..37298457c7c5 --- /dev/null +++ b/sdk/oep/arm-oep/src/operationsInterfaces/locations.ts @@ -0,0 +1,26 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + CheckNameAvailabilityRequest, + LocationsCheckNameAvailabilityOptionalParams, + LocationsCheckNameAvailabilityResponse +} from "../models"; + +/** Interface representing a Locations. */ +export interface Locations { + /** + * Checks the name availability of the resource with requested resource name. + * @param body NameAvailabilityRequest object. + * @param options The options parameters. + */ + checkNameAvailability( + body: CheckNameAvailabilityRequest, + options?: LocationsCheckNameAvailabilityOptionalParams + ): Promise; +} diff --git a/sdk/oep/arm-oep/src/operationsInterfaces/operations.ts b/sdk/oep/arm-oep/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..6a6b49aae4b9 --- /dev/null +++ b/sdk/oep/arm-oep/src/operationsInterfaces/operations.ts @@ -0,0 +1,18 @@ +/* + * 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 { OperationsListOptionalParams } from "../models"; + +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists the available operations of Microsoft.OpenEnergyPlatform resource provider. + * @param options The options parameters. + */ + list(options?: OperationsListOptionalParams): Promise; +} diff --git a/sdk/oep/arm-oep/test/sampleTest.ts b/sdk/oep/arm-oep/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/oep/arm-oep/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/oep/arm-oep/tsconfig.json b/sdk/oep/arm-oep/tsconfig.json new file mode 100644 index 000000000000..6e3251194117 --- /dev/null +++ b/sdk/oep/arm-oep/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es6", "dom"], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": ["./src/**/*.ts", "./test/**/*.ts"], + "exclude": ["node_modules"] +} diff --git a/sdk/oep/ci.yml b/sdk/oep/ci.yml new file mode 100644 index 000000000000..6a5d381abe2f --- /dev/null +++ b/sdk/oep/ci.yml @@ -0,0 +1,29 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/oep/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/oep/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: oep + Artifacts: + - name: azure-arm-oep + safeName: azurearmoep + \ No newline at end of file