diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 0b099a66fa53..872423225110 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -278,6 +278,7 @@ specifiers: '@rush-temp/test-utils': file:./projects/test-utils.tgz '@rush-temp/test-utils-perf': file:./projects/test-utils-perf.tgz '@rush-temp/testing-recorder-new': file:./projects/testing-recorder-new.tgz + '@rush-temp/vi': file:./projects/vi.tgz '@rush-temp/video-analyzer-edge': file:./projects/video-analyzer-edge.tgz '@rush-temp/web-pubsub': file:./projects/web-pubsub.tgz '@rush-temp/web-pubsub-express': file:./projects/web-pubsub-express.tgz @@ -560,6 +561,7 @@ dependencies: '@rush-temp/test-utils': file:projects/test-utils.tgz '@rush-temp/test-utils-perf': file:projects/test-utils-perf.tgz '@rush-temp/testing-recorder-new': file:projects/testing-recorder-new.tgz + '@rush-temp/vi': file:projects/vi.tgz '@rush-temp/video-analyzer-edge': file:projects/video-analyzer-edge.tgz '@rush-temp/web-pubsub': file:projects/web-pubsub.tgz '@rush-temp/web-pubsub-express': file:projects/web-pubsub-express.tgz @@ -2984,7 +2986,7 @@ packages: dev: false /array-flatten/1.1.1: - resolution: {integrity: sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=} + resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} dev: false /array-includes/3.1.5: @@ -3224,7 +3226,7 @@ packages: dev: false /buffer-equal-constant-time/1.0.1: - resolution: {integrity: sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=} + resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} dev: false /buffer-from/1.1.2: @@ -3365,7 +3367,7 @@ packages: dev: false /charenc/0.0.2: - resolution: {integrity: sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=} + resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==} dev: false /check-error/1.0.2: @@ -3486,7 +3488,7 @@ packages: dev: false /concat-map/0.0.1: - resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: false /concurrently/7.2.0: @@ -18250,6 +18252,32 @@ packages: - utf-8-validate dev: false + file:projects/vi.tgz: + resolution: {integrity: sha512-KmRbJb926lBItpy0sC17Q9FkOzMVGsnyf0vQuKKE7mRt/Hv5+VG0dhviki/lalyV6km3yLs0J5n4kafRXnvZjg==, tarball: file:projects/vi.tgz} + name: '@rush-temp/vi' + version: 0.0.0 + dependencies: + '@azure/identity': 2.0.4 + '@microsoft/api-extractor': 7.18.11 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.73.0 + '@rollup/plugin-json': 4.1.0_rollup@2.73.0 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.73.0 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.73.0 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.73.0 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.73.0 + tslib: 2.4.0 + typescript: 4.2.4 + uglify-js: 3.15.5 + transitivePeerDependencies: + - '@types/node' + - debug + - supports-color + dev: false + file:projects/video-analyzer-edge.tgz: resolution: {integrity: sha512-HwXEHdkhYzP5GtggEZVU8vY0IPVCIV50ixN7PcoN1vHBuy36BMAJQ9AM5uvrgYJmiJaIafLORhfyhixOfQWuGQ==, tarball: file:projects/video-analyzer-edge.tgz} name: '@rush-temp/video-analyzer-edge' diff --git a/rush.json b/rush.json index 1b83d62d0259..38554cc383c9 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. @@ -1720,6 +1720,11 @@ "packageName": "@azure/arm-appcontainers", "projectFolder": "sdk/appcontainers/arm-appcontainers", "versionPolicyName": "management" + }, + { + "packageName": "vi", + "projectFolder": "sdk/vi/arm-vi", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/vi/arm-vi/CHANGELOG.md b/sdk/vi/arm-vi/CHANGELOG.md new file mode 100644 index 000000000000..8688bbcc3683 --- /dev/null +++ b/sdk/vi/arm-vi/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 2.0.0-beta.1 (2022-05-27) + +The package of vi is using our next generation design principles since version 2.0.0-beta.1, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/vi/arm-vi/LICENSE b/sdk/vi/arm-vi/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/vi/arm-vi/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/vi/arm-vi/README.md b/sdk/vi/arm-vi/README.md new file mode 100644 index 000000000000..063acda6455a --- /dev/null +++ b/sdk/vi/arm-vi/README.md @@ -0,0 +1,38 @@ +# ViManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for ViManagement client. + +Microsoft Azure Video Indexer + +[Package (NPM)](https://www.npmjs.com/package/vi) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + + +### Install the `vi` package + +Install the ViManagement client library for JavaScript with `npm`: + +```bash +npm install vi +``` + + + +### 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 + +### ViManagementClient + +`ViManagementClient` is the primary interface for developers using the ViManagement client library. Explore the methods on this client object to understand the different features of the ViManagement service that you can access. + diff --git a/sdk/vi/arm-vi/_meta.json b/sdk/vi/arm-vi/_meta.json new file mode 100644 index 000000000000..03beed786064 --- /dev/null +++ b/sdk/vi/arm-vi/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "4f270eda52a8b9fa077b849aa509e3c1f6b48920", + "readme": "specification/vi/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/vi/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.1", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" +} \ No newline at end of file diff --git a/sdk/vi/arm-vi/api-extractor.json b/sdk/vi/arm-vi/api-extractor.json new file mode 100644 index 000000000000..690ff00ff187 --- /dev/null +++ b/sdk/vi/arm-vi/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/vi.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/vi/arm-vi/package.json b/sdk/vi/arm-vi/package.json new file mode 100644 index 000000000000..9071666d556a --- /dev/null +++ b/sdk/vi/arm-vi/package.json @@ -0,0 +1,110 @@ +{ + "name": "vi", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for ViManagementClient.", + "version": "2.0.0-beta.1", + "engines": { + "node": ">=12.0.0" + }, + "dependencies": { + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.5.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.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/vi.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "7.18.11", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^1.0.4", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/vi/arm-vi", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/viManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/vi/arm-vi/review/vi.api.md b/sdk/vi/arm-vi/review/vi.api.md new file mode 100644 index 000000000000..660dca007b8c --- /dev/null +++ b/sdk/vi/arm-vi/review/vi.api.md @@ -0,0 +1,449 @@ +## API Report File for "vi" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; + +// @public +export interface AccessToken { + readonly accessToken?: string; +} + +// @public +export type Account = TrackedResource & { + identity?: ManagedServiceIdentity; + readonly systemData?: SystemData; + readonly tenantId?: string; + accountId?: string; + readonly accountName?: string; + mediaServices?: MediaServicesForPutRequest; + readonly totalSecondsIndexed?: number; + readonly provisioningState?: ProvisioningState; +}; + +// @public +export interface AccountCheckNameAvailabilityParameters { + name: string; + type: Type; +} + +// @public +export interface AccountList { + nextLink?: string; + readonly value?: Account[]; +} + +// @public +export type AccountPatch = Tags & { + identity?: ManagedServiceIdentity; + readonly tenantId?: string; + readonly accountId?: string; + mediaServices?: MediaServicesForPatchRequest; + readonly provisioningState?: ProvisioningState; +}; + +// @public +export interface Accounts { + checkNameAvailability(checkNameAvailabilityParameters: AccountCheckNameAvailabilityParameters, options?: AccountsCheckNameAvailabilityOptionalParams): Promise; + createOrUpdate(resourceGroupName: string, accountName: string, options?: AccountsCreateOrUpdateOptionalParams): Promise; + delete(resourceGroupName: string, accountName: string, options?: AccountsDeleteOptionalParams): Promise; + get(resourceGroupName: string, accountName: string, options?: AccountsGetOptionalParams): Promise; + list(options?: AccountsListOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: AccountsListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, accountName: string, options?: AccountsUpdateOptionalParams): Promise; +} + +// @public +export interface AccountsCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccountsCheckNameAvailabilityResponse = CheckNameAvailabilityResult; + +// @public +export interface AccountsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + parameters?: Account; +} + +// @public +export type AccountsCreateOrUpdateResponse = Account; + +// @public +export interface AccountsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface AccountsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccountsGetResponse = Account; + +// @public +export interface AccountsListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccountsListByResourceGroupNextResponse = AccountList; + +// @public +export interface AccountsListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccountsListByResourceGroupResponse = AccountList; + +// @public +export interface AccountsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccountsListNextResponse = AccountList; + +// @public +export interface AccountsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AccountsListResponse = AccountList; + +// @public +export interface AccountsUpdateOptionalParams extends coreClient.OperationOptions { + parameters?: AccountPatch; +} + +// @public +export type AccountsUpdateResponse = Account; + +// @public +export interface CheckNameAvailabilityResult { + readonly message?: string; + readonly nameAvailable?: boolean; + readonly reason?: Reason; +} + +// @public +export interface ClassicAccount { + readonly id?: string; + location?: string; + mediaServices?: ClassicAccountMediaServices; + readonly name?: string; +} + +// @public +export interface ClassicAccountMediaServices { + aadApplicationId?: string; + aadTenantId?: string; + connected?: boolean; + eventGridProviderRegistered?: boolean; + name?: string; + resourceGroup?: string; + streamingEndpointStarted?: boolean; + subscriptionId?: string; +} + +// @public +export interface ClassicAccounts { + getDetails(location: string, accountName: string, options?: ClassicAccountsGetDetailsOptionalParams): Promise; +} + +// @public +export interface ClassicAccountsGetDetailsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ClassicAccountsGetDetailsResponse = ClassicAccount; + +// @public +export interface ClassicAccountSlim { + readonly id?: string; + readonly location?: string; + readonly name?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorDefinition { + readonly code?: string; + readonly details?: ErrorDefinition[]; + readonly message?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDefinition; +} + +// @public +export interface Generate { + accessToken(resourceGroupName: string, accountName: string, permissionType: PermissionType, scope: Scope, options?: GenerateAccessTokenOptionalParams): Promise; +} + +// @public +export interface GenerateAccessTokenOptionalParams extends coreClient.OperationOptions { + projectId?: string; + videoId?: string; +} + +// @public +export interface GenerateAccessTokenParameters { + permissionType: PermissionType; + projectId?: string; + scope: Scope; + videoId?: string; +} + +// @public +export type GenerateAccessTokenResponse = AccessToken; + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownManagedServiceIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned", + // (undocumented) + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned", + // (undocumented) + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownPermissionType { + // (undocumented) + Contributor = "Contributor", + // (undocumented) + Reader = "Reader" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Accepted = "Accepted", + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Provisioning = "Provisioning", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownReason { + // (undocumented) + AlreadyExists = "AlreadyExists" +} + +// @public +export enum KnownScope { + // (undocumented) + Account = "Account", + // (undocumented) + Project = "Project", + // (undocumented) + Video = "Video" +} + +// @public +export enum KnownType { + // (undocumented) + MicrosoftVideoIndexerAccounts = "Microsoft.VideoIndexer/accounts" +} + +// @public +export interface ManagedServiceIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type: ManagedServiceIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentity; + }; +} + +// @public +export type ManagedServiceIdentityType = string; + +// @public +export interface MediaServicesForPatchRequest { + userAssignedIdentity?: string; +} + +// @public +export interface MediaServicesForPutRequest { + resourceId?: string; + userAssignedIdentity?: string; +} + +// @public +export interface Operation { + readonly actionType?: string; + readonly display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: string; +} + +// @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 PermissionType = string; + +// @public +export type ProvisioningState = string; + +// @public +export type Reason = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export type Scope = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface Tags { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type TrackedResource = Resource & { + tags?: { + [propertyName: string]: string; + }; + location: string; +}; + +// @public +export type Type = string; + +// @public +export interface UserAssignedIdentity { + readonly clientId?: string; + readonly principalId?: string; +} + +// @public +export interface UserClassicAccountList { + nextLink?: string; + readonly value?: ClassicAccountSlim[]; +} + +// @public +export interface UserClassicAccounts { + list(location: string, options?: UserClassicAccountsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface UserClassicAccountsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UserClassicAccountsListNextResponse = UserClassicAccountList; + +// @public +export interface UserClassicAccountsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UserClassicAccountsListResponse = UserClassicAccountList; + +// @public (undocumented) +export class ViManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ViManagementClientOptionalParams); + // (undocumented) + accounts: Accounts; + // (undocumented) + apiVersion: string; + // (undocumented) + classicAccounts: ClassicAccounts; + // (undocumented) + generate: Generate; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; + // (undocumented) + userClassicAccounts: UserClassicAccounts; +} + +// @public +export interface ViManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/vi/arm-vi/rollup.config.js b/sdk/vi/arm-vi/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/vi/arm-vi/rollup.config.js @@ -0,0 +1,122 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/vi/arm-vi/src/index.ts b/sdk/vi/arm-vi/src/index.ts new file mode 100644 index 000000000000..be41b82cb0f1 --- /dev/null +++ b/sdk/vi/arm-vi/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export * from "./models"; +export { ViManagementClient } from "./viManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/vi/arm-vi/src/models/index.ts b/sdk/vi/arm-vi/src/models/index.ts new file mode 100644 index 000000000000..347bd2a629bc --- /dev/null +++ b/sdk/vi/arm-vi/src/models/index.ts @@ -0,0 +1,631 @@ +/* + * 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"; + +/** Available operations of the service. */ +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; +} + +/** Operation detail payload */ +export interface Operation { + /** + * Name of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Indicates whether the operation is a data action + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isDataAction?: boolean; + /** + * Indicates the action type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly actionType?: string; + /** + * Display of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly display?: OperationDisplay; + /** + * Origin of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly origin?: string; +} + +/** Operation display payload */ +export interface OperationDisplay { + /** + * Resource provider of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provider?: string; + /** + * Resource of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resource?: string; + /** + * Localized friendly name for the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operation?: string; + /** + * Localized friendly description for the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly description?: string; +} + +/** Error response. */ +export interface ErrorResponse { + /** The error details. */ + error?: ErrorDefinition; +} + +/** Error definition. */ +export interface ErrorDefinition { + /** + * Service specific error code which serves as the substatus for the HTTP error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * Description of the error. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * Internal error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDefinition[]; +} + +/** The parameters used to check the availability of the Video Indexer account name. */ +export interface AccountCheckNameAvailabilityParameters { + /** The VideoIndexer account name. */ + name: string; + /** The type of resource, Microsoft.VideoIndexer/accounts */ + type: Type; +} + +/** The CheckNameAvailability operation response. */ +export interface CheckNameAvailabilityResult { + /** + * Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nameAvailable?: boolean; + /** + * Gets the reason that a Video Indexer account name could not be used. The Reason element is only returned if NameAvailable is false. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly reason?: Reason; + /** + * Gets an error message explaining the Reason value in more detail. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + +/** The list operation response, that contains the data pools and their properties. */ +export interface AccountList { + /** + * List of accounts and their properties. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Account[]; + /** URL to get the next set of operation list results if there are any. */ + nextLink?: string; +} + +/** The media services details */ +export interface MediaServicesForPutRequest { + /** The media services resource id */ + resourceId?: string; + /** The user assigned identity to be used to grant permissions */ + userAssignedIdentity?: string; +} + +/** Managed service identity (system assigned and/or user assigned identities) */ +export interface ManagedServiceIdentity { + /** + * The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ + type: ManagedServiceIdentityType; + /** The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. */ + userAssignedIdentities?: { [propertyName: string]: UserAssignedIdentity }; +} + +/** User assigned identity properties */ +export interface UserAssignedIdentity { + /** + * The principal ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The client ID of the assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** The media services details */ +export interface MediaServicesForPatchRequest { + /** The user assigned identity to be used to grant permissions */ + userAssignedIdentity?: string; +} + +/** Resource tags */ +export interface Tags { + /** Resource tags */ + tags?: { [propertyName: string]: string }; +} + +/** The list of user classic accounts. */ +export interface UserClassicAccountList { + /** + * List of classic account names and their location. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: ClassicAccountSlim[]; + /** URL to get the next set of operation list results if there are any. */ + nextLink?: string; +} + +/** An Azure Video Indexer classic account. */ +export interface ClassicAccountSlim { + /** + * The account's name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The account's location + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly location?: string; + /** + * The account's id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; +} + +/** An Azure Video Indexer classic account. */ +export interface ClassicAccount { + /** + * The account's name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** The account's location */ + location?: string; + /** + * The account's id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** The media services details */ + mediaServices?: ClassicAccountMediaServices; +} + +/** Azure Video Indexer classic account properties */ +export interface ClassicAccountMediaServices { + /** The aad application id */ + aadApplicationId?: string; + /** The aad tenant id */ + aadTenantId?: string; + /** Represents wether the media services is connected or not */ + connected?: boolean; + /** Represents if the media services event grid is connected or not */ + eventGridProviderRegistered?: boolean; + /** The media services name */ + name?: string; + /** The resource group that the media services belong to */ + resourceGroup?: string; + /** Represents wether the media services streaming endpoint has started */ + streamingEndpointStarted?: boolean; + /** The media services subscriptionId */ + subscriptionId?: string; +} + +/** Access token generation request's parameters */ +export interface GenerateAccessTokenParameters { + /** The requested permission */ + permissionType: PermissionType; + /** The requested media type */ + scope: Scope; + /** The video ID */ + videoId?: string; + /** The project ID */ + projectId?: string; +} + +/** Azure Video Indexer access token. */ +export interface AccessToken { + /** + * The access token. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly accessToken?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export type TrackedResource = Resource & { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +}; + +/** Azure Video Indexer account */ +export type AccountPatch = Tags & { + /** Managed service identity (system assigned and/or user assigned identities) */ + identity?: ManagedServiceIdentity; + /** + * The account's tenant id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** + * The account's data-plane ID + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly accountId?: string; + /** The media services details */ + mediaServices?: MediaServicesForPatchRequest; + /** + * Gets the status of the account at the time the operation was called. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +}; + +/** An Azure Video Indexer account. */ +export type Account = TrackedResource & { + /** Managed service identity (system assigned and/or user assigned identities) */ + identity?: ManagedServiceIdentity; + /** + * The system meta data relating to this resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** + * The account's tenant id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** The account's data-plane ID */ + accountId?: string; + /** + * The account's name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly accountName?: string; + /** The media services details */ + mediaServices?: MediaServicesForPutRequest; + /** + * An integer representing the total seconds that have been indexed on the account + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalSecondsIndexed?: number; + /** + * Gets the status of the account at the time the operation was called. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +}; + +/** Known values of {@link Type} that the service accepts. */ +export enum KnownType { + MicrosoftVideoIndexerAccounts = "Microsoft.VideoIndexer/accounts" +} + +/** + * Defines values for Type. \ + * {@link KnownType} can be used interchangeably with Type, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Microsoft.VideoIndexer\/accounts** + */ +export type Type = string; + +/** Known values of {@link Reason} that the service accepts. */ +export enum KnownReason { + AlreadyExists = "AlreadyExists" +} + +/** + * Defines values for Reason. \ + * {@link KnownReason} can be used interchangeably with Reason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AlreadyExists** + */ +export type Reason = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Accepted = "Accepted", + Provisioning = "Provisioning", + Deleting = "Deleting" +} + +/** + * 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** \ + * **Failed** \ + * **Canceled** \ + * **Accepted** \ + * **Provisioning** \ + * **Deleting** + */ +export type ProvisioningState = string; + +/** Known values of {@link ManagedServiceIdentityType} that the service accepts. */ +export enum KnownManagedServiceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + UserAssigned = "UserAssigned", + SystemAssignedUserAssigned = "SystemAssigned,UserAssigned" +} + +/** + * Defines values for ManagedServiceIdentityType. \ + * {@link KnownManagedServiceIdentityType} can be used interchangeably with ManagedServiceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** \ + * **UserAssigned** \ + * **SystemAssigned,UserAssigned** + */ +export type ManagedServiceIdentityType = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link PermissionType} that the service accepts. */ +export enum KnownPermissionType { + Contributor = "Contributor", + Reader = "Reader" +} + +/** + * Defines values for PermissionType. \ + * {@link KnownPermissionType} can be used interchangeably with PermissionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Contributor** \ + * **Reader** + */ +export type PermissionType = string; + +/** Known values of {@link Scope} that the service accepts. */ +export enum KnownScope { + Video = "Video", + Account = "Account", + Project = "Project" +} + +/** + * Defines values for Scope. \ + * {@link KnownScope} can be used interchangeably with Scope, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Video** \ + * **Account** \ + * **Project** + */ +export type Scope = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface AccountsCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkNameAvailability operation. */ +export type AccountsCheckNameAvailabilityResponse = CheckNameAvailabilityResult; + +/** Optional parameters. */ +export interface AccountsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AccountsListResponse = AccountList; + +/** Optional parameters. */ +export interface AccountsListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type AccountsListByResourceGroupResponse = AccountList; + +/** Optional parameters. */ +export interface AccountsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AccountsGetResponse = Account; + +/** Optional parameters. */ +export interface AccountsUpdateOptionalParams + extends coreClient.OperationOptions { + /** The parameters to provide for the current Azure Video Indexer account. */ + parameters?: AccountPatch; +} + +/** Contains response data for the update operation. */ +export type AccountsUpdateResponse = Account; + +/** Optional parameters. */ +export interface AccountsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** The parameters to provide for the Azure Video Indexer account. */ + parameters?: Account; +} + +/** Contains response data for the createOrUpdate operation. */ +export type AccountsCreateOrUpdateResponse = Account; + +/** Optional parameters. */ +export interface AccountsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface AccountsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AccountsListNextResponse = AccountList; + +/** Optional parameters. */ +export interface AccountsListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type AccountsListByResourceGroupNextResponse = AccountList; + +/** Optional parameters. */ +export interface UserClassicAccountsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type UserClassicAccountsListResponse = UserClassicAccountList; + +/** Optional parameters. */ +export interface UserClassicAccountsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type UserClassicAccountsListNextResponse = UserClassicAccountList; + +/** Optional parameters. */ +export interface ClassicAccountsGetDetailsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getDetails operation. */ +export type ClassicAccountsGetDetailsResponse = ClassicAccount; + +/** Optional parameters. */ +export interface GenerateAccessTokenOptionalParams + extends coreClient.OperationOptions { + /** The video ID */ + videoId?: string; + /** The project ID */ + projectId?: string; +} + +/** Contains response data for the accessToken operation. */ +export type GenerateAccessTokenResponse = AccessToken; + +/** Optional parameters. */ +export interface ViManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/vi/arm-vi/src/models/mappers.ts b/sdk/vi/arm-vi/src/models/mappers.ts new file mode 100644 index 000000000000..8c4f40d76fa2 --- /dev/null +++ b/sdk/vi/arm-vi/src/models/mappers.ts @@ -0,0 +1,777 @@ +/* + * 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" + } + }, + actionType: { + serializedName: "actionType", + readOnly: true, + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + 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: "ErrorDefinition" + } + } + } + } +}; + +export const ErrorDefinition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDefinition", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDefinition" + } + } + } + } + } + } +}; + +export const AccountCheckNameAvailabilityParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccountCheckNameAvailabilityParameters", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityResult", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + readOnly: true, + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const AccountList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccountList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Account" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const MediaServicesForPutRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MediaServicesForPutRequest", + modelProperties: { + resourceId: { + serializedName: "resourceId", + type: { + name: "String" + } + }, + userAssignedIdentity: { + serializedName: "userAssignedIdentity", + type: { + name: "String" + } + } + } + } +}; + +export const ManagedServiceIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedServiceIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "Uuid" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { name: "Composite", className: "UserAssignedIdentity" } + } + } + } + } + } +}; + +export const UserAssignedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "Uuid" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "Uuid" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const MediaServicesForPatchRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MediaServicesForPatchRequest", + modelProperties: { + userAssignedIdentity: { + serializedName: "userAssignedIdentity", + type: { + name: "String" + } + } + } + } +}; + +export const Tags: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Tags", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const UserClassicAccountList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserClassicAccountList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ClassicAccountSlim" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ClassicAccountSlim: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClassicAccountSlim", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + location: { + serializedName: "location", + readOnly: true, + type: { + name: "String" + } + }, + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ClassicAccount: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClassicAccount", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + mediaServices: { + serializedName: "properties.mediaServices", + type: { + name: "Composite", + className: "ClassicAccountMediaServices" + } + } + } + } +}; + +export const ClassicAccountMediaServices: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClassicAccountMediaServices", + modelProperties: { + aadApplicationId: { + serializedName: "aadApplicationId", + type: { + name: "String" + } + }, + aadTenantId: { + serializedName: "aadTenantId", + type: { + name: "String" + } + }, + connected: { + serializedName: "connected", + type: { + name: "Boolean" + } + }, + eventGridProviderRegistered: { + serializedName: "eventGridProviderRegistered", + type: { + name: "Boolean" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + resourceGroup: { + serializedName: "resourceGroup", + type: { + name: "String" + } + }, + streamingEndpointStarted: { + serializedName: "streamingEndpointStarted", + type: { + name: "Boolean" + } + }, + subscriptionId: { + serializedName: "subscriptionId", + type: { + name: "String" + } + } + } + } +}; + +export const GenerateAccessTokenParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GenerateAccessTokenParameters", + modelProperties: { + permissionType: { + serializedName: "permissionType", + required: true, + type: { + name: "String" + } + }, + scope: { + serializedName: "scope", + required: true, + type: { + name: "String" + } + }, + videoId: { + serializedName: "videoId", + type: { + name: "String" + } + }, + projectId: { + serializedName: "projectId", + type: { + name: "String" + } + } + } + } +}; + +export const AccessToken: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccessToken", + modelProperties: { + accessToken: { + serializedName: "accessToken", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const AccountPatch: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AccountPatch", + modelProperties: { + ...Tags.type.modelProperties, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity" + } + }, + tenantId: { + serializedName: "properties.tenantId", + readOnly: true, + type: { + name: "String" + } + }, + accountId: { + serializedName: "properties.accountId", + readOnly: true, + type: { + name: "String" + } + }, + mediaServices: { + serializedName: "properties.mediaServices", + type: { + name: "Composite", + className: "MediaServicesForPatchRequest" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Account: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Account", + modelProperties: { + ...TrackedResource.type.modelProperties, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedServiceIdentity" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + tenantId: { + serializedName: "properties.tenantId", + readOnly: true, + type: { + name: "String" + } + }, + accountId: { + serializedName: "properties.accountId", + type: { + name: "String" + } + }, + accountName: { + serializedName: "properties.accountName", + readOnly: true, + type: { + name: "String" + } + }, + mediaServices: { + serializedName: "properties.mediaServices", + type: { + name: "Composite", + className: "MediaServicesForPutRequest" + } + }, + totalSecondsIndexed: { + serializedName: "properties.totalSecondsIndexed", + readOnly: true, + type: { + name: "Number" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/vi/arm-vi/src/models/parameters.ts b/sdk/vi/arm-vi/src/models/parameters.ts new file mode 100644 index 000000000000..942ff94cbea2 --- /dev/null +++ b/sdk/vi/arm-vi/src/models/parameters.ts @@ -0,0 +1,173 @@ +/* + * 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 { + AccountCheckNameAvailabilityParameters as AccountCheckNameAvailabilityParametersMapper, + AccountPatch as AccountPatchMapper, + Account as AccountMapper, + GenerateAccessTokenParameters as GenerateAccessTokenParametersMapper +} 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: "2022-04-13-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const checkNameAvailabilityParameters: OperationParameter = { + parameterPath: "checkNameAvailabilityParameters", + mapper: AccountCheckNameAvailabilityParametersMapper +}; + +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 accountName: OperationURLParameter = { + parameterPath: "accountName", + mapper: { + constraints: { + Pattern: new RegExp("^[A-Za-z0-9-]+$"), + MaxLength: 50, + MinLength: 3 + }, + serializedName: "accountName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters: OperationParameter = { + parameterPath: ["options", "parameters"], + mapper: AccountPatchMapper +}; + +export const parameters1: OperationParameter = { + parameterPath: ["options", "parameters"], + mapper: AccountMapper +}; + +export const location: OperationURLParameter = { + parameterPath: "location", + mapper: { + constraints: { + MinLength: 1 + }, + serializedName: "location", + required: true, + type: { + name: "String" + } + } +}; + +export const permissionType: OperationParameter = { + parameterPath: "permissionType", + mapper: GenerateAccessTokenParametersMapper +}; + +export const scope: OperationParameter = { + parameterPath: "scope", + mapper: GenerateAccessTokenParametersMapper +}; + +export const videoId: OperationParameter = { + parameterPath: ["options", "videoId"], + mapper: GenerateAccessTokenParametersMapper +}; + +export const projectId: OperationParameter = { + parameterPath: ["options", "projectId"], + mapper: GenerateAccessTokenParametersMapper +}; diff --git a/sdk/vi/arm-vi/src/operations/accounts.ts b/sdk/vi/arm-vi/src/operations/accounts.ts new file mode 100644 index 000000000000..fde2146b86ae --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/accounts.ts @@ -0,0 +1,510 @@ +/* + * 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 { Accounts } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ViManagementClient } from "../viManagementClient"; +import { + Account, + AccountsListNextOptionalParams, + AccountsListOptionalParams, + AccountsListByResourceGroupNextOptionalParams, + AccountsListByResourceGroupOptionalParams, + AccountCheckNameAvailabilityParameters, + AccountsCheckNameAvailabilityOptionalParams, + AccountsCheckNameAvailabilityResponse, + AccountsListResponse, + AccountsListByResourceGroupResponse, + AccountsGetOptionalParams, + AccountsGetResponse, + AccountsUpdateOptionalParams, + AccountsUpdateResponse, + AccountsCreateOrUpdateOptionalParams, + AccountsCreateOrUpdateResponse, + AccountsDeleteOptionalParams, + AccountsListNextResponse, + AccountsListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing Accounts operations. */ +export class AccountsImpl implements Accounts { + private readonly client: ViManagementClient; + + /** + * Initialize a new instance of the class Accounts class. + * @param client Reference to the service client + */ + constructor(client: ViManagementClient) { + this.client = client; + } + + /** + * List all Azure Video Indexer accounts available under the subscription + * @param options The options parameters. + */ + public list( + options?: AccountsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: AccountsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: AccountsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List all Azure Video Indexer accounts available under the resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: AccountsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: AccountsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: AccountsListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique + * globally + * @param options The options parameters. + */ + checkNameAvailability( + checkNameAvailabilityParameters: AccountCheckNameAvailabilityParameters, + options?: AccountsCheckNameAvailabilityOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { checkNameAvailabilityParameters, options }, + checkNameAvailabilityOperationSpec + ); + } + + /** + * List all Azure Video Indexer accounts available under the subscription + * @param options The options parameters. + */ + private _list( + options?: AccountsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * List all Azure Video Indexer accounts available under the resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: AccountsListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Gets the properties of an Azure Video Indexer account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + accountName: string, + options?: AccountsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options }, + getOperationSpec + ); + } + + /** + * Updates the properties of an existing Azure Video Indexer account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + accountName: string, + options?: AccountsUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options }, + updateOperationSpec + ); + } + + /** + * Creates or updates an Azure Video Indexer account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + accountName: string, + options?: AccountsCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Delete an Azure Video Indexer account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + accountName: string, + options?: AccountsDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, options }, + deleteOperationSpec + ); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: AccountsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: AccountsListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/checkNameAvailability", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckNameAvailabilityResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.checkNameAvailabilityParameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.VideoIndexer/accounts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AccountList + }, + 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.VideoIndexer/accounts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AccountList + }, + 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.VideoIndexer/accounts/{accountName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.Account + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Account + }, + 400: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 404: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 500: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Account + }, + 400: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 404: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 409: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 500: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 202: {}, + 204: {}, + 500: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AccountList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AccountList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/vi/arm-vi/src/operations/classicAccounts.ts b/sdk/vi/arm-vi/src/operations/classicAccounts.ts new file mode 100644 index 000000000000..a4fe45c8dc57 --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/classicAccounts.ts @@ -0,0 +1,87 @@ +/* + * 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 { ClassicAccounts } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ViManagementClient } from "../viManagementClient"; +import { + ClassicAccountsGetDetailsOptionalParams, + ClassicAccountsGetDetailsResponse +} from "../models"; + +/** Class containing ClassicAccounts operations. */ +export class ClassicAccountsImpl implements ClassicAccounts { + private readonly client: ViManagementClient; + + /** + * Initialize a new instance of the class ClassicAccounts class. + * @param client Reference to the service client + */ + constructor(client: ViManagementClient) { + this.client = client; + } + + /** + * Gets the properties of an Azure Video Indexer Classic account. + * @param location The name of Azure region. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + getDetails( + location: string, + accountName: string, + options?: ClassicAccountsGetDetailsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { location, accountName, options }, + getDetailsOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getDetailsOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.VideoIndexer/locations/{location}/classicAccounts/{accountName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ClassicAccount + }, + 400: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 401: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 404: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 500: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.accountName, + Parameters.location + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/vi/arm-vi/src/operations/generate.ts b/sdk/vi/arm-vi/src/operations/generate.ts new file mode 100644 index 000000000000..cec3906077fe --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/generate.ts @@ -0,0 +1,104 @@ +/* + * 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 { Generate } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ViManagementClient } from "../viManagementClient"; +import { + PermissionType, + Scope, + GenerateAccessTokenOptionalParams, + GenerateAccessTokenResponse +} from "../models"; + +/** Class containing Generate operations. */ +export class GenerateImpl implements Generate { + private readonly client: ViManagementClient; + + /** + * Initialize a new instance of the class Generate class. + * @param client Reference to the service client + */ + constructor(client: ViManagementClient) { + this.client = client; + } + + /** + * Generate an Azure Video Indexer access token. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param permissionType The requested permission + * @param scope The requested media type + * @param options The options parameters. + */ + accessToken( + resourceGroupName: string, + accountName: string, + permissionType: PermissionType, + scope: Scope, + options?: GenerateAccessTokenOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, permissionType, scope, options }, + accessTokenOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const accessTokenOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}/generateAccessToken", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AccessToken + }, + 400: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 404: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 409: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + 500: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: { + parameterPath: { + permissionType: ["permissionType"], + scope: ["scope"], + videoId: ["options", "videoId"], + projectId: ["options", "projectId"] + }, + mapper: { ...Mappers.GenerateAccessTokenParameters, required: true } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.accountName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/vi/arm-vi/src/operations/index.ts b/sdk/vi/arm-vi/src/operations/index.ts new file mode 100644 index 000000000000..6db99cf5d354 --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/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 * from "./operations"; +export * from "./accounts"; +export * from "./userClassicAccounts"; +export * from "./classicAccounts"; +export * from "./generate"; diff --git a/sdk/vi/arm-vi/src/operations/operations.ts b/sdk/vi/arm-vi/src/operations/operations.ts new file mode 100644 index 000000000000..d9d36bc2a320 --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/operations.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ViManagementClient } from "../viManagementClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: ViManagementClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: ViManagementClient) { + this.client = client; + } + + /** + * Lists all of the available Azure Video Indexer provider operations. + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all of the available Azure Video Indexer provider operations. + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.VideoIndexer/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/vi/arm-vi/src/operations/userClassicAccounts.ts b/sdk/vi/arm-vi/src/operations/userClassicAccounts.ts new file mode 100644 index 000000000000..af9b720a4f0d --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/userClassicAccounts.ts @@ -0,0 +1,157 @@ +/* + * 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 { UserClassicAccounts } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ViManagementClient } from "../viManagementClient"; +import { + ClassicAccountSlim, + UserClassicAccountsListNextOptionalParams, + UserClassicAccountsListOptionalParams, + UserClassicAccountsListResponse, + UserClassicAccountsListNextResponse +} from "../models"; + +/// +/** Class containing UserClassicAccounts operations. */ +export class UserClassicAccountsImpl implements UserClassicAccounts { + private readonly client: ViManagementClient; + + /** + * Initialize a new instance of the class UserClassicAccounts class. + * @param client Reference to the service client + */ + constructor(client: ViManagementClient) { + this.client = client; + } + + /** + * Lists all Azure Video Indexer classic accounts + * @param location The name of Azure region. + * @param options The options parameters. + */ + public list( + location: string, + options?: UserClassicAccountsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(location, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(location, options); + } + }; + } + + private async *listPagingPage( + location: string, + options?: UserClassicAccountsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(location, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(location, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + location: string, + options?: UserClassicAccountsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(location, options)) { + yield* page; + } + } + + /** + * Lists all Azure Video Indexer classic accounts + * @param location The name of Azure region. + * @param options The options parameters. + */ + private _list( + location: string, + options?: UserClassicAccountsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { location, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param location The name of Azure region. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + location: string, + nextLink: string, + options?: UserClassicAccountsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { location, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.VideoIndexer/locations/{location}/userClassicAccounts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UserClassicAccountList + }, + 500: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.location], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UserClassicAccountList + }, + 500: { + bodyMapper: Mappers.ErrorResponse, + isError: true + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.location], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/vi/arm-vi/src/operationsInterfaces/accounts.ts b/sdk/vi/arm-vi/src/operationsInterfaces/accounts.ts new file mode 100644 index 000000000000..a8b9bb426588 --- /dev/null +++ b/sdk/vi/arm-vi/src/operationsInterfaces/accounts.ts @@ -0,0 +1,99 @@ +/* + * 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 { + Account, + AccountsListOptionalParams, + AccountsListByResourceGroupOptionalParams, + AccountCheckNameAvailabilityParameters, + AccountsCheckNameAvailabilityOptionalParams, + AccountsCheckNameAvailabilityResponse, + AccountsGetOptionalParams, + AccountsGetResponse, + AccountsUpdateOptionalParams, + AccountsUpdateResponse, + AccountsCreateOrUpdateOptionalParams, + AccountsCreateOrUpdateResponse, + AccountsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a Accounts. */ +export interface Accounts { + /** + * List all Azure Video Indexer accounts available under the subscription + * @param options The options parameters. + */ + list( + options?: AccountsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * List all Azure Video Indexer accounts available under the resource group + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: AccountsListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Checks that the Video Indexer account name is valid and is not already in use. + * @param checkNameAvailabilityParameters The name of the Video Indexer account. Name must be unique + * globally + * @param options The options parameters. + */ + checkNameAvailability( + checkNameAvailabilityParameters: AccountCheckNameAvailabilityParameters, + options?: AccountsCheckNameAvailabilityOptionalParams + ): Promise; + /** + * Gets the properties of an Azure Video Indexer account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + accountName: string, + options?: AccountsGetOptionalParams + ): Promise; + /** + * Updates the properties of an existing Azure Video Indexer account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + accountName: string, + options?: AccountsUpdateOptionalParams + ): Promise; + /** + * Creates or updates an Azure Video Indexer account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroupName: string, + accountName: string, + options?: AccountsCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete an Azure Video Indexer account. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + accountName: string, + options?: AccountsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/vi/arm-vi/src/operationsInterfaces/classicAccounts.ts b/sdk/vi/arm-vi/src/operationsInterfaces/classicAccounts.ts new file mode 100644 index 000000000000..d91fff73e381 --- /dev/null +++ b/sdk/vi/arm-vi/src/operationsInterfaces/classicAccounts.ts @@ -0,0 +1,27 @@ +/* + * 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 { + ClassicAccountsGetDetailsOptionalParams, + ClassicAccountsGetDetailsResponse +} from "../models"; + +/** Interface representing a ClassicAccounts. */ +export interface ClassicAccounts { + /** + * Gets the properties of an Azure Video Indexer Classic account. + * @param location The name of Azure region. + * @param accountName The name of the Azure Video Indexer account. + * @param options The options parameters. + */ + getDetails( + location: string, + accountName: string, + options?: ClassicAccountsGetDetailsOptionalParams + ): Promise; +} diff --git a/sdk/vi/arm-vi/src/operationsInterfaces/generate.ts b/sdk/vi/arm-vi/src/operationsInterfaces/generate.ts new file mode 100644 index 000000000000..6d564b75a121 --- /dev/null +++ b/sdk/vi/arm-vi/src/operationsInterfaces/generate.ts @@ -0,0 +1,33 @@ +/* + * 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 { + PermissionType, + Scope, + GenerateAccessTokenOptionalParams, + GenerateAccessTokenResponse +} from "../models"; + +/** Interface representing a Generate. */ +export interface Generate { + /** + * Generate an Azure Video Indexer access token. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName The name of the Azure Video Indexer account. + * @param permissionType The requested permission + * @param scope The requested media type + * @param options The options parameters. + */ + accessToken( + resourceGroupName: string, + accountName: string, + permissionType: PermissionType, + scope: Scope, + options?: GenerateAccessTokenOptionalParams + ): Promise; +} diff --git a/sdk/vi/arm-vi/src/operationsInterfaces/index.ts b/sdk/vi/arm-vi/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..6db99cf5d354 --- /dev/null +++ b/sdk/vi/arm-vi/src/operationsInterfaces/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 * from "./operations"; +export * from "./accounts"; +export * from "./userClassicAccounts"; +export * from "./classicAccounts"; +export * from "./generate"; diff --git a/sdk/vi/arm-vi/src/operationsInterfaces/operations.ts b/sdk/vi/arm-vi/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..da3e9ef85977 --- /dev/null +++ b/sdk/vi/arm-vi/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 { + /** + * Lists all of the available Azure Video Indexer provider operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/vi/arm-vi/src/operationsInterfaces/userClassicAccounts.ts b/sdk/vi/arm-vi/src/operationsInterfaces/userClassicAccounts.ts new file mode 100644 index 000000000000..22f2b218d31b --- /dev/null +++ b/sdk/vi/arm-vi/src/operationsInterfaces/userClassicAccounts.ts @@ -0,0 +1,27 @@ +/* + * 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 { + ClassicAccountSlim, + UserClassicAccountsListOptionalParams +} from "../models"; + +/// +/** Interface representing a UserClassicAccounts. */ +export interface UserClassicAccounts { + /** + * Lists all Azure Video Indexer classic accounts + * @param location The name of Azure region. + * @param options The options parameters. + */ + list( + location: string, + options?: UserClassicAccountsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/vi/arm-vi/src/viManagementClient.ts b/sdk/vi/arm-vi/src/viManagementClient.ts new file mode 100644 index 000000000000..9545bddfa230 --- /dev/null +++ b/sdk/vi/arm-vi/src/viManagementClient.ts @@ -0,0 +1,154 @@ +/* + * 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, + AccountsImpl, + UserClassicAccountsImpl, + ClassicAccountsImpl, + GenerateImpl +} from "./operations"; +import { + Operations, + Accounts, + UserClassicAccounts, + ClassicAccounts, + Generate +} from "./operationsInterfaces"; +import { ViManagementClientOptionalParams } from "./models"; + +export class ViManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the ViManagementClient 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?: ViManagementClientOptionalParams + ) { + 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: ViManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-vi/2.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.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 || "2022-04-13-preview"; + this.operations = new OperationsImpl(this); + this.accounts = new AccountsImpl(this); + this.userClassicAccounts = new UserClassicAccountsImpl(this); + this.classicAccounts = new ClassicAccountsImpl(this); + this.generate = new GenerateImpl(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 item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + accounts: Accounts; + userClassicAccounts: UserClassicAccounts; + classicAccounts: ClassicAccounts; + generate: Generate; +} diff --git a/sdk/vi/arm-vi/test/sampleTest.ts b/sdk/vi/arm-vi/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/vi/arm-vi/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/vi/arm-vi/tsconfig.json b/sdk/vi/arm-vi/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/vi/arm-vi/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/vi/ci.mgmt.yml b/sdk/vi/ci.mgmt.yml new file mode 100644 index 000000000000..08c46846247f --- /dev/null +++ b/sdk/vi/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/vi/arm-vi + - sdk/vi/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/vi/arm-vi + - sdk/vi/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: vi + Artifacts: + - name: vi + safeName: vi + \ No newline at end of file