diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 4f9b3ad7bf35..9a94c5997753 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -164,6 +164,9 @@ dependencies: '@rush-temp/arm-communication': specifier: file:./projects/arm-communication.tgz version: file:projects/arm-communication.tgz + '@rush-temp/arm-communitytraining': + specifier: file:./projects/arm-communitytraining.tgz + version: file:projects/arm-communitytraining.tgz '@rush-temp/arm-compute': specifier: file:./projects/arm-compute.tgz version: file:projects/arm-compute.tgz @@ -11356,6 +11359,33 @@ packages: - supports-color dev: false + file:projects/arm-communitytraining.tgz: + resolution: {integrity: sha512-5xjJGqRouZUFo0AOUvdMuXLEBM/U4cZGXR0WsklXu9yi8yBmeoqwvVempbjvEVjgSVNmIS03NuSv/qXsOdKmzQ==, tarball: file:projects/arm-communitytraining.tgz} + name: '@rush-temp/arm-communitytraining' + version: 0.0.0 + dependencies: + '@azure/identity': 3.4.1 + '@microsoft/api-extractor': 7.38.3(@types/node@18.18.12) + '@types/chai': 4.3.11 + '@types/mocha': 10.0.6 + '@types/node': 18.18.12 + chai: 4.3.10 + cross-env: 7.0.3 + dotenv: 16.3.1 + esm: 3.2.25 + mkdirp: 2.1.6 + mocha: 10.2.0 + rimraf: 5.0.5 + ts-node: 10.9.1(@types/node@18.18.12)(typescript@5.2.2) + tslib: 2.6.2 + typescript: 5.2.2 + uglify-js: 3.17.4 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/arm-compute-1.tgz: resolution: {integrity: sha512-GNH6eYlcbf2q/gL3gSeFIrGTeu55MJKUeTHcFvtpwckRU5Gl7M+amBD/C3WcgxE9eiMwGdSh7fnY2u9I3kN1Cg==, tarball: file:projects/arm-compute-1.tgz} name: '@rush-temp/arm-compute-1' diff --git a/rush.json b/rush.json index 2a4815a0bbb3..1f540afae65d 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. @@ -2150,6 +2150,11 @@ "packageName": "@azure/arm-playwrighttesting", "projectFolder": "sdk/playwrighttesting/arm-playwrighttesting", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-communitytraining", + "projectFolder": "sdk/communitytraining/arm-communitytraining", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/communitytraining/arm-communitytraining/CHANGELOG.md b/sdk/communitytraining/arm-communitytraining/CHANGELOG.md new file mode 100644 index 000000000000..9e0c03413e55 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2023-11-24) + +The package of @azure/arm-communitytraining 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/communitytraining/arm-communitytraining/LICENSE b/sdk/communitytraining/arm-communitytraining/LICENSE new file mode 100644 index 000000000000..3a1d9b6f24f7 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 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/communitytraining/arm-communitytraining/README.md b/sdk/communitytraining/arm-communitytraining/README.md new file mode 100644 index 000000000000..2c2e0b15e5a2 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/README.md @@ -0,0 +1,109 @@ +# Azure MicrosoftCommunity client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MicrosoftCommunity client. + + + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communitytraining/arm-communitytraining) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-communitytraining) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-communitytraining) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-communitytraining` package + +Install the Azure MicrosoftCommunity client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-communitytraining +``` + +### Create and authenticate a `MicrosoftCommunity` + +To create a client object to access the Azure MicrosoftCommunity API, you will need the `endpoint` of your Azure MicrosoftCommunity resource and a `credential`. The Azure MicrosoftCommunity client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure MicrosoftCommunity 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 MicrosoftCommunity** 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 { MicrosoftCommunity } = require("@azure/arm-communitytraining"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new MicrosoftCommunity(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new MicrosoftCommunity(credential, 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 + +### MicrosoftCommunity + +`MicrosoftCommunity` is the primary interface for developers using the Azure MicrosoftCommunity client library. Explore the methods on this client object to understand the different features of the Azure MicrosoftCommunity 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%2Fcommunitytraining%2Farm-communitytraining%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/communitytraining/arm-communitytraining/_meta.json b/sdk/communitytraining/arm-communitytraining/_meta.json new file mode 100644 index 000000000000..1698c8d13c80 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "fbe4398ae86a84231e7b9bc5026c393975883d34", + "readme": "specification/communitytraining/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/communitytraining/resource-manager/readme.md --use=@autorest/typescript@^6.0.12", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.4", + "use": "@autorest/typescript@^6.0.12" +} \ No newline at end of file diff --git a/sdk/communitytraining/arm-communitytraining/api-extractor.json b/sdk/communitytraining/arm-communitytraining/api-extractor.json new file mode 100644 index 000000000000..ceb7ad0b9533 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/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-communitytraining.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/communitytraining/arm-communitytraining/package.json b/sdk/communitytraining/arm-communitytraining/package.json new file mode 100644 index 000000000000..777a1ff9749c --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/package.json @@ -0,0 +1,111 @@ +{ + "name": "@azure/arm-communitytraining", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for MicrosoftCommunity.", + "version": "1.0.0", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.5.4", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.12.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-communitytraining.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "^7.31.1", + "mkdirp": "^2.1.2", + "typescript": "~5.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^5.0.0", + "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/identity": "^3.3.0", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "esm": "^3.2.18", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^18.0.0", + "ts-node": "^10.0.0" + }, + "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", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && dev-tool run bundle && 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 --glob 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": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/microsoftCommunity.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communitytraining/arm-communitytraining" +} \ No newline at end of file diff --git a/sdk/communitytraining/arm-communitytraining/review/arm-communitytraining.api.md b/sdk/communitytraining/arm-communitytraining/review/arm-communitytraining.api.md new file mode 100644 index 000000000000..fee90e4af81a --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/review/arm-communitytraining.api.md @@ -0,0 +1,326 @@ +## API Report File for "@azure/arm-communitytraining" + +> 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 { OperationState } from '@azure/core-lro'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { SimplePollerLike } from '@azure/core-lro'; + +// @public +export type ActionType = string; + +// @public +export interface CommunityTraining extends TrackedResource { + disasterRecoveryEnabled?: boolean; + identityConfiguration?: IdentityConfigurationProperties; + portalAdminEmailAddress?: string; + portalName?: string; + portalOwnerEmailAddress?: string; + portalOwnerOrganizationName?: string; + readonly provisioningState?: ProvisioningState; + sku?: Sku; + zoneRedundancyEnabled?: boolean; +} + +// @public +export interface CommunityTrainingListResult { + nextLink?: string; + value: CommunityTraining[]; +} + +// @public +export interface CommunityTrainings { + beginCreate(resourceGroupName: string, communityTrainingName: string, resource: CommunityTraining, options?: CommunityTrainingsCreateOptionalParams): Promise, CommunityTrainingsCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, communityTrainingName: string, resource: CommunityTraining, options?: CommunityTrainingsCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, communityTrainingName: string, options?: CommunityTrainingsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, communityTrainingName: string, options?: CommunityTrainingsDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, communityTrainingName: string, properties: CommunityTrainingUpdate, options?: CommunityTrainingsUpdateOptionalParams): Promise, CommunityTrainingsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, communityTrainingName: string, properties: CommunityTrainingUpdate, options?: CommunityTrainingsUpdateOptionalParams): Promise; + get(resourceGroupName: string, communityTrainingName: string, options?: CommunityTrainingsGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: CommunityTrainingsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: CommunityTrainingsListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface CommunityTrainingsCreateHeaders { + retryAfter?: number; +} + +// @public +export interface CommunityTrainingsCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CommunityTrainingsCreateResponse = CommunityTraining; + +// @public +export interface CommunityTrainingsDeleteHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface CommunityTrainingsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CommunityTrainingsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CommunityTrainingsGetResponse = CommunityTraining; + +// @public +export interface CommunityTrainingsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CommunityTrainingsListByResourceGroupNextResponse = CommunityTrainingListResult; + +// @public +export interface CommunityTrainingsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CommunityTrainingsListByResourceGroupResponse = CommunityTrainingListResult; + +// @public +export interface CommunityTrainingsListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CommunityTrainingsListBySubscriptionNextResponse = CommunityTrainingListResult; + +// @public +export interface CommunityTrainingsListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CommunityTrainingsListBySubscriptionResponse = CommunityTrainingListResult; + +// @public +export interface CommunityTrainingsUpdateHeaders { + location?: string; + retryAfter?: number; +} + +// @public +export interface CommunityTrainingsUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CommunityTrainingsUpdateResponse = CommunityTraining; + +// @public +export interface CommunityTrainingUpdate { + identityConfiguration?: IdentityConfigurationPropertiesUpdate; + sku?: Sku; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export function getContinuationToken(page: unknown): string | undefined; + +// @public +export interface IdentityConfigurationProperties { + b2CAuthenticationPolicy?: string; + b2CPasswordResetPolicy?: string; + clientId: string; + clientSecret: string; + customLoginParameters?: string; + domainName: string; + identityType: string; + teamsEnabled?: boolean; + tenantId: string; +} + +// @public +export interface IdentityConfigurationPropertiesUpdate { + b2CAuthenticationPolicy?: string; + b2CPasswordResetPolicy?: string; + clientId?: string; + clientSecret?: string; + customLoginParameters?: string; + domainName?: string; + identityType?: string; + teamsEnabled?: boolean; + tenantId?: string; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownOrigin { + System = "system", + User = "user", + UserSystem = "user,system" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Deleting = "Deleting", + Failed = "Failed", + Provisioning = "Provisioning", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public (undocumented) +export class MicrosoftCommunity extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MicrosoftCommunityOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + communityTrainings: CommunityTrainings; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface MicrosoftCommunityOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @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?: Operation[]; +} + +// @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 +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface Sku { + capacity?: number; + family?: string; + name: string; + size?: string; + tier?: SkuTier; +} + +// @public +export type SkuTier = "Free" | "Basic" | "Standard" | "Premium"; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: { + [propertyName: string]: string; + }; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/communitytraining/arm-communitytraining/sample.env b/sdk/communitytraining/arm-communitytraining/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/communitytraining/arm-communitytraining/src/index.ts b/sdk/communitytraining/arm-communitytraining/src/index.ts new file mode 100644 index 000000000000..b5a0e425e704 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/index.ts @@ -0,0 +1,13 @@ +/* + * 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 { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { MicrosoftCommunity } from "./microsoftCommunity"; +export * from "./operationsInterfaces"; diff --git a/sdk/communitytraining/arm-communitytraining/src/lroImpl.ts b/sdk/communitytraining/arm-communitytraining/src/lroImpl.ts new file mode 100644 index 000000000000..dd803cd5e28c --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/lroImpl.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; +} diff --git a/sdk/communitytraining/arm-communitytraining/src/microsoftCommunity.ts b/sdk/communitytraining/arm-communitytraining/src/microsoftCommunity.ts new file mode 100644 index 000000000000..b9f4b11997a9 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/microsoftCommunity.ts @@ -0,0 +1,142 @@ +/* + * 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 coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { OperationsImpl, CommunityTrainingsImpl } from "./operations"; +import { Operations, CommunityTrainings } from "./operationsInterfaces"; +import { MicrosoftCommunityOptionalParams } from "./models"; + +export class MicrosoftCommunity extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the MicrosoftCommunity class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: MicrosoftCommunityOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: MicrosoftCommunityOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-communitytraining/1.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2023-11-01"; + this.operations = new OperationsImpl(this); + this.communityTrainings = new CommunityTrainingsImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + communityTrainings: CommunityTrainings; +} diff --git a/sdk/communitytraining/arm-communitytraining/src/models/index.ts b/sdk/communitytraining/arm-communitytraining/src/models/index.ts new file mode 100644 index 000000000000..86201d9af1c9 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/models/index.ts @@ -0,0 +1,487 @@ +/* + * 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 an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface OperationListResult { + /** + * List of operations supported by the resource provider + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Operation[]; + /** + * 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; +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Whether the operation applies to data-plane. This is "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; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: Origin; + /** + * Enum. 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, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + * 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. "Virtual Machines" or "Job Schedule Collections". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + * 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; +} + +/** The response of a CommunityTraining list operation. */ +export interface CommunityTrainingListResult { + /** The CommunityTraining items on this page */ + value: CommunityTraining[]; + /** The link to the next page of items */ + nextLink?: string; +} + +/** Details of the Community CommunityTraining Identity Configuration */ +export interface IdentityConfigurationProperties { + /** The identity type of the Community Training Resource */ + identityType: string; + /** To indicate whether the Community Training Resource has Teams enabled */ + teamsEnabled?: boolean; + /** The tenantId of the selected identity provider for the Community Training Resource */ + tenantId: string; + /** The domain name of the selected identity provider for the Community Training Resource */ + domainName: string; + /** The clientId of the application registered in the selected identity provider for the Community Training Resource */ + clientId: string; + /** + * The client secret of the application registered in the selected identity provider for the Community Training Resource + * This value contains a credential. Consider obscuring before showing to users + */ + clientSecret: string; + /** The name of the authentication policy registered in ADB2C for the Community Training Resource */ + b2CAuthenticationPolicy?: string; + /** The name of the password reset policy registered in ADB2C for the Community Training Resource */ + b2CPasswordResetPolicy?: string; + /** The custom login parameters for the Community Training Resource */ + customLoginParameters?: string; +} + +/** The resource model definition representing SKU */ +export interface Sku { + /** The name of the SKU. Ex - P3. It is typically a letter+number code */ + name: string; + /** This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. */ + tier?: SkuTier; + /** The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. */ + size?: string; + /** If the service has different generations of hardware, for the same SKU, then that can be captured here. */ + family?: string; + /** If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. */ + capacity?: number; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** The type used for update operations of the CommunityTraining. */ +export interface CommunityTrainingUpdate { + /** The SKU (Stock Keeping Unit) assigned to this resource. */ + sku?: Sku; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The identity configuration of the Community Training resource */ + identityConfiguration?: IdentityConfigurationPropertiesUpdate; +} + +/** Details of the Community CommunityTraining Identity Configuration */ +export interface IdentityConfigurationPropertiesUpdate { + /** The identity type of the Community Training Resource */ + identityType?: string; + /** To indicate whether the Community Training Resource has Teams enabled */ + teamsEnabled?: boolean; + /** The tenantId of the selected identity provider for the Community Training Resource */ + tenantId?: string; + /** The domain name of the selected identity provider for the Community Training Resource */ + domainName?: string; + /** The clientId of the application registered in the selected identity provider for the Community Training Resource */ + clientId?: string; + /** + * The client secret of the application registered in the selected identity provider for the Community Training Resource + * This value contains a credential. Consider obscuring before showing to users + */ + clientSecret?: string; + /** The name of the authentication policy registered in ADB2C for the Community Training Resource */ + b2CAuthenticationPolicy?: string; + /** The name of the password reset policy registered in ADB2C for the Community Training Resource */ + b2CPasswordResetPolicy?: string; + /** The custom login parameters for the Community Training Resource */ + customLoginParameters?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +} + +/** A CommunityProviderHub resource */ +export interface CommunityTraining extends TrackedResource { + /** The SKU (Stock Keeping Unit) assigned to this resource. */ + sku?: Sku; + /** The portal name (website name) of the Community Training instance */ + portalName?: string; + /** The email address of the portal admin */ + portalAdminEmailAddress?: string; + /** The organization name of the portal owner */ + portalOwnerOrganizationName?: string; + /** The email address of the portal owner. Will be used as the primary contact */ + portalOwnerEmailAddress?: string; + /** The identity configuration of the Community Training resource */ + identityConfiguration?: IdentityConfigurationProperties; + /** To indicate whether the Community Training instance has Zone Redundancy enabled */ + zoneRedundancyEnabled?: boolean; + /** To indicate whether the Community Training instance has Disaster Recovery enabled */ + disasterRecoveryEnabled?: boolean; + /** + * The status of the last operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +} + +/** Defines headers for CommunityTrainings_create operation. */ +export interface CommunityTrainingsCreateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; +} + +/** Defines headers for CommunityTrainings_update operation. */ +export interface CommunityTrainingsUpdateHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Defines headers for CommunityTrainings_delete operation. */ +export interface CommunityTrainingsDeleteHeaders { + /** The Retry-After header can indicate how long the client should wait before polling the operation status. */ + retryAfter?: number; + /** The Location header contains the URL where the status of the long running operation can be checked. */ + location?: string; +} + +/** Known values of {@link Origin} that the service accepts. */ +export enum KnownOrigin { + /** User */ + User = "user", + /** System */ + System = "system", + /** UserSystem */ + 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 = "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 { + /** Resource has been created. */ + Succeeded = "Succeeded", + /** Resource creation failed. */ + Failed = "Failed", + /** Resource creation was canceled. */ + Canceled = "Canceled", + /** Initial provisioning in progress */ + Provisioning = "Provisioning", + /** Update in progress */ + Updating = "Updating", + /** Deletion in progress */ + Deleting = "Deleting", + /** Change accepted for processing */ + Accepted = "Accepted" +} + +/** + * 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 + * **Succeeded**: Resource has been created. \ + * **Failed**: Resource creation failed. \ + * **Canceled**: Resource creation was canceled. \ + * **Provisioning**: Initial provisioning in progress \ + * **Updating**: Update in progress \ + * **Deleting**: Deletion in progress \ + * **Accepted**: Change accepted for processing + */ +export type ProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + 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; +/** Defines values for SkuTier. */ +export type SkuTier = "Free" | "Basic" | "Standard" | "Premium"; + +/** 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 CommunityTrainingsListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type CommunityTrainingsListBySubscriptionResponse = CommunityTrainingListResult; + +/** Optional parameters. */ +export interface CommunityTrainingsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type CommunityTrainingsListByResourceGroupResponse = CommunityTrainingListResult; + +/** Optional parameters. */ +export interface CommunityTrainingsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type CommunityTrainingsGetResponse = CommunityTraining; + +/** Optional parameters. */ +export interface CommunityTrainingsCreateOptionalParams + 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 CommunityTrainingsCreateResponse = CommunityTraining; + +/** Optional parameters. */ +export interface CommunityTrainingsUpdateOptionalParams + 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 update operation. */ +export type CommunityTrainingsUpdateResponse = CommunityTraining; + +/** Optional parameters. */ +export interface CommunityTrainingsDeleteOptionalParams + 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 CommunityTrainingsListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type CommunityTrainingsListBySubscriptionNextResponse = CommunityTrainingListResult; + +/** Optional parameters. */ +export interface CommunityTrainingsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type CommunityTrainingsListByResourceGroupNextResponse = CommunityTrainingListResult; + +/** Optional parameters. */ +export interface MicrosoftCommunityOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/communitytraining/arm-communitytraining/src/models/mappers.ts b/sdk/communitytraining/arm-communitytraining/src/models/mappers.ts new file mode 100644 index 000000000000..77dcd4dfc663 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/models/mappers.ts @@ -0,0 +1,677 @@ +/* + * 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: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + 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 CommunityTrainingListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommunityTrainingListResult", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CommunityTraining" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const IdentityConfigurationProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "IdentityConfigurationProperties", + modelProperties: { + identityType: { + serializedName: "identityType", + required: true, + type: { + name: "String" + } + }, + teamsEnabled: { + defaultValue: false, + serializedName: "teamsEnabled", + type: { + name: "Boolean" + } + }, + tenantId: { + serializedName: "tenantId", + required: true, + type: { + name: "String" + } + }, + domainName: { + serializedName: "domainName", + required: true, + type: { + name: "String" + } + }, + clientId: { + serializedName: "clientId", + required: true, + type: { + name: "String" + } + }, + clientSecret: { + serializedName: "clientSecret", + required: true, + type: { + name: "String" + } + }, + b2CAuthenticationPolicy: { + serializedName: "b2cAuthenticationPolicy", + type: { + name: "String" + } + }, + b2CPasswordResetPolicy: { + serializedName: "b2cPasswordResetPolicy", + type: { + name: "String" + } + }, + customLoginParameters: { + serializedName: "customLoginParameters", + type: { + name: "String" + } + } + } + } +}; + +export const Sku: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Sku", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + tier: { + serializedName: "tier", + type: { + name: "Enum", + allowedValues: ["Free", "Basic", "Standard", "Premium"] + } + }, + size: { + serializedName: "size", + type: { + name: "String" + } + }, + family: { + serializedName: "family", + type: { + name: "String" + } + }, + capacity: { + serializedName: "capacity", + type: { + name: "Number" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const CommunityTrainingUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommunityTrainingUpdate", + modelProperties: { + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + identityConfiguration: { + serializedName: "properties.identityConfiguration", + type: { + name: "Composite", + className: "IdentityConfigurationPropertiesUpdate" + } + } + } + } +}; + +export const IdentityConfigurationPropertiesUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "IdentityConfigurationPropertiesUpdate", + modelProperties: { + identityType: { + serializedName: "identityType", + type: { + name: "String" + } + }, + teamsEnabled: { + defaultValue: false, + serializedName: "teamsEnabled", + type: { + name: "Boolean" + } + }, + tenantId: { + serializedName: "tenantId", + type: { + name: "String" + } + }, + domainName: { + serializedName: "domainName", + type: { + name: "String" + } + }, + clientId: { + serializedName: "clientId", + type: { + name: "String" + } + }, + clientSecret: { + serializedName: "clientSecret", + type: { + name: "String" + } + }, + b2CAuthenticationPolicy: { + serializedName: "b2cAuthenticationPolicy", + type: { + name: "String" + } + }, + b2CPasswordResetPolicy: { + serializedName: "b2cPasswordResetPolicy", + type: { + name: "String" + } + }, + customLoginParameters: { + serializedName: "customLoginParameters", + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const CommunityTraining: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommunityTraining", + modelProperties: { + ...TrackedResource.type.modelProperties, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "Sku" + } + }, + portalName: { + serializedName: "properties.portalName", + type: { + name: "String" + } + }, + portalAdminEmailAddress: { + serializedName: "properties.portalAdminEmailAddress", + type: { + name: "String" + } + }, + portalOwnerOrganizationName: { + serializedName: "properties.portalOwnerOrganizationName", + type: { + name: "String" + } + }, + portalOwnerEmailAddress: { + serializedName: "properties.portalOwnerEmailAddress", + type: { + name: "String" + } + }, + identityConfiguration: { + serializedName: "properties.identityConfiguration", + type: { + name: "Composite", + className: "IdentityConfigurationProperties" + } + }, + zoneRedundancyEnabled: { + serializedName: "properties.zoneRedundancyEnabled", + type: { + name: "Boolean" + } + }, + disasterRecoveryEnabled: { + serializedName: "properties.disasterRecoveryEnabled", + type: { + name: "Boolean" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const CommunityTrainingsCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommunityTrainingsCreateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + } + } + } +}; + +export const CommunityTrainingsUpdateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommunityTrainingsUpdateHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const CommunityTrainingsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommunityTrainingsDeleteHeaders", + modelProperties: { + retryAfter: { + serializedName: "retry-after", + type: { + name: "Number" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/communitytraining/arm-communitytraining/src/models/parameters.ts b/sdk/communitytraining/arm-communitytraining/src/models/parameters.ts new file mode 100644 index 000000000000..461eb04ece9d --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/models/parameters.ts @@ -0,0 +1,130 @@ +/* + * 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 { + CommunityTraining as CommunityTrainingMapper, + CommunityTrainingUpdate as CommunityTrainingUpdateMapper +} 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: "2023-11-01", + 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: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const communityTrainingName: OperationURLParameter = { + parameterPath: "communityTrainingName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9-]{3,24}$") + }, + serializedName: "communityTrainingName", + 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 resource: OperationParameter = { + parameterPath: "resource", + mapper: CommunityTrainingMapper +}; + +export const properties: OperationParameter = { + parameterPath: "properties", + mapper: CommunityTrainingUpdateMapper +}; diff --git a/sdk/communitytraining/arm-communitytraining/src/operations/communityTrainings.ts b/sdk/communitytraining/arm-communitytraining/src/operations/communityTrainings.ts new file mode 100644 index 000000000000..641fb3c3f00a --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/operations/communityTrainings.ts @@ -0,0 +1,720 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { CommunityTrainings } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftCommunity } from "../microsoftCommunity"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; +import { + CommunityTraining, + CommunityTrainingsListBySubscriptionNextOptionalParams, + CommunityTrainingsListBySubscriptionOptionalParams, + CommunityTrainingsListBySubscriptionResponse, + CommunityTrainingsListByResourceGroupNextOptionalParams, + CommunityTrainingsListByResourceGroupOptionalParams, + CommunityTrainingsListByResourceGroupResponse, + CommunityTrainingsGetOptionalParams, + CommunityTrainingsGetResponse, + CommunityTrainingsCreateOptionalParams, + CommunityTrainingsCreateResponse, + CommunityTrainingUpdate, + CommunityTrainingsUpdateOptionalParams, + CommunityTrainingsUpdateResponse, + CommunityTrainingsDeleteOptionalParams, + CommunityTrainingsListBySubscriptionNextResponse, + CommunityTrainingsListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing CommunityTrainings operations. */ +export class CommunityTrainingsImpl implements CommunityTrainings { + private readonly client: MicrosoftCommunity; + + /** + * Initialize a new instance of the class CommunityTrainings class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftCommunity) { + this.client = client; + } + + /** + * List CommunityTraining resources by subscription ID + * @param options The options parameters. + */ + public listBySubscription( + options?: CommunityTrainingsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listBySubscriptionPagingPage(options, settings); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: CommunityTrainingsListBySubscriptionOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CommunityTrainingsListBySubscriptionResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listBySubscription(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listBySubscriptionPagingAll( + options?: CommunityTrainingsListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * List CommunityTraining resources by 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?: CommunityTrainingsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings + ); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: CommunityTrainingsListByResourceGroupOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: CommunityTrainingsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: CommunityTrainingsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * List CommunityTraining resources by subscription ID + * @param options The options parameters. + */ + private _listBySubscription( + options?: CommunityTrainingsListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * List CommunityTraining resources by 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?: CommunityTrainingsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Get a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param options The options parameters. + */ + get( + resourceGroupName: string, + communityTrainingName: string, + options?: CommunityTrainingsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, communityTrainingName, options }, + getOperationSpec + ); + } + + /** + * Create a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + communityTrainingName: string, + resource: CommunityTraining, + options?: CommunityTrainingsCreateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + CommunityTrainingsCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = 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 = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, communityTrainingName, resource, options }, + spec: createOperationSpec + }); + const poller = await createHttpPoller< + CommunityTrainingsCreateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Create a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + communityTrainingName: string, + resource: CommunityTraining, + options?: CommunityTrainingsCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + communityTrainingName, + resource, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + communityTrainingName: string, + properties: CommunityTrainingUpdate, + options?: CommunityTrainingsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + CommunityTrainingsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = 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 = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, communityTrainingName, properties, options }, + spec: updateOperationSpec + }); + const poller = await createHttpPoller< + CommunityTrainingsUpdateResponse, + OperationState + >(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Update a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + communityTrainingName: string, + properties: CommunityTrainingUpdate, + options?: CommunityTrainingsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + communityTrainingName, + properties, + options + ); + return poller.pollUntilDone(); + } + + /** + * Delete a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + communityTrainingName: string, + options?: CommunityTrainingsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperationFn = 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 = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, communityTrainingName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Delete a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + communityTrainingName: string, + options?: CommunityTrainingsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + communityTrainingName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: CommunityTrainingsListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * 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?: CommunityTrainingsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Community/communityTrainings", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CommunityTrainingListResult + }, + 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.Community/communityTrainings", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CommunityTrainingListResult + }, + 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.Community/communityTrainings/{communityTrainingName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CommunityTraining + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communityTrainingName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.CommunityTraining + }, + 201: { + bodyMapper: Mappers.CommunityTraining + }, + 202: { + bodyMapper: Mappers.CommunityTraining + }, + 204: { + bodyMapper: Mappers.CommunityTraining + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communityTrainingName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.CommunityTraining + }, + 201: { + bodyMapper: Mappers.CommunityTraining + }, + 202: { + bodyMapper: Mappers.CommunityTraining + }, + 204: { + bodyMapper: Mappers.CommunityTraining + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.properties, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communityTrainingName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Community/communityTrainings/{communityTrainingName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.communityTrainingName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CommunityTrainingListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CommunityTrainingListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/communitytraining/arm-communitytraining/src/operations/index.ts b/sdk/communitytraining/arm-communitytraining/src/operations/index.ts new file mode 100644 index 000000000000..a7b612f176b1 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/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 "./communityTrainings"; diff --git a/sdk/communitytraining/arm-communitytraining/src/operations/operations.ts b/sdk/communitytraining/arm-communitytraining/src/operations/operations.ts new file mode 100644 index 000000000000..be55fa553431 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftCommunity } from "../microsoftCommunity"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: MicrosoftCommunity; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftCommunity) { + this.client = client; + } + + /** + * List the operations for the provider + * @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: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + settings?: PageSettings + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List the operations for the provider + * @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.Community/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 + } + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/communitytraining/arm-communitytraining/src/operationsInterfaces/communityTrainings.ts b/sdk/communitytraining/arm-communitytraining/src/operationsInterfaces/communityTrainings.ts new file mode 100644 index 000000000000..e53043ddf3ea --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/operationsInterfaces/communityTrainings.ts @@ -0,0 +1,139 @@ +/* + * 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 { SimplePollerLike, OperationState } from "@azure/core-lro"; +import { + CommunityTraining, + CommunityTrainingsListBySubscriptionOptionalParams, + CommunityTrainingsListByResourceGroupOptionalParams, + CommunityTrainingsGetOptionalParams, + CommunityTrainingsGetResponse, + CommunityTrainingsCreateOptionalParams, + CommunityTrainingsCreateResponse, + CommunityTrainingUpdate, + CommunityTrainingsUpdateOptionalParams, + CommunityTrainingsUpdateResponse, + CommunityTrainingsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a CommunityTrainings. */ +export interface CommunityTrainings { + /** + * List CommunityTraining resources by subscription ID + * @param options The options parameters. + */ + listBySubscription( + options?: CommunityTrainingsListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * List CommunityTraining resources by resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: CommunityTrainingsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param options The options parameters. + */ + get( + resourceGroupName: string, + communityTrainingName: string, + options?: CommunityTrainingsGetOptionalParams + ): Promise; + /** + * Create a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + communityTrainingName: string, + resource: CommunityTraining, + options?: CommunityTrainingsCreateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + CommunityTrainingsCreateResponse + > + >; + /** + * Create a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param resource Resource create parameters. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + communityTrainingName: string, + resource: CommunityTraining, + options?: CommunityTrainingsCreateOptionalParams + ): Promise; + /** + * Update a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + communityTrainingName: string, + properties: CommunityTrainingUpdate, + options?: CommunityTrainingsUpdateOptionalParams + ): Promise< + SimplePollerLike< + OperationState, + CommunityTrainingsUpdateResponse + > + >; + /** + * Update a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param properties The resource properties to be updated. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + communityTrainingName: string, + properties: CommunityTrainingUpdate, + options?: CommunityTrainingsUpdateOptionalParams + ): Promise; + /** + * Delete a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + communityTrainingName: string, + options?: CommunityTrainingsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete a CommunityTraining + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityTrainingName The name of the Community Training Resource + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + communityTrainingName: string, + options?: CommunityTrainingsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/communitytraining/arm-communitytraining/src/operationsInterfaces/index.ts b/sdk/communitytraining/arm-communitytraining/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..a7b612f176b1 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/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 "./communityTrainings"; diff --git a/sdk/communitytraining/arm-communitytraining/src/operationsInterfaces/operations.ts b/sdk/communitytraining/arm-communitytraining/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..5cf5581845bd --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * List the operations for the provider + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/communitytraining/arm-communitytraining/src/pagingHelper.ts b/sdk/communitytraining/arm-communitytraining/src/pagingHelper.ts new file mode 100644 index 000000000000..269a2b9814b5 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * 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 interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/communitytraining/arm-communitytraining/test/sampleTest.ts b/sdk/communitytraining/arm-communitytraining/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/communitytraining/arm-communitytraining/tsconfig.json b/sdk/communitytraining/arm-communitytraining/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/communitytraining/arm-communitytraining/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/communitytraining/ci.mgmt.yml b/sdk/communitytraining/ci.mgmt.yml new file mode 100644 index 000000000000..3c200bf9e30a --- /dev/null +++ b/sdk/communitytraining/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/communitytraining/arm-communitytraining + - sdk/communitytraining/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/communitytraining/arm-communitytraining + - sdk/communitytraining/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: communitytraining + Artifacts: + - name: azure-arm-communitytraining + safeName: azurearmcommunitytraining + \ No newline at end of file