From e2affe8678d77b4bdc101cc6f14b00191c57e354 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 2 Oct 2024 00:31:00 +0000 Subject: [PATCH] CodeGen from PR 30820 in Azure/azure-rest-api-specs Merge a921d8d9a1640a97adddbd2900688bbfa27465a6 into e605d439dda724fc2fc0274e0a82a3434a1524d7 --- common/config/rush/pnpm-lock.yaml | 36 +- rush.json | 9 +- sdk/vi/arm-vi/LICENSE | 21 + sdk/vi/arm-vi/README.md | 38 + sdk/vi/arm-vi/_meta.json | 8 + sdk/vi/arm-vi/api-extractor.json | 31 + sdk/vi/arm-vi/package.json | 108 +++ sdk/vi/arm-vi/sample.env | 4 + sdk/vi/arm-vi/src/index.ts | 13 + sdk/vi/arm-vi/src/models/index.ts | 585 ++++++++++++++++ sdk/vi/arm-vi/src/models/mappers.ts | 657 ++++++++++++++++++ sdk/vi/arm-vi/src/models/parameters.ts | 175 +++++ sdk/vi/arm-vi/src/operations/accounts.ts | 501 +++++++++++++ sdk/vi/arm-vi/src/operations/generate.ts | 141 ++++ sdk/vi/arm-vi/src/operations/index.ts | 11 + sdk/vi/arm-vi/src/operations/operations.ts | 149 ++++ .../src/operationsInterfaces/accounts.ts | 99 +++ .../src/operationsInterfaces/generate.ts | 48 ++ .../arm-vi/src/operationsInterfaces/index.ts | 11 + .../src/operationsInterfaces/operations.ts | 22 + sdk/vi/arm-vi/src/pagingHelper.ts | 39 ++ sdk/vi/arm-vi/src/viManagementClient.ts | 145 ++++ sdk/vi/arm-vi/test/sampleTest.ts | 43 ++ sdk/vi/arm-vi/tsconfig.json | 27 + sdk/vi/ci.mgmt.yml | 38 + 25 files changed, 2955 insertions(+), 4 deletions(-) create mode 100644 sdk/vi/arm-vi/LICENSE create mode 100644 sdk/vi/arm-vi/README.md create mode 100644 sdk/vi/arm-vi/_meta.json create mode 100644 sdk/vi/arm-vi/api-extractor.json create mode 100644 sdk/vi/arm-vi/package.json create mode 100644 sdk/vi/arm-vi/sample.env create mode 100644 sdk/vi/arm-vi/src/index.ts create mode 100644 sdk/vi/arm-vi/src/models/index.ts create mode 100644 sdk/vi/arm-vi/src/models/mappers.ts create mode 100644 sdk/vi/arm-vi/src/models/parameters.ts create mode 100644 sdk/vi/arm-vi/src/operations/accounts.ts create mode 100644 sdk/vi/arm-vi/src/operations/generate.ts create mode 100644 sdk/vi/arm-vi/src/operations/index.ts create mode 100644 sdk/vi/arm-vi/src/operations/operations.ts create mode 100644 sdk/vi/arm-vi/src/operationsInterfaces/accounts.ts create mode 100644 sdk/vi/arm-vi/src/operationsInterfaces/generate.ts create mode 100644 sdk/vi/arm-vi/src/operationsInterfaces/index.ts create mode 100644 sdk/vi/arm-vi/src/operationsInterfaces/operations.ts create mode 100644 sdk/vi/arm-vi/src/pagingHelper.ts create mode 100644 sdk/vi/arm-vi/src/viManagementClient.ts create mode 100644 sdk/vi/arm-vi/test/sampleTest.ts create mode 100644 sdk/vi/arm-vi/tsconfig.json create mode 100644 sdk/vi/ci.mgmt.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 23e660a64126..5ce251fa1f85 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -1202,6 +1202,9 @@ dependencies: '@rush-temp/ts-http-runtime': specifier: file:./projects/ts-http-runtime.tgz version: file:projects/ts-http-runtime.tgz + '@rush-temp/vi': + specifier: file:./projects/vi.tgz + version: file:projects/vi.tgz '@rush-temp/vite-plugin-browser-test-map': specifier: file:./projects/vite-plugin-browser-test-map.tgz version: file:projects/vite-plugin-browser-test-map.tgz @@ -3987,7 +3990,7 @@ packages: /@types/jsonfile@6.1.4: resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} dependencies: - '@types/node': 18.19.54 + '@types/node': 22.7.4 dev: false /@types/jsonwebtoken@9.0.7: @@ -4130,7 +4133,7 @@ packages: /@types/readdir-glob@1.1.5: resolution: {integrity: sha512-raiuEPUYqXu+nvtY2Pe8s8FEmZ3x5yAH4VkLdihcPdalvsHltomrRC9BzuStrJ9yk06470hS0Crw0f1pXqD+Hg==} dependencies: - '@types/node': 18.19.54 + '@types/node': 22.7.4 dev: false /@types/resolve@1.20.2: @@ -25165,6 +25168,35 @@ packages: - webdriverio dev: false + file:projects/vi.tgz: + resolution: {integrity: sha512-yqihOaeIgWzjNj6qXzV5DKTyjyU3on3+l2b/INbSTniPHOw6udTtNSDFOsmGtW7DD3bAwxrV34CpG/dM8677YA==, tarball: file:projects/vi.tgz} + name: '@rush-temp/vi' + version: 0.0.0 + dependencies: + '@azure-tools/test-credential': 1.3.1 + '@azure-tools/test-recorder': 3.5.2 + '@azure/identity': 4.4.1 + '@microsoft/api-extractor': 7.47.9(@types/node@18.19.54) + '@types/chai': 4.3.20 + '@types/mocha': 10.0.8 + '@types/node': 18.19.54 + chai: 4.3.10 + cross-env: 7.0.3 + dotenv: 16.4.5 + mkdirp: 3.0.1 + mocha: 10.7.3 + rimraf: 5.0.10 + ts-node: 10.9.2(@types/node@18.19.54)(typescript@5.5.4) + tslib: 2.7.0 + tsx: 4.19.1 + typescript: 5.5.4 + uglify-js: 3.19.3 + transitivePeerDependencies: + - '@swc/core' + - '@swc/wasm' + - supports-color + dev: false + file:projects/vite-plugin-browser-test-map.tgz: resolution: {integrity: sha512-pflvqvLlAEuFncWSr3DVHuz0uGbrqlcl2ljmXrSaKO+i0cpn/spKDOL53CnDtKz81uXnKSpLCpECDaAxF8zbew==, tarball: file:projects/vite-plugin-browser-test-map.tgz} name: '@rush-temp/vite-plugin-browser-test-map' diff --git a/rush.json b/rush.json index 761d2c09827b..b92687fddc97 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. @@ -2291,6 +2291,11 @@ "packageName": "@azure/arm-trustedsigning", "projectFolder": "sdk/trustedsigning/arm-trustedsigning", "versionPolicyName": "management" + }, + { + "packageName": "vi", + "projectFolder": "sdk/vi/arm-vi", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/vi/arm-vi/LICENSE b/sdk/vi/arm-vi/LICENSE new file mode 100644 index 000000000000..7d5934740965 --- /dev/null +++ b/sdk/vi/arm-vi/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2024 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..eff6c32cc642 --- /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://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + + +### 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..93ddc2b45535 --- /dev/null +++ b/sdk/vi/arm-vi/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "cf2870c3d6554ef0543db96283c8820cb9ed7c2b", + "readme": "specification/vi/resource-manager/readme.md", + "autorest_command": "autorest --version=3.9.7 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/vi/resource-manager/readme.md --use=@autorest/typescript@^6.0.12", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.7.14", + "use": "@autorest/typescript@^6.0.12" +} \ 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..4057d22af11a --- /dev/null +++ b/sdk/vi/arm-vi/package.json @@ -0,0 +1,108 @@ +{ + "name": "vi", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for ViManagementClient.", + "version": "1.0.0-beta.1", + "engines": { + "node": ">=18.0.0" + }, + "dependencies": { + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.7.0", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.14.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.31.1", + "mkdirp": "^3.0.1", + "typescript": "~5.5.3", + "uglify-js": "^3.4.9", + "rimraf": "^5.0.0", + "dotenv": "^16.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/identity": "^4.2.1", + "@azure-tools/test-recorder": "^3.0.0", + "@azure-tools/test-credential": "^1.1.0", + "mocha": "^10.0.0", + "@types/mocha": "^10.0.0", + "tsx": "^4.7.1", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@types/node": "^18.0.0", + "ts-node": "^10.0.0" + }, + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && dev-tool run bundle && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "dev-tool run extract-api", + "lint": "echo skipped", + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/viManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/vi/arm-vi" +} \ No newline at end of file diff --git a/sdk/vi/arm-vi/sample.env b/sdk/vi/arm-vi/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/vi/arm-vi/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/vi/arm-vi/src/index.ts b/sdk/vi/arm-vi/src/index.ts new file mode 100644 index 000000000000..61bf6e4224bf --- /dev/null +++ b/sdk/vi/arm-vi/src/index.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export { getContinuationToken } from "./pagingHelper"; +export * from "./models"; +export { 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..33178ee5236a --- /dev/null +++ b/sdk/vi/arm-vi/src/models/index.ts @@ -0,0 +1,585 @@ +/* + * 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 storage services details */ +export interface StorageServicesForPutRequest { + /** The storage 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 storage services details */ +export interface StorageServicesForPatchRequest { + /** The user assigned identity to be used to grant permissions */ + userAssignedIdentity?: string; +} + +/** Resource tags */ +export interface Tags { + /** Resource tags */ + tags?: { [propertyName: string]: 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; +} + +/** Restricted viewer access token generation request's parameters */ +export interface GenerateRestrictedViewerAccessTokenParameters { + /** The requested media type */ + scope: Scope; + /** The video ID */ + videoId?: string; + /** The project ID */ + projectId?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +} + +/** Azure Video Indexer account */ +export interface AccountPatch extends 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 storage services details */ + storageServices?: StorageServicesForPatchRequest; + /** + * 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 interface Account extends 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. This can be set only when connecting an existing classic account */ + 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 storage services details */ + storageServices?: StorageServicesForPutRequest; + /** + * 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 */ + 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 = "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 = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Canceled */ + Canceled = "Canceled", + /** Accepted */ + Accepted = "Accepted", + /** Provisioning */ + Provisioning = "Provisioning", + /** Deleting */ + 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 = "None", + /** SystemAssigned */ + SystemAssigned = "SystemAssigned", + /** UserAssigned */ + UserAssigned = "UserAssigned", + /** SystemAssignedUserAssigned */ + 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 = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key", +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link PermissionType} that the service accepts. */ +export enum KnownPermissionType { + /** Contributor */ + Contributor = "Contributor", + /** Reader */ + 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 = "Video", + /** Account */ + Account = "Account", + /** Project */ + 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 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 GenerateRestrictedViewerAccessTokenOptionalParams + extends coreClient.OperationOptions { + /** The video ID */ + videoId?: string; + /** The project ID */ + projectId?: string; +} + +/** Contains response data for the restrictedViewerAccessToken operation. */ +export type GenerateRestrictedViewerAccessTokenResponse = 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..e5afbe9ebecd --- /dev/null +++ b/sdk/vi/arm-vi/src/models/mappers.ts @@ -0,0 +1,657 @@ +/* + * 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 StorageServicesForPutRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageServicesForPutRequest", + 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 StorageServicesForPatchRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageServicesForPatchRequest", + 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 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 GenerateRestrictedViewerAccessTokenParameters: coreClient.CompositeMapper = + { + type: { + name: "Composite", + className: "GenerateRestrictedViewerAccessTokenParameters", + modelProperties: { + scope: { + serializedName: "scope", + required: true, + type: { + name: "String", + }, + }, + videoId: { + serializedName: "videoId", + type: { + name: "String", + }, + }, + projectId: { + serializedName: "projectId", + 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", + }, + }, + storageServices: { + serializedName: "properties.storageServices", + type: { + name: "Composite", + className: "StorageServicesForPatchRequest", + }, + }, + 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: { + defaultValue: "00000000-0000-0000-0000-000000000000", + serializedName: "properties.accountId", + type: { + name: "String", + }, + }, + accountName: { + serializedName: "properties.accountName", + readOnly: true, + type: { + name: "String", + }, + }, + storageServices: { + serializedName: "properties.storageServices", + type: { + name: "Composite", + className: "StorageServicesForPutRequest", + }, + }, + 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..d857fd47dd4d --- /dev/null +++ b/sdk/vi/arm-vi/src/models/parameters.ts @@ -0,0 +1,175 @@ +/* + * 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, + GenerateRestrictedViewerAccessTokenParameters as GenerateRestrictedViewerAccessTokenParametersMapper, +} 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: "2024-01-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String", + }, + }, +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String", + }, + }, + skipEncoding: true, +}; + +export const 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 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, +}; + +export const scope1: OperationParameter = { + parameterPath: "scope", + mapper: GenerateRestrictedViewerAccessTokenParametersMapper, +}; + +export const videoId1: OperationParameter = { + parameterPath: ["options", "videoId"], + mapper: GenerateRestrictedViewerAccessTokenParametersMapper, +}; + +export const projectId1: OperationParameter = { + parameterPath: ["options", "projectId"], + mapper: GenerateRestrictedViewerAccessTokenParametersMapper, +}; 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..f5a83a0cf713 --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/accounts.ts @@ -0,0 +1,501 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { 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, + AccountsListResponse, + AccountsListByResourceGroupNextOptionalParams, + AccountsListByResourceGroupOptionalParams, + AccountsListByResourceGroupResponse, + AccountCheckNameAvailabilityParameters, + AccountsCheckNameAvailabilityOptionalParams, + AccountsCheckNameAvailabilityResponse, + 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: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + }, + }; + } + + private async *listPagingPage( + options?: AccountsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: AccountsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: 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: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listByResourceGroupPagingPage( + resourceGroupName, + options, + settings, + ); + }, + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: AccountsListByResourceGroupOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: AccountsListByResourceGroupResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._listByResourceGroup(resourceGroupName, options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options, + ); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: 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, + }, + 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, + }, + 201: { + bodyMapper: Mappers.Account, + }, + 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: {}, + 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, + }, + }, + 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, + }, + }, + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + ], + 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..c7080b383310 --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/generate.ts @@ -0,0 +1,141 @@ +/* + * 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, + GenerateRestrictedViewerAccessTokenOptionalParams, + GenerateRestrictedViewerAccessTokenResponse, +} 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, + ); + } + + /** + * Generate an Azure Video Indexer restricted viewer 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 scope The requested media type + * @param options The options parameters. + */ + restrictedViewerAccessToken( + resourceGroupName: string, + accountName: string, + scope: Scope, + options?: GenerateRestrictedViewerAccessTokenOptionalParams, + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, accountName, scope, options }, + restrictedViewerAccessTokenOperationSpec, + ); + } +} +// 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, + }, + 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, +}; +const restrictedViewerAccessTokenOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VideoIndexer/accounts/{accountName}/generateRestrictedViewerAccessToken", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.AccessToken, + }, + default: { + bodyMapper: Mappers.ErrorResponse, + }, + }, + requestBody: { + parameterPath: { + scope: ["scope"], + videoId: ["options", "videoId"], + projectId: ["options", "projectId"], + }, + mapper: { + ...Mappers.GenerateRestrictedViewerAccessTokenParameters, + 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..d4975b76b681 --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./accounts"; +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..433052b5ef1f --- /dev/null +++ b/sdk/vi/arm-vi/src/operations/operations.ts @@ -0,0 +1,149 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; +import { setContinuationToken } from "../pagingHelper"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { 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: (settings?: PageSettings) => { + if (settings?.maxPageSize) { + throw new Error("maxPageSize is not supported by this operation."); + } + return this.listPagingPage(options, settings); + }, + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams, + settings?: PageSettings, + ): AsyncIterableIterator { + let result: OperationsListResponse; + let continuationToken = settings?.continuationToken; + if (!continuationToken) { + result = await this._list(options); + let page = result.value || []; + continuationToken = result.nextLink; + setContinuationToken(page, continuationToken); + yield page; + } + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + let page = result.value || []; + setContinuationToken(page, continuationToken); + yield page; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams, + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * 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, + }, + }, + urlParameters: [Parameters.$host, Parameters.nextLink], + 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..d1e79a2d52c7 --- /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/generate.ts b/sdk/vi/arm-vi/src/operationsInterfaces/generate.ts new file mode 100644 index 000000000000..82f4f68bd610 --- /dev/null +++ b/sdk/vi/arm-vi/src/operationsInterfaces/generate.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + PermissionType, + Scope, + GenerateAccessTokenOptionalParams, + GenerateAccessTokenResponse, + GenerateRestrictedViewerAccessTokenOptionalParams, + GenerateRestrictedViewerAccessTokenResponse, +} 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; + /** + * Generate an Azure Video Indexer restricted viewer 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 scope The requested media type + * @param options The options parameters. + */ + restrictedViewerAccessToken( + resourceGroupName: string, + accountName: string, + scope: Scope, + options?: GenerateRestrictedViewerAccessTokenOptionalParams, + ): 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..d4975b76b681 --- /dev/null +++ b/sdk/vi/arm-vi/src/operationsInterfaces/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./accounts"; +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..8258b28b5eb8 --- /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/pagingHelper.ts b/sdk/vi/arm-vi/src/pagingHelper.ts new file mode 100644 index 000000000000..205cccc26592 --- /dev/null +++ b/sdk/vi/arm-vi/src/pagingHelper.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export interface PageInfo { + continuationToken?: string; +} + +const pageMap = new WeakMap(); + +/** + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from + * that point later. + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. + */ +export function getContinuationToken(page: unknown): string | undefined { + if (typeof page !== "object" || page === null) { + return undefined; + } + return pageMap.get(page)?.continuationToken; +} + +export function setContinuationToken( + page: unknown, + continuationToken: string | undefined, +): void { + if (typeof page !== "object" || page === null || !continuationToken) { + return; + } + const pageInfo = pageMap.get(page) ?? {}; + pageInfo.continuationToken = continuationToken; + pageMap.set(page, pageInfo); +} diff --git a/sdk/vi/arm-vi/src/viManagementClient.ts b/sdk/vi/arm-vi/src/viManagementClient.ts new file mode 100644 index 000000000000..22c086046ef6 --- /dev/null +++ b/sdk/vi/arm-vi/src/viManagementClient.ts @@ -0,0 +1,145 @@ +/* + * 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, GenerateImpl } from "./operations"; +import { Operations, Accounts, 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/1.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix, + }, + endpoint: + options.endpoint ?? options.baseUri ?? "https://management.azure.com", + }; + super(optionsWithDefaults); + + let bearerTokenAuthenticationPolicyFound: boolean = false; + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = + options.pipeline.getOrderedPolicies(); + bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName, + ); + } + if ( + !options || + !options.pipeline || + options.pipeline.getOrderedPolicies().length == 0 || + !bearerTokenAuthenticationPolicyFound + ) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName, + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + credential: credentials, + scopes: + optionsWithDefaults.credentialScopes ?? + `${optionsWithDefaults.endpoint}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge, + }, + }), + ); + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2024-01-01"; + this.operations = new OperationsImpl(this); + this.accounts = new AccountsImpl(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 "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + }, + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + operations: Operations; + accounts: Accounts; + 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..d64be981b694 --- /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