diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 75c010ed6593..776a4e6e4d5e 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -43,6 +43,7 @@ specifiers: '@rush-temp/arm-containerservice': file:./projects/arm-containerservice.tgz '@rush-temp/arm-cosmosdb': file:./projects/arm-cosmosdb.tgz '@rush-temp/arm-customerinsights': file:./projects/arm-customerinsights.tgz + '@rush-temp/arm-dashboard': file:./projects/arm-dashboard.tgz '@rush-temp/arm-databox': file:./projects/arm-databox.tgz '@rush-temp/arm-databoxedge': file:./projects/arm-databoxedge.tgz '@rush-temp/arm-databoxedge-profile-2020-09-01-hybrid': file:./projects/arm-databoxedge-profile-2020-09-01-hybrid.tgz @@ -317,6 +318,7 @@ dependencies: '@rush-temp/arm-containerservice': file:projects/arm-containerservice.tgz '@rush-temp/arm-cosmosdb': file:projects/arm-cosmosdb.tgz '@rush-temp/arm-customerinsights': file:projects/arm-customerinsights.tgz + '@rush-temp/arm-dashboard': file:projects/arm-dashboard.tgz '@rush-temp/arm-databox': file:projects/arm-databox.tgz '@rush-temp/arm-databoxedge': file:projects/arm-databoxedge.tgz '@rush-temp/arm-databoxedge-profile-2020-09-01-hybrid': file:projects/arm-databoxedge-profile-2020-09-01-hybrid.tgz @@ -9994,6 +9996,33 @@ packages: - supports-color dev: false + file:projects/arm-dashboard.tgz: + resolution: {integrity: sha512-jbv1jlBTN5K1myLxib/j5FMNMFvy09ET5u6+bpmn7k/YJzVYTGZpgz6d0W6skPt7AWx5oMUAQWB+17VvghHorw==, tarball: file:projects/arm-dashboard.tgz} + name: '@rush-temp/arm-dashboard' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@azure/identity': 2.0.4 + '@microsoft/api-extractor': 7.20.0 + '@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.3 + transitivePeerDependencies: + - debug + - encoding + - supports-color + dev: false + file:projects/arm-databox.tgz: resolution: {integrity: sha512-xt/1SjsT2CIDzxfmcmO2WnbgXH70/zG3iqB/aN9r31uhW75GEeC4B7x7U/h79V8lZ1BTBs/UnoAOQgn52GCfgA==, tarball: file:projects/arm-databox.tgz} name: '@rush-temp/arm-databox' @@ -16410,7 +16439,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: diff --git a/rush.json b/rush.json index 757c504cb898..e42d9254710b 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-dashboard", + "projectFolder": "sdk/dashboard/arm-dashboard", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/dashboard/arm-dashboard/CHANGELOG.md b/sdk/dashboard/arm-dashboard/CHANGELOG.md new file mode 100644 index 000000000000..d9d069dbb662 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-04-07) + +The package of @azure/arm-dashboard 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/dashboard/arm-dashboard/LICENSE b/sdk/dashboard/arm-dashboard/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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/dashboard/arm-dashboard/README.md b/sdk/dashboard/arm-dashboard/README.md new file mode 100644 index 000000000000..4013d57bff93 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/README.md @@ -0,0 +1,98 @@ +# Azure DashboardManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure DashboardManagement client. + +The Microsoft.Dashboard Rest API spec. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dashboard/arm-dashboard) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-dashboard) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-dashboard?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-dashboard` package + +Install the Azure DashboardManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-dashboard +``` + +### Create and authenticate a `DashboardManagementClient` + +To create a client object to access the Azure DashboardManagement API, you will need the `endpoint` of your Azure DashboardManagement resource and a `credential`. The Azure DashboardManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure DashboardManagement 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 DashboardManagement** 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 { DashboardManagementClient } = require("@azure/arm-dashboard"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new DashboardManagementClient(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 + +### DashboardManagementClient + +`DashboardManagementClient` is the primary interface for developers using the Azure DashboardManagement client library. Explore the methods on this client object to understand the different features of the Azure DashboardManagement 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%2Fdashboard%2Farm-dashboard%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/dashboard/arm-dashboard/_meta.json b/sdk/dashboard/arm-dashboard/_meta.json new file mode 100644 index 000000000000..0928082f19ef --- /dev/null +++ b/sdk/dashboard/arm-dashboard/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "61966ad2e2968df8fbf4d321a7b4f29d66e85e74", + "readme": "specification/dashboard/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/dashboard/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/dashboard/arm-dashboard/api-extractor.json b/sdk/dashboard/arm-dashboard/api-extractor.json new file mode 100644 index 000000000000..a6579dedac02 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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-dashboard.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/dashboard/arm-dashboard/package.json b/sdk/dashboard/arm-dashboard/package.json new file mode 100644 index 000000000000..e9758139eeff --- /dev/null +++ b/sdk/dashboard/arm-dashboard/package.json @@ -0,0 +1,102 @@ +{ + "name": "@azure/arm-dashboard", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for DashboardManagementClient.", + "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-dashboard.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/dashboard/arm-dashboard", + "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/dashboard/arm-dashboard/review/arm-dashboard.api.md b/sdk/dashboard/arm-dashboard/review/arm-dashboard.api.md new file mode 100644 index 000000000000..a5a0c261a458 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/review/arm-dashboard.api.md @@ -0,0 +1,354 @@ +## API Report File for "@azure/arm-dashboard" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export type ActionType = string; + +// @public +export type AutoGeneratedDomainNameLabelScope = string; + +// @public +export type CreatedByType = string; + +// @public (undocumented) +export class DashboardManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, $host: string, subscriptionId: string, options?: DashboardManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + grafana: Grafana; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface DashboardManagementClientOptionalParams extends coreClient.ServiceClientOptions { + apiVersion?: string; + endpoint?: 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 interface Grafana { + beginCreate(resourceGroupName: string, workspaceName: string, requestBodyParameters: ManagedGrafana, options?: GrafanaCreateOptionalParams): Promise, GrafanaCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, workspaceName: string, requestBodyParameters: ManagedGrafana, options?: GrafanaCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, workspaceName: string, options?: GrafanaDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, workspaceName: string, options?: GrafanaDeleteOptionalParams): Promise; + get(resourceGroupName: string, workspaceName: string, options?: GrafanaGetOptionalParams): Promise; + list(options?: GrafanaListOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: GrafanaListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, workspaceName: string, requestBodyParameters: ManagedGrafanaUpdateParameters, options?: GrafanaUpdateOptionalParams): Promise; +} + +// @public +export interface GrafanaCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type GrafanaCreateResponse = ManagedGrafana; + +// @public +export interface GrafanaDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface GrafanaGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GrafanaGetResponse = ManagedGrafana; + +// @public +export interface GrafanaListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GrafanaListByResourceGroupNextResponse = ManagedGrafanaListResponse; + +// @public +export interface GrafanaListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GrafanaListByResourceGroupResponse = ManagedGrafanaListResponse; + +// @public +export interface GrafanaListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GrafanaListNextResponse = ManagedGrafanaListResponse; + +// @public +export interface GrafanaListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GrafanaListResponse = ManagedGrafanaListResponse; + +// @public +export interface GrafanaUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GrafanaUpdateResponse = ManagedGrafana; + +// @public +export type IdentityType = string; + +// @public +export enum KnownActionType { + // (undocumented) + Internal = "Internal" +} + +// @public +export enum KnownAutoGeneratedDomainNameLabelScope { + // (undocumented) + TenantReuse = "TenantReuse" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned" +} + +// @public +export enum KnownLastModifiedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownOrigin { + // (undocumented) + System = "system", + // (undocumented) + User = "user", + // (undocumented) + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Accepted = "Accepted", + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + NotSpecified = "NotSpecified", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownZoneRedundancy { + // (undocumented) + Disabled = "Disabled", + // (undocumented) + Enabled = "Enabled" +} + +// @public +export type LastModifiedByType = string; + +// @public +export interface ManagedGrafana { + readonly id?: string; + identity?: ManagedIdentity; + location?: string; + readonly name?: string; + properties?: ManagedGrafanaProperties; + sku?: ResourceSku; + readonly systemData?: SystemData; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + +// @public (undocumented) +export interface ManagedGrafanaListResponse { + // (undocumented) + nextLink?: string; + // (undocumented) + value?: ManagedGrafana[]; +} + +// @public +export interface ManagedGrafanaProperties { + // (undocumented) + autoGeneratedDomainNameLabelScope?: AutoGeneratedDomainNameLabelScope; + readonly endpoint?: string; + readonly grafanaVersion?: string; + provisioningState?: ProvisioningState; + // (undocumented) + zoneRedundancy?: ZoneRedundancy; +} + +// @public +export interface ManagedGrafanaUpdateParameters { + identity?: ManagedIdentity; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface ManagedIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: IdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentity; + }; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationListResult { + readonly nextLink?: string; + readonly value?: OperationResult[]; +} + +// @public +export interface OperationResult { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export type Origin = string; + +// @public +export type ProvisioningState = string; + +// @public (undocumented) +export interface ResourceSku { + // (undocumented) + name: string; +} + +// @public (undocumented) +export interface SystemData { + // (undocumented) + createdAt?: Date; + // (undocumented) + createdBy?: string; + createdByType?: CreatedByType; + // (undocumented) + lastModifiedAt?: Date; + // (undocumented) + lastModifiedBy?: string; + // (undocumented) + lastModifiedByType?: LastModifiedByType; +} + +// @public (undocumented) +export interface UserAssignedIdentity { + readonly clientId?: string; + readonly principalId?: string; +} + +// @public +export type ZoneRedundancy = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/dashboard/arm-dashboard/rollup.config.js b/sdk/dashboard/arm-dashboard/rollup.config.js new file mode 100644 index 000000000000..9be1955eb7f1 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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/dashboard/arm-dashboard/src/dashboardManagementClient.ts b/sdk/dashboard/arm-dashboard/src/dashboardManagementClient.ts new file mode 100644 index 000000000000..721ed962f3db --- /dev/null +++ b/sdk/dashboard/arm-dashboard/src/dashboardManagementClient.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 { OperationsImpl, GrafanaImpl } from "./operations"; +import { Operations, Grafana } from "./operationsInterfaces"; +import { DashboardManagementClientOptionalParams } from "./models"; + +export class DashboardManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the DashboardManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param $host server parameter + * @param subscriptionId Gets subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription ID forms part of the URI for every service call. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + $host: string, + subscriptionId: string, + options?: DashboardManagementClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if ($host === undefined) { + throw new Error("'$host' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: DashboardManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-dashboard/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 || "{$host}" + }; + super(optionsWithDefaults); + // Parameter assignments + this.$host = $host; + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.apiVersion = options.apiVersion || "2021-09-01-preview"; + this.operations = new OperationsImpl(this); + this.grafana = new GrafanaImpl(this); + } + + operations: Operations; + grafana: Grafana; +} diff --git a/sdk/dashboard/arm-dashboard/src/index.ts b/sdk/dashboard/arm-dashboard/src/index.ts new file mode 100644 index 000000000000..13dd5fefca97 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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 { DashboardManagementClient } from "./dashboardManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/dashboard/arm-dashboard/src/lroImpl.ts b/sdk/dashboard/arm-dashboard/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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/dashboard/arm-dashboard/src/models/index.ts b/sdk/dashboard/arm-dashboard/src/models/index.ts new file mode 100644 index 000000000000..58d8a4712016 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/src/models/index.ts @@ -0,0 +1,465 @@ +/* + * 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"; + +/** A list of REST API operations supported by Microsoft.Dashboard provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** + * List of operations supported by the Microsoft.Dashboard provider. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: OperationResult[]; + /** + * URL to get the next set of operation list results if there are any. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** A Microsoft.Dashboard REST API operation. */ +export interface OperationResult { + /** + * Operation name, i.e., {provider}/{resource}/{operation}. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Indicates whether the operation applies to data-plane. Set "true" for data-plane operations and "false" for ARM/control-plane operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** + * The intended executor of the operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: Origin; + /** + * Indicates the action type. "Internal" refers to actions that are for internal only APIs. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionType?: ActionType; +} + +/** Localized display information for this particular operation. */ +export interface OperationDisplay { + /** + * The localized friendly form of the resource provider name, i.e., Microsoft.Dashboard. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * The localized friendly name of the resource type related to this operation, e.g., 'grafana'. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * Operation type, e.g., read, write, delete, etc. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * Description of the operation, e.g., 'Read grafana'. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: 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; +} + +export interface ManagedGrafanaListResponse { + value?: ManagedGrafana[]; + nextLink?: string; +} + +/** The grafana resource type. */ +export interface ManagedGrafana { + /** + * ARM id of the grafana resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Name of the grafana resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the grafana resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** The Sku of the grafana resource. */ + sku?: ResourceSku; + /** Properties specific to the grafana resource. */ + properties?: ManagedGrafanaProperties; + /** The managed identity of the grafana resource. */ + identity?: ManagedIdentity; + /** + * The system meta data relating to this grafana resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** The tags for grafana resource. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the grafana resource lives */ + location?: string; +} + +export interface ResourceSku { + name: string; +} + +/** Properties specific to the grafana resource. */ +export interface ManagedGrafanaProperties { + /** Provisioning state of the resource. */ + provisioningState?: ProvisioningState; + /** + * The Grafana software version. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly grafanaVersion?: string; + /** + * The endpoint of the Grafana instance. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly endpoint?: string; + zoneRedundancy?: ZoneRedundancy; + autoGeneratedDomainNameLabelScope?: AutoGeneratedDomainNameLabelScope; +} + +/** The managed identity of a resource. */ +export interface ManagedIdentity { + /** The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the resource. */ + type?: IdentityType; + /** + * The principal id of the system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant id of the system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** Dictionary of user assigned identities. */ + userAssignedIdentities?: { [propertyName: string]: UserAssignedIdentity }; +} + +export interface UserAssignedIdentity { + /** + * The principal id of user assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The client id of user assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + +export interface SystemData { + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + createdAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: LastModifiedByType; + lastModifiedAt?: Date; +} + +/** The parameters for a PATCH request to a grafana resource. */ +export interface ManagedGrafanaUpdateParameters { + /** The managed identity of the grafana resource. */ + identity?: ManagedIdentity; + /** The new tags of the grafana resource. */ + tags?: { [propertyName: string]: string }; +} + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + User = "user", + System = "system", + UserSystem = "user,system" +} + +/** + * Defines values for Origin. \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user** \ + * **system** \ + * **user,system** + */ +export type Origin = string; + +/** Known values of {@link ActionType} that the service accepts. */ +export enum KnownActionType { + Internal = "Internal" +} + +/** + * Defines values for ActionType. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal** + */ +export type ActionType = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Accepted = "Accepted", + Creating = "Creating", + Updating = "Updating", + Deleting = "Deleting", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Deleted = "Deleted", + NotSpecified = "NotSpecified" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted** \ + * **Creating** \ + * **Updating** \ + * **Deleting** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Deleted** \ + * **NotSpecified** + */ +export type ProvisioningState = string; + +/** Known values of {@link ZoneRedundancy} that the service accepts. */ +export enum KnownZoneRedundancy { + Disabled = "Disabled", + Enabled = "Enabled" +} + +/** + * Defines values for ZoneRedundancy. \ + * {@link KnownZoneRedundancy} can be used interchangeably with ZoneRedundancy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Disabled** \ + * **Enabled** + */ +export type ZoneRedundancy = string; + +/** Known values of {@link AutoGeneratedDomainNameLabelScope} that the service accepts. */ +export enum KnownAutoGeneratedDomainNameLabelScope { + TenantReuse = "TenantReuse" +} + +/** + * Defines values for AutoGeneratedDomainNameLabelScope. \ + * {@link KnownAutoGeneratedDomainNameLabelScope} can be used interchangeably with AutoGeneratedDomainNameLabelScope, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **TenantReuse** + */ +export type AutoGeneratedDomainNameLabelScope = string; + +/** Known values of {@link IdentityType} that the service accepts. */ +export enum KnownIdentityType { + None = "None", + SystemAssigned = "SystemAssigned" +} + +/** + * Defines values for IdentityType. \ + * {@link KnownIdentityType} can be used interchangeably with IdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** + */ +export type IdentityType = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link LastModifiedByType} that the service accepts. */ +export enum KnownLastModifiedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for LastModifiedByType. \ + * {@link KnownLastModifiedByType} can be used interchangeably with LastModifiedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type LastModifiedByType = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface GrafanaListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type GrafanaListResponse = ManagedGrafanaListResponse; + +/** Optional parameters. */ +export interface GrafanaListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type GrafanaListByResourceGroupResponse = ManagedGrafanaListResponse; + +/** Optional parameters. */ +export interface GrafanaGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type GrafanaGetResponse = ManagedGrafana; + +/** Optional parameters. */ +export interface GrafanaCreateOptionalParams + 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 create operation. */ +export type GrafanaCreateResponse = ManagedGrafana; + +/** Optional parameters. */ +export interface GrafanaUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type GrafanaUpdateResponse = ManagedGrafana; + +/** Optional parameters. */ +export interface GrafanaDeleteOptionalParams + 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 GrafanaListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type GrafanaListNextResponse = ManagedGrafanaListResponse; + +/** Optional parameters. */ +export interface GrafanaListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type GrafanaListByResourceGroupNextResponse = ManagedGrafanaListResponse; + +/** Optional parameters. */ +export interface DashboardManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/dashboard/arm-dashboard/src/models/mappers.ts b/sdk/dashboard/arm-dashboard/src/models/mappers.ts new file mode 100644 index 000000000000..189c69290140 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/src/models/mappers.ts @@ -0,0 +1,500 @@ +/* + * 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 OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResult" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResult", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + readOnly: true, + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + readOnly: true, + type: { + name: "String" + } + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + readOnly: true, + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + readOnly: true, + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + readOnly: true, + type: { + name: "String" + } + }, + description: { + serializedName: "description", + 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 ManagedGrafanaListResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedGrafanaListResponse", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ManagedGrafana" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedGrafana: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedGrafana", + 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" + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "ResourceSku" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ManagedGrafanaProperties" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedIdentity" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceSku: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceSku", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ManagedGrafanaProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedGrafanaProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + }, + grafanaVersion: { + serializedName: "grafanaVersion", + readOnly: true, + type: { + name: "String" + } + }, + endpoint: { + serializedName: "endpoint", + readOnly: true, + type: { + name: "String" + } + }, + zoneRedundancy: { + defaultValue: "Disabled", + serializedName: "zoneRedundancy", + type: { + name: "String" + } + }, + autoGeneratedDomainNameLabelScope: { + serializedName: "autoGeneratedDomainNameLabelScope", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedIdentity", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "String" + } + }, + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { name: "Composite", className: "UserAssignedIdentity" } + } + } + } + } + } +}; + +export const UserAssignedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + 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 ManagedGrafanaUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedGrafanaUpdateParameters", + modelProperties: { + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedIdentity" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; diff --git a/sdk/dashboard/arm-dashboard/src/models/parameters.ts b/sdk/dashboard/arm-dashboard/src/models/parameters.ts new file mode 100644 index 000000000000..be12e39b54dd --- /dev/null +++ b/sdk/dashboard/arm-dashboard/src/models/parameters.ts @@ -0,0 +1,126 @@ +/* + * 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 { + ManagedGrafana as ManagedGrafanaMapper, + ManagedGrafanaUpdateParameters as ManagedGrafanaUpdateParametersMapper +} 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 apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2021-09-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + 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: { + MinLength: 1 + }, + serializedName: "resourceGroupName", + 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 requestBodyParameters: OperationParameter = { + parameterPath: "requestBodyParameters", + mapper: ManagedGrafanaMapper +}; + +export const requestBodyParameters1: OperationParameter = { + parameterPath: "requestBodyParameters", + mapper: ManagedGrafanaUpdateParametersMapper +}; diff --git a/sdk/dashboard/arm-dashboard/src/operations/grafana.ts b/sdk/dashboard/arm-dashboard/src/operations/grafana.ts new file mode 100644 index 000000000000..8f02fd98a58a --- /dev/null +++ b/sdk/dashboard/arm-dashboard/src/operations/grafana.ts @@ -0,0 +1,591 @@ +/* + * 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 { Grafana } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { DashboardManagementClient } from "../dashboardManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ManagedGrafana, + GrafanaListNextOptionalParams, + GrafanaListOptionalParams, + GrafanaListByResourceGroupNextOptionalParams, + GrafanaListByResourceGroupOptionalParams, + GrafanaListResponse, + GrafanaListByResourceGroupResponse, + GrafanaGetOptionalParams, + GrafanaGetResponse, + GrafanaCreateOptionalParams, + GrafanaCreateResponse, + ManagedGrafanaUpdateParameters, + GrafanaUpdateOptionalParams, + GrafanaUpdateResponse, + GrafanaDeleteOptionalParams, + GrafanaListNextResponse, + GrafanaListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing Grafana operations. */ +export class GrafanaImpl implements Grafana { + private readonly client: DashboardManagementClient; + + /** + * Initialize a new instance of the class Grafana class. + * @param client Reference to the service client + */ + constructor(client: DashboardManagementClient) { + this.client = client; + } + + /** + * List all resources of workspaces for Grafana under the specified subscription. + * @param options The options parameters. + */ + public list( + options?: GrafanaListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: GrafanaListOptionalParams + ): 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?: GrafanaListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List all resources of workspaces for Grafana under the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: GrafanaListByResourceGroupOptionalParams + ): 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?: GrafanaListByResourceGroupOptionalParams + ): 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?: GrafanaListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * List all resources of workspaces for Grafana under the specified subscription. + * @param options The options parameters. + */ + private _list( + options?: GrafanaListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * List all resources of workspaces for Grafana under the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: GrafanaListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Get the properties of a specific workspace for Grafana resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + options?: GrafanaGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, options }, + getOperationSpec + ); + } + + /** + * Create or update a workspace for Grafana resource. This API is idempotent, so user can either create + * a new grafana or update an existing grafana. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param requestBodyParameters The grafana resource type. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + workspaceName: string, + requestBodyParameters: ManagedGrafana, + options?: GrafanaCreateOptionalParams + ): Promise< + PollerLike, GrafanaCreateResponse> + > { + 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, requestBodyParameters, options }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Create or update a workspace for Grafana resource. This API is idempotent, so user can either create + * a new grafana or update an existing grafana. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param requestBodyParameters The grafana resource type. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + workspaceName: string, + requestBodyParameters: ManagedGrafana, + options?: GrafanaCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + workspaceName, + requestBodyParameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update a workspace for Grafana resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param requestBodyParameters The parameters for a PATCH request to a grafana resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + workspaceName: string, + requestBodyParameters: ManagedGrafanaUpdateParameters, + options?: GrafanaUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, requestBodyParameters, options }, + updateOperationSpec + ); + } + + /** + * Delete a workspace for Grafana resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + workspaceName: string, + options?: GrafanaDeleteOptionalParams + ): 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, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Delete a workspace for Grafana resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + workspaceName: string, + options?: GrafanaDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + workspaceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: GrafanaListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } + + /** + * 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?: GrafanaListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedGrafanaListResponse + }, + 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.Dashboard/grafana", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedGrafanaListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedGrafana + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ManagedGrafana + }, + 201: { + bodyMapper: Mappers.ManagedGrafana + }, + 202: { + bodyMapper: Mappers.ManagedGrafana + }, + 204: { + bodyMapper: Mappers.ManagedGrafana + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.requestBodyParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ManagedGrafana + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.requestBodyParameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedGrafanaListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ManagedGrafanaListResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dashboard/arm-dashboard/src/operations/index.ts b/sdk/dashboard/arm-dashboard/src/operations/index.ts new file mode 100644 index 000000000000..252ad2d099b5 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/src/operations/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./grafana"; diff --git a/sdk/dashboard/arm-dashboard/src/operations/operations.ts b/sdk/dashboard/arm-dashboard/src/operations/operations.ts new file mode 100644 index 000000000000..7eb9d26e05b4 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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 { DashboardManagementClient } from "../dashboardManagementClient"; +import { + OperationResult, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: DashboardManagementClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: DashboardManagementClient) { + this.client = client; + } + + /** + * List all available API operations provided by Microsoft.Dashboard. + * @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; + } + } + + /** + * List all available API operations provided by Microsoft.Dashboard. + * @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.Dashboard/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + 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.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/dashboard/arm-dashboard/src/operationsInterfaces/grafana.ts b/sdk/dashboard/arm-dashboard/src/operationsInterfaces/grafana.ts new file mode 100644 index 000000000000..51f8e7ff81e9 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/src/operationsInterfaces/grafana.ts @@ -0,0 +1,120 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ManagedGrafana, + GrafanaListOptionalParams, + GrafanaListByResourceGroupOptionalParams, + GrafanaGetOptionalParams, + GrafanaGetResponse, + GrafanaCreateOptionalParams, + GrafanaCreateResponse, + ManagedGrafanaUpdateParameters, + GrafanaUpdateOptionalParams, + GrafanaUpdateResponse, + GrafanaDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a Grafana. */ +export interface Grafana { + /** + * List all resources of workspaces for Grafana under the specified subscription. + * @param options The options parameters. + */ + list( + options?: GrafanaListOptionalParams + ): PagedAsyncIterableIterator; + /** + * List all resources of workspaces for Grafana under the specified resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: GrafanaListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the properties of a specific workspace for Grafana resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + options?: GrafanaGetOptionalParams + ): Promise; + /** + * Create or update a workspace for Grafana resource. This API is idempotent, so user can either create + * a new grafana or update an existing grafana. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param requestBodyParameters The grafana resource type. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + workspaceName: string, + requestBodyParameters: ManagedGrafana, + options?: GrafanaCreateOptionalParams + ): Promise< + PollerLike, GrafanaCreateResponse> + >; + /** + * Create or update a workspace for Grafana resource. This API is idempotent, so user can either create + * a new grafana or update an existing grafana. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param requestBodyParameters The grafana resource type. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + workspaceName: string, + requestBodyParameters: ManagedGrafana, + options?: GrafanaCreateOptionalParams + ): Promise; + /** + * Update a workspace for Grafana resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param requestBodyParameters The parameters for a PATCH request to a grafana resource. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + workspaceName: string, + requestBodyParameters: ManagedGrafanaUpdateParameters, + options?: GrafanaUpdateOptionalParams + ): Promise; + /** + * Delete a workspace for Grafana resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + workspaceName: string, + options?: GrafanaDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a workspace for Grafana resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The workspace name of Azure Managed Grafana. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + workspaceName: string, + options?: GrafanaDeleteOptionalParams + ): Promise; +} diff --git a/sdk/dashboard/arm-dashboard/src/operationsInterfaces/index.ts b/sdk/dashboard/arm-dashboard/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..252ad2d099b5 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/src/operationsInterfaces/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./grafana"; diff --git a/sdk/dashboard/arm-dashboard/src/operationsInterfaces/operations.ts b/sdk/dashboard/arm-dashboard/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..9537ad805ba5 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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 { OperationResult, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List all available API operations provided by Microsoft.Dashboard. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/dashboard/arm-dashboard/test/sampleTest.ts b/sdk/dashboard/arm-dashboard/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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/dashboard/arm-dashboard/tsconfig.json b/sdk/dashboard/arm-dashboard/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/dashboard/arm-dashboard/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/dashboard/ci.mgmt.yml b/sdk/dashboard/ci.mgmt.yml new file mode 100644 index 000000000000..c498302c4451 --- /dev/null +++ b/sdk/dashboard/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/dashboard/arm-dashboard + - sdk/dashboard/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/dashboard/arm-dashboard + - sdk/dashboard/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dashboard + Artifacts: + - name: azure-arm-dashboard + safeName: azurearmdashboard + \ No newline at end of file