From a06d83101be4fb9b4a31d6a128beb241b6162768 Mon Sep 17 00:00:00 2001 From: colawwj <70128817+colawwj@users.noreply.github.com> Date: Thu, 10 Mar 2022 18:25:56 +0800 Subject: [PATCH] [AzureStack][Mgmt]hybrid-profile-2020-09-01-for-authorization (#20768) * hybrid-for-authorization * update --- common/config/rush/pnpm-lock.yaml | 30 + eng/ignore-links.txt | 1 + rush.json | 5 + .../CHANGELOG.md | 11 + .../LICENSE | 21 + .../README.md | 161 ++- .../_meta.json | 8 + .../api-extractor.json | 31 + .../package.json | 95 +- .../node/my_test/recording_sample_test.js | 5 + ...orization-profile-2020-09-01-hybrid.api.md | 412 ++++++ .../rollup.config.js | 145 +- .../src/authorizationManagementClient.ts | 127 +- .../authorizationManagementClientContext.ts | 68 - .../src/index.ts | 12 + .../src/models/globalAdministratorMappers.ts | 11 - .../src/models/index.ts | 1152 +++++----------- .../src/models/mappers.ts | 421 +++--- .../src/models/parameters.ts | 198 ++- .../src/models/permissionsMappers.ts | 13 - ...iderOperationsMetadataOperationsMappers.ts | 15 - .../src/models/roleAssignmentsMappers.ts | 16 - .../src/models/roleDefinitionsMappers.ts | 14 - .../src/operations/globalAdministrator.ts | 72 +- .../src/operations/index.ts | 8 +- .../src/operations/permissions.ts | 436 +++--- .../providerOperationsMetadataOperations.ts | 232 ++-- .../src/operations/roleAssignments.ts | 1177 +++++++++-------- .../src/operations/roleDefinitions.ts | 443 +++---- .../globalAdministrator.ts | 20 + .../src/operationsInterfaces/index.ts | 13 + .../src/operationsInterfaces/permissions.ts | 45 + .../providerOperationsMetadataOperations.ts | 36 + .../operationsInterfaces/roleAssignments.ts | 154 +++ .../operationsInterfaces/roleDefinitions.ts | 83 ++ .../test/sampleTest.ts | 48 + .../tsconfig.json | 20 +- sdk/authorization/ci.mgmt.yml | 9 +- 38 files changed, 3243 insertions(+), 2525 deletions(-) create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/CHANGELOG.md create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/LICENSE create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/_meta.json create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/api-extractor.json create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/review/arm-authorization-profile-2020-09-01-hybrid.api.md delete mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClientContext.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/index.ts delete mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/globalAdministratorMappers.ts delete mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/permissionsMappers.ts delete mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/providerOperationsMetadataOperationsMappers.ts delete mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/roleAssignmentsMappers.ts delete mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/roleDefinitionsMappers.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/globalAdministrator.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/index.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/permissions.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/providerOperationsMetadataOperations.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/roleAssignments.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/roleDefinitions.ts create mode 100644 sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/test/sampleTest.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index b8b47d70dfba..2197c9dbd3ec 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -18,6 +18,7 @@ specifiers: '@rush-temp/arm-appservice': file:./projects/arm-appservice.tgz '@rush-temp/arm-attestation': file:./projects/arm-attestation.tgz '@rush-temp/arm-authorization': file:./projects/arm-authorization.tgz + '@rush-temp/arm-authorization-profile-2020-09-01-hybrid': file:./projects/arm-authorization-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-avs': file:./projects/arm-avs.tgz '@rush-temp/arm-azurestack': file:./projects/arm-azurestack.tgz '@rush-temp/arm-azurestackhci': file:./projects/arm-azurestackhci.tgz @@ -284,6 +285,7 @@ dependencies: '@rush-temp/arm-appservice': file:projects/arm-appservice.tgz '@rush-temp/arm-attestation': file:projects/arm-attestation.tgz '@rush-temp/arm-authorization': file:projects/arm-authorization.tgz + '@rush-temp/arm-authorization-profile-2020-09-01-hybrid': file:projects/arm-authorization-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-avs': file:projects/arm-avs.tgz '@rush-temp/arm-azurestack': file:projects/arm-azurestack.tgz '@rush-temp/arm-azurestackhci': file:projects/arm-azurestackhci.tgz @@ -9284,6 +9286,34 @@ packages: - supports-color dev: false + file:projects/arm-authorization-profile-2020-09-01-hybrid.tgz: + resolution: {integrity: sha512-2exf9RIRe7S8aTzJkwZ5LvX00Vif9Y9ueWzAxzk2hwQZTXfK9bqSPWkjcOBU8Uiavwz6zZjP7cVm9eZGxbPEEg==, tarball: file:projects/arm-authorization-profile-2020-09-01-hybrid.tgz} + name: '@rush-temp/arm-authorization-profile-2020-09-01-hybrid' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@azure/identity': 2.0.4 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 21.0.2_rollup@2.70.0 + '@rollup/plugin-json': 4.1.0_rollup@2.70.0 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.70.0 + '@rollup/plugin-node-resolve': 13.1.3_rollup@2.70.0 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.70.0 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.70.0 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.15.2 + transitivePeerDependencies: + - '@types/node' + - debug + - encoding + - supports-color + dev: false + file:projects/arm-authorization.tgz: resolution: {integrity: sha512-G1VpgblVPEzRfMyiETGD1ZOSETwtleOSpYkTxI70vUYNS9v7WuQhftIEHgXwIPMQtP+ujyBV+Fo3GwH9ziANSQ==, tarball: file:projects/arm-authorization.tgz} name: '@rush-temp/arm-authorization' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index ee659f1fa098..7bb338cfd3a8 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -22,3 +22,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-network-profile-2020-09-01- https://docs.microsoft.com/javascript/api/@azure/arm-commerce-profile-2020-09-01-hybrid?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-compute-profile-2020-09-01-hybrid https://docs.microsoft.com/javascript/api/@azure/arm-eventhub-profile-2020-09-01-hybrid?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/arm-authorization-profile-2020-09-01-hybrid diff --git a/rush.json b/rush.json index 145122271f96..4aaf31fda546 100644 --- a/rush.json +++ b/rush.json @@ -1639,6 +1639,11 @@ "packageName": "@azure/arm-eventhub-profile-2020-09-01-hybrid", "projectFolder": "sdk/eventhub/arm-eventhub-profile-2020-09-01-hybrid", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-authorization-profile-2020-09-01-hybrid", + "projectFolder": "sdk/authorization/arm-authorization-profile-2020-09-01-hybrid", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/CHANGELOG.md b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/CHANGELOG.md new file mode 100644 index 000000000000..829cd88023d5 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 2.0.0 (2022-03-10) + +The package of @azure/arm-authorization-profile-2020-09-01-hybrid is using our next generation design principles since version 2.0.0, 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/authorization/arm-authorization-profile-2020-09-01-hybrid/LICENSE b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/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/authorization/arm-authorization-profile-2020-09-01-hybrid/README.md b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/README.md index de209d61a2e6..769957e3e41b 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/README.md +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/README.md @@ -1,110 +1,109 @@ -## Azure AuthorizationManagementClient SDK for JavaScript +# Azure AuthorizationManagement client library for JavaScript -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AuthorizationManagementClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure AuthorizationManagement client. + +Role based access control provides you a way to apply granular level policy administration down to individual resources or resource groups. These operations enable you to manage role definitions and role assignments. A role definition describes the set of actions that can be performed on resources. A role assignment grants access to Azure Active Directory users. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-authorization-profile-2020-09-01-hybrid) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-authorization-profile-2020-09-01-hybrid) | +[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. +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. ### Prerequisites -You must have an [Azure subscription](https://azure.microsoft.com/free/). +- An [Azure subscription][azure_sub]. -### How to install +### Install the `@azure/arm-authorization-profile-2020-09-01-hybrid` package -To use this SDK in your project, you will need to install two packages. -- `@azure/arm-authorization-profile-2020-09-01-hybrid` that contains the client. -- `@azure/identity` that provides different mechanisms for the client to authenticate your requests using Azure Active Directory. +Install the Azure AuthorizationManagement client library for JavaScript with `npm`: -Install both packages using the below command: ```bash -npm install --save @azure/arm-authorization-profile-2020-09-01-hybrid @azure/identity +npm install @azure/arm-authorization-profile-2020-09-01-hybrid ``` -> **Note**: You may have used either `@azure/ms-rest-nodeauth` or `@azure/ms-rest-browserauth` in the past. These packages are in maintenance mode receiving critical bug fixes, but no new features. -If you are on a [Node.js that has LTS status](https://nodejs.org/about/releases/), or are writing a client side browser application, we strongly encourage you to upgrade to `@azure/identity` which uses the latest versions of Azure Active Directory and MSAL APIs and provides more authentication options. +### Create and authenticate a `AuthorizationManagementClient` -### How to use +To create a client object to access the Azure AuthorizationManagement API, you will need the `endpoint` of your Azure AuthorizationManagement resource and a `credential`. The Azure AuthorizationManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure AuthorizationManagement resource in the [Azure Portal][azure_portal]. -- If you are writing a client side browser application, - - Follow the instructions in the section on Authenticating client side browser applications in [Azure Identity examples](https://aka.ms/azsdk/js/identity/examples) to register your application in the Microsoft identity platform and set the right permissions. - - Copy the client ID and tenant ID from the Overview section of your app registration in Azure portal and use it in the browser sample below. -- If you are writing a server side application, - - [Select a credential from `@azure/identity` based on the authentication method of your choice](https://aka.ms/azsdk/js/identity/examples) - - Complete the set up steps required by the credential if any. - - Use the credential you picked in the place of `DefaultAzureCredential` in the Node.js sample below. +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). -In the below samples, we pass the credential and the Azure subscription id to instantiate the client. -Once the client is created, explore the operations on it either in your favorite editor or in our [API reference documentation](https://docs.microsoft.com/javascript/api) to get started. +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` -#### nodejs - Authentication, client creation, and listForResourceGroup permissions as an example written in JavaScript. +You will also need to **register a new AAD application and grant access to Azure AuthorizationManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -##### Sample code +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript -const { DefaultAzureCredential } = require("@azure/identity"); const { AuthorizationManagementClient } = require("@azure/arm-authorization-profile-2020-09-01-hybrid"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -// Use `DefaultAzureCredential` or any other credential of your choice based on https://aka.ms/azsdk/js/identity/examples -// Please note that you can also use credentials from the `@azure/ms-rest-nodeauth` package instead. -const creds = new DefaultAzureCredential(); -const client = new AuthorizationManagementClient(creds, subscriptionId); -const resourceGroupName = "testresourceGroupName"; -client.permissions.listForResourceGroup(resourceGroupName).then((result) => { - console.log("The result is:"); - console.log(result); -}).catch((err) => { - console.log("An error occurred:"); - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new AuthorizationManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new AuthorizationManagementClient(credential, subscriptionId); ``` -#### browser - Authentication, client creation, and listForResourceGroup permissions as an example written in JavaScript. - -In browser applications, we recommend using the `InteractiveBrowserCredential` that interactively authenticates using the default system browser. - - See [Single-page application: App registration guide](https://docs.microsoft.com/azure/active-directory/develop/scenario-spa-app-registration) to configure your app registration for the browser. - - Note down the client Id from the previous step and use it in the browser sample below. - -##### Sample code - -- index.html - -```html - - - - @azure/arm-authorization-profile-2020-09-01-hybrid sample - - - - - - - + +### 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 + +### AuthorizationManagementClient + +`AuthorizationManagementClient` is the primary interface for developers using the Azure AuthorizationManagement client library. Explore the methods on this client object to understand the different features of the Azure AuthorizationManagement service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); ``` +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fauthorization%2Farm-authorization-profile-2020-09-01-hybrid%2FREADME.png) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/README.png) +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/_meta.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/_meta.json new file mode 100644 index 000000000000..4a5f7171ff52 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "1067b78669466324a1a2666adf053433c61e7f77", + "readme": "specification/authorization/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=D:\\mydev\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\authorization\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-beta.16 --tag=profile-hybrid-2020-09-01 --profile-content=profile-hybrid-2020-09-01", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.1.1", + "use": "@autorest/typescript@6.0.0-beta.16" +} \ No newline at end of file diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/api-extractor.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/api-extractor.json new file mode 100644 index 000000000000..d2a91056b933 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-authorization-profile-2020-09-01-hybrid.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/authorization/arm-authorization-profile-2020-09-01-hybrid/package.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/package.json index 116c9e399a91..646efda949cd 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/package.json +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/package.json @@ -1,13 +1,18 @@ { "name": "@azure/arm-authorization-profile-2020-09-01-hybrid", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "AuthorizationManagementClient Library with typescript type definitions for node.js and browser.", - "version": "1.1.0", + "description": "A generated SDK for AuthorizationManagementClient.", + "version": "2.0.0", + "engines": { + "node": ">=12.0.0" + }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.1.0", - "@azure/ms-rest-js": "^2.2.0", - "@azure/core-auth": "^1.1.4", - "tslib": "^1.10.0" + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, "keywords": [ "node", @@ -17,15 +22,25 @@ "isomorphic" ], "license": "MIT", - "main": "./dist/arm-authorization-profile-2020-09-01-hybrid.js", - "module": "./esm/authorizationManagementClient.js", - "types": "./esm/authorizationManagementClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-authorization-profile-2020-09-01-hybrid.d.ts", "devDependencies": { - "typescript": "^3.6.0", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "@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": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid", "repository": { @@ -40,20 +55,54 @@ "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.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" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-authorization-profile-2020-09-01-hybrid.js.map'\" -o ./dist/arm-authorization-profile-2020-09-01-hybrid.min.js ./dist/arm-authorization-profile-2020-09-01-hybrid.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/authorizationManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, "autoPublish": true -} +} \ No newline at end of file diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 000000000000..0f6ecb857acf --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/review/arm-authorization-profile-2020-09-01-hybrid.api.md b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/review/arm-authorization-profile-2020-09-01-hybrid.api.md new file mode 100644 index 000000000000..061f338972a7 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/review/arm-authorization-profile-2020-09-01-hybrid.api.md @@ -0,0 +1,412 @@ +## API Report File for "@azure/arm-authorization-profile-2020-09-01-hybrid" + +> 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 (undocumented) +export class AuthorizationManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AuthorizationManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + globalAdministrator: GlobalAdministrator; + // (undocumented) + permissions: Permissions_2; + // (undocumented) + providerOperationsMetadataOperations: ProviderOperationsMetadataOperations; + // (undocumented) + roleAssignments: RoleAssignments; + // (undocumented) + roleDefinitions: RoleDefinitions; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface AuthorizationManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface GlobalAdministrator { + elevateAccess(options?: GlobalAdministratorElevateAccessOptionalParams): Promise; +} + +// @public +export interface GlobalAdministratorElevateAccessOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface Permission { + actions?: string[]; + notActions?: string[]; +} + +// @public +export interface PermissionGetResult { + nextLink?: string; + value?: Permission[]; +} + +// @public +interface Permissions_2 { + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: PermissionsListForResourceOptionalParams): PagedAsyncIterableIterator; + listForResourceGroup(resourceGroupName: string, options?: PermissionsListForResourceGroupOptionalParams): PagedAsyncIterableIterator; +} +export { Permissions_2 as Permissions } + +// @public +export interface PermissionsListForResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PermissionsListForResourceGroupNextResponse = PermissionGetResult; + +// @public +export interface PermissionsListForResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PermissionsListForResourceGroupResponse = PermissionGetResult; + +// @public +export interface PermissionsListForResourceNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PermissionsListForResourceNextResponse = PermissionGetResult; + +// @public +export interface PermissionsListForResourceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PermissionsListForResourceResponse = PermissionGetResult; + +// @public +export interface ProviderOperation { + description?: string; + displayName?: string; + name?: string; + origin?: string; + properties?: Record; +} + +// @public +export interface ProviderOperationsMetadata { + displayName?: string; + id?: string; + name?: string; + operations?: ProviderOperation[]; + resourceTypes?: ResourceType[]; + type?: string; +} + +// @public +export interface ProviderOperationsMetadataGetOptionalParams extends coreClient.OperationOptions { + expand?: string; +} + +// @public +export type ProviderOperationsMetadataGetResponse = ProviderOperationsMetadata; + +// @public +export interface ProviderOperationsMetadataListNextOptionalParams extends coreClient.OperationOptions { + expand?: string; +} + +// @public +export type ProviderOperationsMetadataListNextResponse = ProviderOperationsMetadataListResult; + +// @public +export interface ProviderOperationsMetadataListOptionalParams extends coreClient.OperationOptions { + expand?: string; +} + +// @public +export type ProviderOperationsMetadataListResponse = ProviderOperationsMetadataListResult; + +// @public +export interface ProviderOperationsMetadataListResult { + nextLink?: string; + value?: ProviderOperationsMetadata[]; +} + +// @public +export interface ProviderOperationsMetadataOperations { + get(resourceProviderNamespace: string, options?: ProviderOperationsMetadataGetOptionalParams): Promise; + list(options?: ProviderOperationsMetadataListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ResourceType { + displayName?: string; + name?: string; + operations?: ProviderOperation[]; +} + +// @public +export interface RoleAssignment { + readonly id?: string; + readonly name?: string; + properties?: RoleAssignmentPropertiesWithScope; + readonly type?: string; +} + +// @public +export interface RoleAssignmentCreateParameters { + properties: RoleAssignmentProperties; +} + +// @public +export interface RoleAssignmentFilter { + principalId?: string; +} + +// @public +export interface RoleAssignmentListResult { + nextLink?: string; + value?: RoleAssignment[]; +} + +// @public +export interface RoleAssignmentProperties { + principalId: string; + roleDefinitionId: string; +} + +// @public +export interface RoleAssignmentPropertiesWithScope { + principalId?: string; + roleDefinitionId?: string; + scope?: string; +} + +// @public +export interface RoleAssignments { + create(scope: string, roleAssignmentName: string, parameters: RoleAssignmentCreateParameters, options?: RoleAssignmentsCreateOptionalParams): Promise; + createById(roleAssignmentId: string, parameters: RoleAssignmentCreateParameters, options?: RoleAssignmentsCreateByIdOptionalParams): Promise; + delete(scope: string, roleAssignmentName: string, options?: RoleAssignmentsDeleteOptionalParams): Promise; + deleteById(roleAssignmentId: string, options?: RoleAssignmentsDeleteByIdOptionalParams): Promise; + get(scope: string, roleAssignmentName: string, options?: RoleAssignmentsGetOptionalParams): Promise; + getById(roleAssignmentId: string, options?: RoleAssignmentsGetByIdOptionalParams): Promise; + list(options?: RoleAssignmentsListOptionalParams): PagedAsyncIterableIterator; + listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: RoleAssignmentsListForResourceOptionalParams): PagedAsyncIterableIterator; + listForResourceGroup(resourceGroupName: string, options?: RoleAssignmentsListForResourceGroupOptionalParams): PagedAsyncIterableIterator; + listForScope(scope: string, options?: RoleAssignmentsListForScopeOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface RoleAssignmentsCreateByIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleAssignmentsCreateByIdResponse = RoleAssignment; + +// @public +export interface RoleAssignmentsCreateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleAssignmentsCreateResponse = RoleAssignment; + +// @public +export interface RoleAssignmentsDeleteByIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleAssignmentsDeleteByIdResponse = RoleAssignment; + +// @public +export interface RoleAssignmentsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleAssignmentsDeleteResponse = RoleAssignment; + +// @public +export interface RoleAssignmentsGetByIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleAssignmentsGetByIdResponse = RoleAssignment; + +// @public +export interface RoleAssignmentsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleAssignmentsGetResponse = RoleAssignment; + +// @public +export interface RoleAssignmentsListForResourceGroupNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleAssignmentsListForResourceGroupNextResponse = RoleAssignmentListResult; + +// @public +export interface RoleAssignmentsListForResourceGroupOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleAssignmentsListForResourceGroupResponse = RoleAssignmentListResult; + +// @public +export interface RoleAssignmentsListForResourceNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleAssignmentsListForResourceNextResponse = RoleAssignmentListResult; + +// @public +export interface RoleAssignmentsListForResourceOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleAssignmentsListForResourceResponse = RoleAssignmentListResult; + +// @public +export interface RoleAssignmentsListForScopeNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleAssignmentsListForScopeNextResponse = RoleAssignmentListResult; + +// @public +export interface RoleAssignmentsListForScopeOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleAssignmentsListForScopeResponse = RoleAssignmentListResult; + +// @public +export interface RoleAssignmentsListNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleAssignmentsListNextResponse = RoleAssignmentListResult; + +// @public +export interface RoleAssignmentsListOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleAssignmentsListResponse = RoleAssignmentListResult; + +// @public +export interface RoleDefinition { + assignableScopes?: string[]; + description?: string; + readonly id?: string; + readonly name?: string; + permissions?: Permission[]; + roleName?: string; + roleType?: string; + readonly type?: string; +} + +// @public +export interface RoleDefinitionFilter { + roleName?: string; +} + +// @public +export interface RoleDefinitionListResult { + nextLink?: string; + value?: RoleDefinition[]; +} + +// @public +export interface RoleDefinitions { + createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: RoleDefinition, options?: RoleDefinitionsCreateOrUpdateOptionalParams): Promise; + delete(scope: string, roleDefinitionId: string, options?: RoleDefinitionsDeleteOptionalParams): Promise; + get(scope: string, roleDefinitionId: string, options?: RoleDefinitionsGetOptionalParams): Promise; + getById(roleDefinitionId: string, options?: RoleDefinitionsGetByIdOptionalParams): Promise; + list(scope: string, options?: RoleDefinitionsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface RoleDefinitionsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleDefinitionsCreateOrUpdateResponse = RoleDefinition; + +// @public +export interface RoleDefinitionsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleDefinitionsDeleteResponse = RoleDefinition; + +// @public +export interface RoleDefinitionsGetByIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleDefinitionsGetByIdResponse = RoleDefinition; + +// @public +export interface RoleDefinitionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RoleDefinitionsGetResponse = RoleDefinition; + +// @public +export interface RoleDefinitionsListNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleDefinitionsListNextResponse = RoleDefinitionListResult; + +// @public +export interface RoleDefinitionsListOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type RoleDefinitionsListResponse = RoleDefinitionListResult; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/rollup.config.js b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/rollup.config.js index 1c737a56e8f3..3f89d7309da5 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/rollup.config.js +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/rollup.config.js @@ -1,37 +1,122 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; +/* + * 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]; /** - * @type {rollup.RollupFileOptions} + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. */ -const config = { - input: "./esm/authorizationManagementClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-authorization-profile-2020-09-01-hybrid.js", - format: "umd", - name: "Azure.ArmAuthorizationProfile20200901Hybrid", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" +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/**"] }, - banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + 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 default config; +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/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClient.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClient.ts index 2164fe797036..b3065902007c 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClient.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClient.ts @@ -1,56 +1,97 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import { TokenCredential } from "@azure/core-auth"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { AuthorizationManagementClientContext } from "./authorizationManagementClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + PermissionsImpl, + RoleDefinitionsImpl, + ProviderOperationsMetadataOperationsImpl, + GlobalAdministratorImpl, + RoleAssignmentsImpl +} from "./operations"; +import { + Permissions, + RoleDefinitions, + ProviderOperationsMetadataOperations, + GlobalAdministrator, + RoleAssignments +} from "./operationsInterfaces"; +import { AuthorizationManagementClientOptionalParams } from "./models"; - -class AuthorizationManagementClient extends AuthorizationManagementClientContext { - // Operation groups - permissions: operations.Permissions; - roleDefinitions: operations.RoleDefinitions; - providerOperationsMetadata: operations.ProviderOperationsMetadataOperations; - globalAdministrator: operations.GlobalAdministrator; - roleAssignments: operations.RoleAssignments; +export class AuthorizationManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; /** * Initializes a new instance of the AuthorizationManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. Credentials - * implementing the TokenCredential interface from the @azure/identity package are recommended. For - * more information about these credentials, see - * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the - * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and - * @azure/ms-rest-browserauth are also supported. + * @param credentials Subscription credentials which uniquely identify client subscription. * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.AuthorizationManagementClientOptions) { - super(credentials, subscriptionId, options); - this.permissions = new operations.Permissions(this); - this.roleDefinitions = new operations.RoleDefinitions(this); - this.providerOperationsMetadata = new operations.ProviderOperationsMetadataOperations(this); - this.globalAdministrator = new operations.GlobalAdministrator(this); - this.roleAssignments = new operations.RoleAssignments(this); - } -} + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: AuthorizationManagementClientOptionalParams + ) { + 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: AuthorizationManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; -// Operation Specifications + const packageDetails = `azsdk-js-arm-authorization-profile-2020-09-01-hybrid/2.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; -export { - AuthorizationManagementClient, - AuthorizationManagementClientContext, - Models as AuthorizationManagementModels, - Mappers as AuthorizationManagementMappers -}; -export * from "./operations"; + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2015-07-01"; + this.permissions = new PermissionsImpl(this); + this.roleDefinitions = new RoleDefinitionsImpl(this); + this.providerOperationsMetadataOperations = new ProviderOperationsMetadataOperationsImpl( + this + ); + this.globalAdministrator = new GlobalAdministratorImpl(this); + this.roleAssignments = new RoleAssignmentsImpl(this); + } + + permissions: Permissions; + roleDefinitions: RoleDefinitions; + providerOperationsMetadataOperations: ProviderOperationsMetadataOperations; + globalAdministrator: GlobalAdministrator; + roleAssignments: RoleAssignments; +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClientContext.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClientContext.ts deleted file mode 100644 index 624b843cabad..000000000000 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/authorizationManagementClientContext.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import { TokenCredential } from "@azure/core-auth"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-authorization-profile-2020-09-01-hybrid"; -const packageVersion = "1.1.0"; - -export class AuthorizationManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials | TokenCredential; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the AuthorizationManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. Credentials - * implementing the TokenCredential interface from the @azure/identity package are recommended. For - * more information about these credentials, see - * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the - * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and - * @azure/ms-rest-browserauth are also supported. - * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.AuthorizationManagementClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2015-07-01'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/index.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/index.ts new file mode 100644 index 000000000000..bfd87d5d1ad6 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/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 { AuthorizationManagementClient } from "./authorizationManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/globalAdministratorMappers.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/globalAdministratorMappers.ts deleted file mode 100644 index 67c5a45e0449..000000000000 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/globalAdministratorMappers.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - CloudError -} from "../models/mappers"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/index.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/index.ts index 8e3eab0ee180..c080c2a3f843 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/index.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/index.ts @@ -1,903 +1,467 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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 { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +/** Permissions information. */ +export interface PermissionGetResult { + /** An array of permissions. */ + value?: Permission[]; + /** The URL to use for getting the next set of results. */ + nextLink?: string; +} -/** - * Role Definitions filter - */ -export interface RoleDefinitionFilter { +/** Role definition permissions. */ +export interface Permission { + /** Allowed actions. */ + actions?: string[]; + /** Denied actions. */ + notActions?: string[]; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { /** - * Returns role definition with the specific name. + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - roleName?: string; + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; } -/** - * Role definition permissions. - */ -export interface Permission { +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { /** - * Allowed actions. + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - actions?: string[]; + readonly type?: string; /** - * Denied actions. + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - notActions?: string[]; + readonly info?: Record; } -/** - * Role definition. - */ +/** Role definition. */ export interface RoleDefinition { /** * The role definition ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; /** * The role definition name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * The role definition type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; - /** - * The role name. - */ + /** The role name. */ roleName?: string; - /** - * The role definition description. - */ + /** The role definition description. */ description?: string; - /** - * The role type. - */ + /** The role type. */ roleType?: string; - /** - * Role definition permissions. - */ + /** Role definition permissions. */ permissions?: Permission[]; - /** - * Role definition assignable scopes. - */ + /** Role definition assignable scopes. */ assignableScopes?: string[]; } -/** - * Operation - */ -export interface ProviderOperation { - /** - * The operation name. - */ +/** Role definition list operation result. */ +export interface RoleDefinitionListResult { + /** Role definition list. */ + value?: RoleDefinition[]; + /** The URL to use for getting the next set of results. */ + nextLink?: string; +} + +/** Provider Operations metadata */ +export interface ProviderOperationsMetadata { + /** The provider id. */ + id?: string; + /** The provider name. */ name?: string; - /** - * The operation display name. - */ + /** The provider type. */ + type?: string; + /** The provider display name. */ displayName?: string; - /** - * The operation description. - */ - description?: string; - /** - * The operation origin. - */ - origin?: string; - /** - * The operation properties. - */ - properties?: any; + /** The provider resource types */ + resourceTypes?: ResourceType[]; + /** The provider operations. */ + operations?: ProviderOperation[]; } -/** - * Resource Type - */ +/** Resource Type */ export interface ResourceType { - /** - * The resource type name. - */ + /** The resource type name. */ name?: string; - /** - * The resource type display name. - */ + /** The resource type display name. */ displayName?: string; - /** - * The resource type operations. - */ + /** The resource type operations. */ operations?: ProviderOperation[]; } -/** - * Provider Operations metadata - */ -export interface ProviderOperationsMetadata { - /** - * The provider id. - */ - id?: string; - /** - * The provider name. - */ +/** Operation */ +export interface ProviderOperation { + /** The operation name. */ name?: string; - /** - * The provider type. - */ - type?: string; - /** - * The provider display name. - */ + /** The operation display name. */ displayName?: string; - /** - * The provider resource types - */ - resourceTypes?: ResourceType[]; - /** - * The provider operations. - */ - operations?: ProviderOperation[]; + /** The operation description. */ + description?: string; + /** The operation origin. */ + origin?: string; + /** The operation properties. */ + properties?: Record; } -/** - * Role Assignments filter - */ -export interface RoleAssignmentFilter { - /** - * Returns role assignment of the specific principal. - */ - principalId?: string; +/** Provider operations metadata list */ +export interface ProviderOperationsMetadataListResult { + /** The list of providers. */ + value?: ProviderOperationsMetadata[]; + /** The URL to use for getting the next set of results. */ + nextLink?: string; } -/** - * Role assignment properties with scope. - */ -export interface RoleAssignmentPropertiesWithScope { - /** - * The role assignment scope. - */ - scope?: string; - /** - * The role definition ID. - */ - roleDefinitionId?: string; - /** - * The principal ID. - */ - principalId?: string; +/** Role assignment list operation result. */ +export interface RoleAssignmentListResult { + /** Role assignment list. */ + value?: RoleAssignment[]; + /** The URL to use for getting the next set of results. */ + nextLink?: string; } -/** - * Role Assignments - */ +/** Role Assignments */ export interface RoleAssignment { /** * The role assignment ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; /** * The role assignment name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * The role assignment type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; - /** - * Role assignment properties. - */ + /** Role assignment properties. */ properties?: RoleAssignmentPropertiesWithScope; } -/** - * Role assignment properties. - */ +/** Role assignment properties with scope. */ +export interface RoleAssignmentPropertiesWithScope { + /** The role assignment scope. */ + scope?: string; + /** The role definition ID. */ + roleDefinitionId?: string; + /** The principal ID. */ + principalId?: string; +} + +/** Role assignment create parameters. */ +export interface RoleAssignmentCreateParameters { + /** Role assignment properties. */ + properties: RoleAssignmentProperties; +} + +/** Role assignment properties. */ export interface RoleAssignmentProperties { - /** - * The role definition ID used in the role assignment. - */ + /** The role definition ID used in the role assignment. */ roleDefinitionId: string; - /** - * The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can - * point to a user, service principal, or security group. - */ + /** The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. */ principalId: string; } -/** - * Role assignment create parameters. - */ -export interface RoleAssignmentCreateParameters { - /** - * Role assignment properties. - */ - properties: RoleAssignmentProperties; +/** Role Definitions filter */ +export interface RoleDefinitionFilter { + /** Returns role definition with the specific name. */ + roleName?: string; } -/** - * Optional Parameters. - */ -export interface RoleDefinitionsListOptionalParams extends msRest.RequestOptionsBase { - /** - * The filter to apply on the operation. Use atScopeAndBelow filter to search below the given - * scope as well. - */ +/** Role Assignments filter */ +export interface RoleAssignmentFilter { + /** Returns role assignment of the specific principal. */ + principalId?: string; +} + +/** Optional parameters. */ +export interface PermissionsListForResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listForResourceGroup operation. */ +export type PermissionsListForResourceGroupResponse = PermissionGetResult; + +/** Optional parameters. */ +export interface PermissionsListForResourceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listForResource operation. */ +export type PermissionsListForResourceResponse = PermissionGetResult; + +/** Optional parameters. */ +export interface PermissionsListForResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listForResourceGroupNext operation. */ +export type PermissionsListForResourceGroupNextResponse = PermissionGetResult; + +/** Optional parameters. */ +export interface PermissionsListForResourceNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listForResourceNext operation. */ +export type PermissionsListForResourceNextResponse = PermissionGetResult; + +/** Optional parameters. */ +export interface RoleDefinitionsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type RoleDefinitionsDeleteResponse = RoleDefinition; + +/** Optional parameters. */ +export interface RoleDefinitionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type RoleDefinitionsGetResponse = RoleDefinition; + +/** Optional parameters. */ +export interface RoleDefinitionsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type RoleDefinitionsCreateOrUpdateResponse = RoleDefinition; + +/** Optional parameters. */ +export interface RoleDefinitionsListOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. */ filter?: string; } -/** - * Optional Parameters. - */ -export interface ProviderOperationsMetadataGetOptionalParams extends msRest.RequestOptionsBase { - /** - * Specifies whether to expand the values. Default value: 'resourceTypes'. - */ +/** Contains response data for the list operation. */ +export type RoleDefinitionsListResponse = RoleDefinitionListResult; + +/** Optional parameters. */ +export interface RoleDefinitionsGetByIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getById operation. */ +export type RoleDefinitionsGetByIdResponse = RoleDefinition; + +/** Optional parameters. */ +export interface RoleDefinitionsListNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as well. */ + filter?: string; +} + +/** Contains response data for the listNext operation. */ +export type RoleDefinitionsListNextResponse = RoleDefinitionListResult; + +/** Optional parameters. */ +export interface ProviderOperationsMetadataGetOptionalParams + extends coreClient.OperationOptions { + /** Specifies whether to expand the values. */ expand?: string; } -/** - * Optional Parameters. - */ -export interface ProviderOperationsMetadataListOptionalParams extends msRest.RequestOptionsBase { - /** - * Specifies whether to expand the values. Default value: 'resourceTypes'. - */ +/** Contains response data for the get operation. */ +export type ProviderOperationsMetadataGetResponse = ProviderOperationsMetadata; + +/** Optional parameters. */ +export interface ProviderOperationsMetadataListOptionalParams + extends coreClient.OperationOptions { + /** Specifies whether to expand the values. */ expand?: string; } -/** - * Optional Parameters. - */ -export interface RoleAssignmentsListForResourceOptionalParams extends msRest.RequestOptionsBase { - /** - * The filter to apply on the operation. Use $filter=atScope() to return all role assignments at - * or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above - * or below the scope for the specified principal. - */ - filter?: string; +/** Contains response data for the list operation. */ +export type ProviderOperationsMetadataListResponse = ProviderOperationsMetadataListResult; + +/** Optional parameters. */ +export interface ProviderOperationsMetadataListNextOptionalParams + extends coreClient.OperationOptions { + /** Specifies whether to expand the values. */ + expand?: string; } -/** - * Optional Parameters. - */ -export interface RoleAssignmentsListForResourceGroupOptionalParams extends msRest.RequestOptionsBase { - /** - * The filter to apply on the operation. Use $filter=atScope() to return all role assignments at - * or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above - * or below the scope for the specified principal. - */ +/** Contains response data for the listNext operation. */ +export type ProviderOperationsMetadataListNextResponse = ProviderOperationsMetadataListResult; + +/** Optional parameters. */ +export interface GlobalAdministratorElevateAccessOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface RoleAssignmentsListForResourceOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ filter?: string; } -/** - * Optional Parameters. - */ -export interface RoleAssignmentsListOptionalParams extends msRest.RequestOptionsBase { - /** - * The filter to apply on the operation. Use $filter=atScope() to return all role assignments at - * or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above - * or below the scope for the specified principal. - */ +/** Contains response data for the listForResource operation. */ +export type RoleAssignmentsListForResourceResponse = RoleAssignmentListResult; + +/** Optional parameters. */ +export interface RoleAssignmentsListForResourceGroupOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ filter?: string; } -/** - * Optional Parameters. - */ -export interface RoleAssignmentsListForScopeOptionalParams extends msRest.RequestOptionsBase { - /** - * The filter to apply on the operation. Use $filter=atScope() to return all role assignments at - * or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above - * or below the scope for the specified principal. - */ +/** Contains response data for the listForResourceGroup operation. */ +export type RoleAssignmentsListForResourceGroupResponse = RoleAssignmentListResult; + +/** Optional parameters. */ +export interface RoleAssignmentsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type RoleAssignmentsDeleteResponse = RoleAssignment; + +/** Optional parameters. */ +export interface RoleAssignmentsCreateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the create operation. */ +export type RoleAssignmentsCreateResponse = RoleAssignment; + +/** Optional parameters. */ +export interface RoleAssignmentsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type RoleAssignmentsGetResponse = RoleAssignment; + +/** Optional parameters. */ +export interface RoleAssignmentsDeleteByIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the deleteById operation. */ +export type RoleAssignmentsDeleteByIdResponse = RoleAssignment; + +/** Optional parameters. */ +export interface RoleAssignmentsCreateByIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createById operation. */ +export type RoleAssignmentsCreateByIdResponse = RoleAssignment; + +/** Optional parameters. */ +export interface RoleAssignmentsGetByIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getById operation. */ +export type RoleAssignmentsGetByIdResponse = RoleAssignment; + +/** Optional parameters. */ +export interface RoleAssignmentsListOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ filter?: string; } -/** - * An interface representing AuthorizationManagementClientOptions. - */ -export interface AuthorizationManagementClientOptions extends AzureServiceClientOptions { - baseUri?: string; +/** Contains response data for the list operation. */ +export type RoleAssignmentsListResponse = RoleAssignmentListResult; + +/** Optional parameters. */ +export interface RoleAssignmentsListForScopeOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ + filter?: string; } -/** - * @interface - * Permissions information. - * @extends Array - */ -export interface PermissionGetResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; +/** Contains response data for the listForScope operation. */ +export type RoleAssignmentsListForScopeResponse = RoleAssignmentListResult; + +/** Optional parameters. */ +export interface RoleAssignmentsListForResourceNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ + filter?: string; } -/** - * @interface - * Role definition list operation result. - * @extends Array - */ -export interface RoleDefinitionListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; +/** Contains response data for the listForResourceNext operation. */ +export type RoleAssignmentsListForResourceNextResponse = RoleAssignmentListResult; + +/** Optional parameters. */ +export interface RoleAssignmentsListForResourceGroupNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ + filter?: string; } -/** - * @interface - * Provider operations metadata list - * @extends Array - */ -export interface ProviderOperationsMetadataListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; +/** Contains response data for the listForResourceGroupNext operation. */ +export type RoleAssignmentsListForResourceGroupNextResponse = RoleAssignmentListResult; + +/** Optional parameters. */ +export interface RoleAssignmentsListNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ + filter?: string; } -/** - * @interface - * Role assignment list operation result. - * @extends Array - */ -export interface RoleAssignmentListResult extends Array { - /** - * The URL to use for getting the next set of results. - */ - nextLink?: string; +/** Contains response data for the listNext operation. */ +export type RoleAssignmentsListNextResponse = RoleAssignmentListResult; + +/** Optional parameters. */ +export interface RoleAssignmentsListForScopeNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal. */ + filter?: string; } -/** - * Contains response data for the listForResourceGroup operation. - */ -export type PermissionsListForResourceGroupResponse = PermissionGetResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PermissionGetResult; - }; -}; - -/** - * Contains response data for the listForResource operation. - */ -export type PermissionsListForResourceResponse = PermissionGetResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PermissionGetResult; - }; -}; - -/** - * Contains response data for the listForResourceGroupNext operation. - */ -export type PermissionsListForResourceGroupNextResponse = PermissionGetResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PermissionGetResult; - }; -}; - -/** - * Contains response data for the listForResourceNext operation. - */ -export type PermissionsListForResourceNextResponse = PermissionGetResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PermissionGetResult; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type RoleDefinitionsDeleteMethodResponse = RoleDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleDefinition; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type RoleDefinitionsGetResponse = RoleDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleDefinition; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type RoleDefinitionsCreateOrUpdateResponse = RoleDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleDefinition; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type RoleDefinitionsListResponse = RoleDefinitionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleDefinitionListResult; - }; -}; - -/** - * Contains response data for the getById operation. - */ -export type RoleDefinitionsGetByIdResponse = RoleDefinition & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleDefinition; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type RoleDefinitionsListNextResponse = RoleDefinitionListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleDefinitionListResult; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type ProviderOperationsMetadataGetResponse = ProviderOperationsMetadata & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ProviderOperationsMetadata; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type ProviderOperationsMetadataListResponse = ProviderOperationsMetadataListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ProviderOperationsMetadataListResult; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type ProviderOperationsMetadataListNextResponse = ProviderOperationsMetadataListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ProviderOperationsMetadataListResult; - }; -}; - -/** - * Contains response data for the listForResource operation. - */ -export type RoleAssignmentsListForResourceResponse = RoleAssignmentListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignmentListResult; - }; -}; - -/** - * Contains response data for the listForResourceGroup operation. - */ -export type RoleAssignmentsListForResourceGroupResponse = RoleAssignmentListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignmentListResult; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type RoleAssignmentsDeleteMethodResponse = RoleAssignment & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignment; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type RoleAssignmentsCreateResponse = RoleAssignment & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignment; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type RoleAssignmentsGetResponse = RoleAssignment & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignment; - }; -}; - -/** - * Contains response data for the deleteById operation. - */ -export type RoleAssignmentsDeleteByIdResponse = RoleAssignment & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignment; - }; -}; - -/** - * Contains response data for the createById operation. - */ -export type RoleAssignmentsCreateByIdResponse = RoleAssignment & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignment; - }; -}; - -/** - * Contains response data for the getById operation. - */ -export type RoleAssignmentsGetByIdResponse = RoleAssignment & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignment; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type RoleAssignmentsListResponse = RoleAssignmentListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignmentListResult; - }; -}; - -/** - * Contains response data for the listForScope operation. - */ -export type RoleAssignmentsListForScopeResponse = RoleAssignmentListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignmentListResult; - }; -}; - -/** - * Contains response data for the listForResourceNext operation. - */ -export type RoleAssignmentsListForResourceNextResponse = RoleAssignmentListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignmentListResult; - }; -}; - -/** - * Contains response data for the listForResourceGroupNext operation. - */ -export type RoleAssignmentsListForResourceGroupNextResponse = RoleAssignmentListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignmentListResult; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type RoleAssignmentsListNextResponse = RoleAssignmentListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignmentListResult; - }; -}; - -/** - * Contains response data for the listForScopeNext operation. - */ -export type RoleAssignmentsListForScopeNextResponse = RoleAssignmentListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RoleAssignmentListResult; - }; -}; +/** Contains response data for the listForScopeNext operation. */ +export type RoleAssignmentsListForScopeNextResponse = RoleAssignmentListResult; + +/** Optional parameters. */ +export interface AuthorizationManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/mappers.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/mappers.ts index 1b7da97f1522..b7563b89b7f1 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/mappers.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/mappers.ts @@ -1,25 +1,32 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * 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 { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; - -export const RoleDefinitionFilter: msRest.CompositeMapper = { - serializedName: "RoleDefinitionFilter", +export const PermissionGetResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "RoleDefinitionFilter", + className: "PermissionGetResult", modelProperties: { - roleName: { - serializedName: "roleName", + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Permission" + } + } + } + }, + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -28,8 +35,7 @@ export const RoleDefinitionFilter: msRest.CompositeMapper = { } }; -export const Permission: msRest.CompositeMapper = { - serializedName: "Permission", +export const Permission: coreClient.CompositeMapper = { type: { name: "Composite", className: "Permission", @@ -60,29 +66,124 @@ export const Permission: msRest.CompositeMapper = { } }; -export const RoleDefinition: msRest.CompositeMapper = { - serializedName: "RoleDefinition", +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const RoleDefinition: coreClient.CompositeMapper = { type: { name: "Composite", className: "RoleDefinition", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, type: { - readOnly: true, serializedName: "type", + readOnly: true, type: { name: "String" } @@ -132,48 +233,91 @@ export const RoleDefinition: msRest.CompositeMapper = { } }; -export const ProviderOperation: msRest.CompositeMapper = { - serializedName: "ProviderOperation", +export const RoleDefinitionListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ProviderOperation", + className: "RoleDefinitionListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RoleDefinition" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ProviderOperationsMetadata: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProviderOperationsMetadata", modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, name: { serializedName: "name", type: { name: "String" } }, - displayName: { - serializedName: "displayName", + type: { + serializedName: "type", type: { name: "String" } }, - description: { - serializedName: "description", + displayName: { + serializedName: "displayName", type: { name: "String" } }, - origin: { - serializedName: "origin", + resourceTypes: { + serializedName: "resourceTypes", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceType" + } + } } }, - properties: { - serializedName: "properties", + operations: { + serializedName: "operations", type: { - name: "Object" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProviderOperation" + } + } } } } } }; -export const ResourceType: msRest.CompositeMapper = { - serializedName: "ResourceType", +export const ResourceType: coreClient.CompositeMapper = { type: { name: "Composite", className: "ResourceType", @@ -206,72 +350,65 @@ export const ResourceType: msRest.CompositeMapper = { } }; -export const ProviderOperationsMetadata: msRest.CompositeMapper = { - serializedName: "ProviderOperationsMetadata", +export const ProviderOperation: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ProviderOperationsMetadata", + className: "ProviderOperation", modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, name: { serializedName: "name", type: { name: "String" } }, - type: { - serializedName: "type", + displayName: { + serializedName: "displayName", type: { name: "String" } }, - displayName: { - serializedName: "displayName", + description: { + serializedName: "description", type: { name: "String" } }, - resourceTypes: { - serializedName: "resourceTypes", + origin: { + serializedName: "origin", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourceType" - } - } + name: "String" } }, - operations: { - serializedName: "operations", + properties: { + serializedName: "properties", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ProviderOperation" - } - } + name: "Dictionary", + value: { type: { name: "any" } } } } } } }; -export const RoleAssignmentFilter: msRest.CompositeMapper = { - serializedName: "RoleAssignmentFilter", +export const ProviderOperationsMetadataListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "RoleAssignmentFilter", + className: "ProviderOperationsMetadataListResult", modelProperties: { - principalId: { - serializedName: "principalId", + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProviderOperationsMetadata" + } + } + } + }, + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -280,26 +417,25 @@ export const RoleAssignmentFilter: msRest.CompositeMapper = { } }; -export const RoleAssignmentPropertiesWithScope: msRest.CompositeMapper = { - serializedName: "RoleAssignmentPropertiesWithScope", +export const RoleAssignmentListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "RoleAssignmentPropertiesWithScope", + className: "RoleAssignmentListResult", modelProperties: { - scope: { - serializedName: "scope", - type: { - name: "String" - } - }, - roleDefinitionId: { - serializedName: "roleDefinitionId", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RoleAssignment" + } + } } }, - principalId: { - serializedName: "principalId", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -308,29 +444,28 @@ export const RoleAssignmentPropertiesWithScope: msRest.CompositeMapper = { } }; -export const RoleAssignment: msRest.CompositeMapper = { - serializedName: "RoleAssignment", +export const RoleAssignment: coreClient.CompositeMapper = { type: { name: "Composite", className: "RoleAssignment", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, type: { - readOnly: true, serializedName: "type", + readOnly: true, type: { name: "String" } @@ -346,21 +481,24 @@ export const RoleAssignment: msRest.CompositeMapper = { } }; -export const RoleAssignmentProperties: msRest.CompositeMapper = { - serializedName: "RoleAssignmentProperties", +export const RoleAssignmentPropertiesWithScope: coreClient.CompositeMapper = { type: { name: "Composite", - className: "RoleAssignmentProperties", + className: "RoleAssignmentPropertiesWithScope", modelProperties: { + scope: { + serializedName: "scope", + type: { + name: "String" + } + }, roleDefinitionId: { - required: true, serializedName: "roleDefinitionId", type: { name: "String" } }, principalId: { - required: true, serializedName: "principalId", type: { name: "String" @@ -370,14 +508,12 @@ export const RoleAssignmentProperties: msRest.CompositeMapper = { } }; -export const RoleAssignmentCreateParameters: msRest.CompositeMapper = { - serializedName: "RoleAssignmentCreateParameters", +export const RoleAssignmentCreateParameters: coreClient.CompositeMapper = { type: { name: "Composite", className: "RoleAssignmentCreateParameters", modelProperties: { properties: { - required: true, serializedName: "properties", type: { name: "Composite", @@ -388,54 +524,21 @@ export const RoleAssignmentCreateParameters: msRest.CompositeMapper = { } }; -export const PermissionGetResult: msRest.CompositeMapper = { - serializedName: "PermissionGetResult", +export const RoleAssignmentProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PermissionGetResult", + className: "RoleAssignmentProperties", modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Permission" - } - } - } - }, - nextLink: { - serializedName: "nextLink", + roleDefinitionId: { + serializedName: "roleDefinitionId", + required: true, type: { name: "String" } - } - } - } -}; - -export const RoleDefinitionListResult: msRest.CompositeMapper = { - serializedName: "RoleDefinitionListResult", - type: { - name: "Composite", - className: "RoleDefinitionListResult", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RoleDefinition" - } - } - } }, - nextLink: { - serializedName: "nextLink", + principalId: { + serializedName: "principalId", + required: true, type: { name: "String" } @@ -444,26 +547,13 @@ export const RoleDefinitionListResult: msRest.CompositeMapper = { } }; -export const ProviderOperationsMetadataListResult: msRest.CompositeMapper = { - serializedName: "ProviderOperationsMetadataListResult", +export const RoleDefinitionFilter: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ProviderOperationsMetadataListResult", + className: "RoleDefinitionFilter", modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ProviderOperationsMetadata" - } - } - } - }, - nextLink: { - serializedName: "nextLink", + roleName: { + serializedName: "roleName", type: { name: "String" } @@ -472,26 +562,13 @@ export const ProviderOperationsMetadataListResult: msRest.CompositeMapper = { } }; -export const RoleAssignmentListResult: msRest.CompositeMapper = { - serializedName: "RoleAssignmentListResult", +export const RoleAssignmentFilter: coreClient.CompositeMapper = { type: { name: "Composite", - className: "RoleAssignmentListResult", + className: "RoleAssignmentFilter", modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RoleAssignment" - } - } - } - }, - nextLink: { - serializedName: "nextLink", + principalId: { + serializedName: "principalId", type: { name: "String" } diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/parameters.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/parameters.ts index 060172be0451..b7716e7b4eb6 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/parameters.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/parameters.ts @@ -1,183 +1,241 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + RoleDefinition as RoleDefinitionMapper, + RoleAssignmentCreateParameters as RoleAssignmentCreateParametersMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", required: true, - serializedName: "api-version", type: { name: "String" } } }; -export const expand: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "expand" - ], + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", mapper: { - serializedName: "$expand", - defaultValue: 'resourceTypes', + defaultValue: "2015-07-01", + isConstant: true, + serializedName: "api-version", type: { name: "String" } } }; -export const filter: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "filter" - ], + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", mapper: { - serializedName: "$filter", + constraints: { + MinLength: 1 + }, + serializedName: "subscriptionId", + required: true, type: { name: "String" } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", + +export const resourceProviderNamespace: OperationURLParameter = { + parameterPath: "resourceProviderNamespace", mapper: { + serializedName: "resourceProviderNamespace", required: true, - serializedName: "nextLink", type: { name: "String" } - }, - skipEncoding: true + } }; -export const parentResourcePath: msRest.OperationURLParameter = { + +export const parentResourcePath: OperationURLParameter = { parameterPath: "parentResourcePath", mapper: { - required: true, serializedName: "parentResourcePath", + required: true, type: { name: "String" } }, skipEncoding: true }; -export const resourceGroupName: msRest.OperationURLParameter = { - parameterPath: "resourceGroupName", + +export const resourceType: OperationURLParameter = { + parameterPath: "resourceType", mapper: { + serializedName: "resourceType", required: true, - serializedName: "resourceGroupName", type: { name: "String" } - } + }, + skipEncoding: true }; -export const resourceName: msRest.OperationURLParameter = { + +export const resourceName: OperationURLParameter = { parameterPath: "resourceName", mapper: { - required: true, serializedName: "resourceName", + required: true, type: { name: "String" } } }; -export const resourceProviderNamespace: msRest.OperationURLParameter = { - parameterPath: "resourceProviderNamespace", + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { + serializedName: "nextLink", required: true, - serializedName: "resourceProviderNamespace", type: { name: "String" } - } + }, + skipEncoding: true }; -export const resourceType: msRest.OperationURLParameter = { - parameterPath: "resourceType", + +export const scope: OperationURLParameter = { + parameterPath: "scope", mapper: { + serializedName: "scope", required: true, - serializedName: "resourceType", type: { name: "String" } }, skipEncoding: true }; -export const roleAssignmentId: msRest.OperationURLParameter = { - parameterPath: "roleAssignmentId", + +export const roleDefinitionId: OperationURLParameter = { + parameterPath: "roleDefinitionId", mapper: { + serializedName: "roleDefinitionId", required: true, - serializedName: "roleAssignmentId", type: { name: "String" } - }, - skipEncoding: true + } }; -export const roleAssignmentName: msRest.OperationURLParameter = { - parameterPath: "roleAssignmentName", + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - required: true, - serializedName: "roleAssignmentName", + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const roleDefinitionId0: msRest.OperationURLParameter = { - parameterPath: "roleDefinitionId", + +export const roleDefinition: OperationParameter = { + parameterPath: "roleDefinition", + mapper: RoleDefinitionMapper +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], mapper: { - required: true, - serializedName: "roleDefinitionId", + serializedName: "$filter", type: { name: "String" } } }; -export const roleDefinitionId1: msRest.OperationURLParameter = { + +export const roleDefinitionId1: OperationURLParameter = { parameterPath: "roleDefinitionId", mapper: { - required: true, serializedName: "roleDefinitionId", + required: true, type: { name: "String" } }, skipEncoding: true }; -export const scope: msRest.OperationURLParameter = { - parameterPath: "scope", + +export const expand: OperationQueryParameter = { + parameterPath: ["options", "expand"], mapper: { - required: true, - serializedName: "scope", + defaultValue: "resourceTypes", + serializedName: "$expand", type: { name: "String" } - }, - skipEncoding: true + } }; -export const subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", + +export const roleAssignmentName: OperationURLParameter = { + parameterPath: "roleAssignmentName", mapper: { + serializedName: "roleAssignmentName", required: true, - serializedName: "subscriptionId", type: { name: "String" } } }; + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: RoleAssignmentCreateParametersMapper +}; + +export const roleAssignmentId: OperationURLParameter = { + parameterPath: "roleAssignmentId", + mapper: { + serializedName: "roleAssignmentId", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/permissionsMappers.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/permissionsMappers.ts deleted file mode 100644 index 2ca29685b7d7..000000000000 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/permissionsMappers.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - CloudError, - Permission, - PermissionGetResult -} from "../models/mappers"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/providerOperationsMetadataOperationsMappers.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/providerOperationsMetadataOperationsMappers.ts deleted file mode 100644 index 7bfe52496e1d..000000000000 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/providerOperationsMetadataOperationsMappers.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - CloudError, - ProviderOperation, - ProviderOperationsMetadata, - ProviderOperationsMetadataListResult, - ResourceType -} from "../models/mappers"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/roleAssignmentsMappers.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/roleAssignmentsMappers.ts deleted file mode 100644 index 992f1435cf0c..000000000000 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/roleAssignmentsMappers.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - CloudError, - RoleAssignment, - RoleAssignmentCreateParameters, - RoleAssignmentListResult, - RoleAssignmentProperties, - RoleAssignmentPropertiesWithScope -} from "../models/mappers"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/roleDefinitionsMappers.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/roleDefinitionsMappers.ts deleted file mode 100644 index c64320ffca61..000000000000 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/models/roleDefinitionsMappers.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - CloudError, - Permission, - RoleDefinition, - RoleDefinitionListResult -} from "../models/mappers"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/globalAdministrator.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/globalAdministrator.ts index 47e6cca87ec1..7b8209157c7c 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/globalAdministrator.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/globalAdministrator.ts @@ -1,71 +1,57 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Mappers from "../models/globalAdministratorMappers"; +import { GlobalAdministrator } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; +import { AuthorizationManagementClient } from "../authorizationManagementClient"; +import { GlobalAdministratorElevateAccessOptionalParams } from "../models"; -/** Class representing a GlobalAdministrator. */ -export class GlobalAdministrator { - private readonly client: AuthorizationManagementClientContext; +/** Class containing GlobalAdministrator operations. */ +export class GlobalAdministratorImpl implements GlobalAdministrator { + private readonly client: AuthorizationManagementClient; /** - * Create a GlobalAdministrator. - * @param {AuthorizationManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class GlobalAdministrator class. + * @param client Reference to the service client */ - constructor(client: AuthorizationManagementClientContext) { + constructor(client: AuthorizationManagementClient) { this.client = client; } /** * Elevates access for a Global Administrator. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - elevateAccess(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - elevateAccess(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - elevateAccess(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - elevateAccess(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + elevateAccess( + options?: GlobalAdministratorElevateAccessOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - options - }, - elevateAccessOperationSpec, - callback); + { options }, + elevateAccessOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const elevateAccessOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const elevateAccessOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Authorization/elevateAccess", httpMethod: "POST", - path: "providers/Microsoft.Authorization/elevateAccess", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: {}, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/index.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/index.ts index fbbf7a534452..a229e5a38ba6 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/index.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/index.ts @@ -1,11 +1,9 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./permissions"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/permissions.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/permissions.ts index df52b9e9cb89..303f41826848 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/permissions.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/permissions.ts @@ -1,96 +1,225 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/permissionsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Permissions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; +import { AuthorizationManagementClient } from "../authorizationManagementClient"; +import { + Permission, + PermissionsListForResourceGroupNextOptionalParams, + PermissionsListForResourceGroupOptionalParams, + PermissionsListForResourceNextOptionalParams, + PermissionsListForResourceOptionalParams, + PermissionsListForResourceGroupResponse, + PermissionsListForResourceResponse, + PermissionsListForResourceGroupNextResponse, + PermissionsListForResourceNextResponse +} from "../models"; -/** Class representing a Permissions. */ -export class Permissions { - private readonly client: AuthorizationManagementClientContext; +/// +/** Class containing Permissions operations. */ +export class PermissionsImpl implements Permissions { + private readonly client: AuthorizationManagementClient; /** - * Create a Permissions. - * @param {AuthorizationManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Permissions class. + * @param client Reference to the service client */ - constructor(client: AuthorizationManagementClientContext) { + constructor(client: AuthorizationManagementClient) { this.client = client; } /** * Gets all permissions the caller has for a resource group. - * @param resourceGroupName The name of the resource group to get the permissions for. The name is - * case insensitive. - * @param [options] The optional parameters - * @returns Promise + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. */ - listForResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group to get the permissions for. The name is - * case insensitive. - * @param callback The callback - */ - listForResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group to get the permissions for. The name is - * case insensitive. - * @param options The optional parameters - * @param callback The callback - */ - listForResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public listForResourceGroup( + resourceGroupName: string, + options?: PermissionsListForResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listForResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listForResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listForResourceGroupPagingPage( + resourceGroupName: string, + options?: PermissionsListForResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listForResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listForResourceGroupNext( resourceGroupName, + continuationToken, options - }, - listForResourceGroupOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listForResourceGroupPagingAll( + resourceGroupName: string, + options?: PermissionsListForResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listForResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } } /** * Gets all permissions the caller has for a resource. - * @param resourceGroupName The name of the resource group containing the resource. The name is - * case insensitive. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource. * @param resourceName The name of the resource to get the permissions for. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; + public listForResource( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: PermissionsListForResourceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listForResourcePagingAll( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listForResourcePagingPage( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + ); + } + }; + } + + private async *listForResourcePagingPage( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: PermissionsListForResourceOptionalParams + ): AsyncIterableIterator { + let result = await this._listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listForResourceNext( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listForResourcePagingAll( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: PermissionsListForResourceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listForResourcePagingPage( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + )) { + yield* page; + } + } + /** - * @param resourceGroupName The name of the resource group containing the resource. The name is - * case insensitive. - * @param resourceProviderNamespace The namespace of the resource provider. - * @param parentResourcePath The parent resource identity. - * @param resourceType The resource type of the resource. - * @param resourceName The name of the resource to get the permissions for. - * @param callback The callback + * Gets all permissions the caller has for a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, callback: msRest.ServiceCallback): void; + private _listForResourceGroup( + resourceGroupName: string, + options?: PermissionsListForResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listForResourceGroupOperationSpec + ); + } + /** - * @param resourceGroupName The name of the resource group containing the resource. The name is - * case insensitive. + * Gets all permissions the caller has for a resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource. * @param resourceName The name of the resource to get the permissions for. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listForResource( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: PermissionsListForResourceOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -100,159 +229,152 @@ export class Permissions { resourceName, options }, - listForResourceOperationSpec, - callback) as Promise; + listForResourceOperationSpec + ); } /** - * Gets all permissions the caller has for a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listForResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listForResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListForResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListForResourceGroup method. + * @param options The options parameters. */ - listForResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listForResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: PermissionsListForResourceGroupNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listForResourceGroupNextOperationSpec, - callback) as Promise; + { resourceGroupName, nextLink, options }, + listForResourceGroupNextOperationSpec + ); } /** - * Gets all permissions the caller has for a resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listForResourceNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listForResourceNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListForResourceNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get the permissions for. + * @param nextLink The nextLink from the previous successful call to the ListForResource method. + * @param options The options parameters. */ - listForResourceNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForResourceNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listForResourceNext( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + nextLink: string, + options?: PermissionsListForResourceNextOptionalParams + ): Promise { return this.client.sendOperationRequest( { - nextPageLink, + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + nextLink, options }, - listForResourceNextOperationSpec, - callback) as Promise; + listForResourceNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listForResourceGroupOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listForResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.PermissionGetResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listForResourceOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.resourceGroupName, - Parameters.resourceProviderNamespace, - Parameters.parentResourcePath, - Parameters.resourceType, - Parameters.resourceName, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listForResourceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PermissionGetResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.resourceProviderNamespace, + Parameters.parentResourcePath, + Parameters.resourceType, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const listForResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listForResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PermissionGetResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listForResourceNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listForResourceNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PermissionGetResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.resourceProviderNamespace, + Parameters.parentResourcePath, + Parameters.resourceType, + Parameters.resourceName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/providerOperationsMetadataOperations.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/providerOperationsMetadataOperations.ts index 9ea33517236c..922a30fbe77d 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/providerOperationsMetadataOperations.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/providerOperationsMetadataOperations.ts @@ -1,184 +1,172 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/providerOperationsMetadataOperationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ProviderOperationsMetadataOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; +import { AuthorizationManagementClient } from "../authorizationManagementClient"; +import { + ProviderOperationsMetadata, + ProviderOperationsMetadataListNextOptionalParams, + ProviderOperationsMetadataListOptionalParams, + ProviderOperationsMetadataGetOptionalParams, + ProviderOperationsMetadataGetResponse, + ProviderOperationsMetadataListResponse, + ProviderOperationsMetadataListNextResponse +} from "../models"; -/** Class representing a ProviderOperationsMetadataOperations. */ -export class ProviderOperationsMetadataOperations { - private readonly client: AuthorizationManagementClientContext; +/// +/** Class containing ProviderOperationsMetadataOperations operations. */ +export class ProviderOperationsMetadataOperationsImpl + implements ProviderOperationsMetadataOperations { + private readonly client: AuthorizationManagementClient; /** - * Create a ProviderOperationsMetadataOperations. - * @param {AuthorizationManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class ProviderOperationsMetadataOperations class. + * @param client Reference to the service client */ - constructor(client: AuthorizationManagementClientContext) { + constructor(client: AuthorizationManagementClient) { this.client = client; } /** - * Gets provider operations metadata for the specified resource provider. - * @param resourceProviderNamespace The namespace of the resource provider. - * @param apiVersion The API version to use for the operation. - * @param [options] The optional parameters - * @returns Promise - */ - get(resourceProviderNamespace: string, apiVersion: string, options?: Models.ProviderOperationsMetadataGetOptionalParams): Promise; - /** - * @param resourceProviderNamespace The namespace of the resource provider. - * @param apiVersion The API version to use for the operation. - * @param callback The callback - */ - get(resourceProviderNamespace: string, apiVersion: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceProviderNamespace The namespace of the resource provider. - * @param apiVersion The API version to use for the operation. - * @param options The optional parameters - * @param callback The callback + * Gets provider operations metadata for all resource providers. + * @param options The options parameters. */ - get(resourceProviderNamespace: string, apiVersion: string, options: Models.ProviderOperationsMetadataGetOptionalParams, callback: msRest.ServiceCallback): void; - get(resourceProviderNamespace: string, apiVersion: string, options?: Models.ProviderOperationsMetadataGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceProviderNamespace, - apiVersion, - options + public list( + options?: ProviderOperationsMetadataListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; }, - getOperationSpec, - callback) as Promise; + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: ProviderOperationsMetadataListOptionalParams + ): 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?: ProviderOperationsMetadataListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** - * Gets provider operations metadata for all resource providers. - * @param apiVersion The API version to use for this operation. - * @param [options] The optional parameters - * @returns Promise - */ - list(apiVersion: string, options?: Models.ProviderOperationsMetadataListOptionalParams): Promise; - /** - * @param apiVersion The API version to use for this operation. - * @param callback The callback - */ - list(apiVersion: string, callback: msRest.ServiceCallback): void; - /** - * @param apiVersion The API version to use for this operation. - * @param options The optional parameters - * @param callback The callback + * Gets provider operations metadata for the specified resource provider. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param options The options parameters. */ - list(apiVersion: string, options: Models.ProviderOperationsMetadataListOptionalParams, callback: msRest.ServiceCallback): void; - list(apiVersion: string, options?: Models.ProviderOperationsMetadataListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceProviderNamespace: string, + options?: ProviderOperationsMetadataGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - apiVersion, - options - }, - listOperationSpec, - callback) as Promise; + { resourceProviderNamespace, options }, + getOperationSpec + ); } /** * Gets provider operations metadata for all resource providers. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; + private _list( + options?: ProviderOperationsMetadataListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: ProviderOperationsMetadataListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}", httpMethod: "GET", - path: "providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}", - urlParameters: [ - Parameters.resourceProviderNamespace - ], - queryParameters: [ - Parameters.apiVersion, - Parameters.expand - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ProviderOperationsMetadata }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.expand], + urlParameters: [Parameters.$host, Parameters.resourceProviderNamespace], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Authorization/providerOperations", httpMethod: "GET", - path: "providers/Microsoft.Authorization/providerOperations", - queryParameters: [ - Parameters.apiVersion, - Parameters.expand - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ProviderOperationsMetadataListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.expand], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ProviderOperationsMetadataListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.expand], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleAssignments.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleAssignments.ts index c084ae41db0b..b86f4fcdc2c3 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleAssignments.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleAssignments.ts @@ -1,62 +1,319 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/roleAssignmentsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { RoleAssignments } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; +import { AuthorizationManagementClient } from "../authorizationManagementClient"; +import { + RoleAssignment, + RoleAssignmentsListForResourceNextOptionalParams, + RoleAssignmentsListForResourceOptionalParams, + RoleAssignmentsListForResourceGroupNextOptionalParams, + RoleAssignmentsListForResourceGroupOptionalParams, + RoleAssignmentsListNextOptionalParams, + RoleAssignmentsListOptionalParams, + RoleAssignmentsListForScopeNextOptionalParams, + RoleAssignmentsListForScopeOptionalParams, + RoleAssignmentsListForResourceResponse, + RoleAssignmentsListForResourceGroupResponse, + RoleAssignmentsDeleteOptionalParams, + RoleAssignmentsDeleteResponse, + RoleAssignmentCreateParameters, + RoleAssignmentsCreateOptionalParams, + RoleAssignmentsCreateResponse, + RoleAssignmentsGetOptionalParams, + RoleAssignmentsGetResponse, + RoleAssignmentsDeleteByIdOptionalParams, + RoleAssignmentsDeleteByIdResponse, + RoleAssignmentsCreateByIdOptionalParams, + RoleAssignmentsCreateByIdResponse, + RoleAssignmentsGetByIdOptionalParams, + RoleAssignmentsGetByIdResponse, + RoleAssignmentsListResponse, + RoleAssignmentsListForScopeResponse, + RoleAssignmentsListForResourceNextResponse, + RoleAssignmentsListForResourceGroupNextResponse, + RoleAssignmentsListNextResponse, + RoleAssignmentsListForScopeNextResponse +} from "../models"; -/** Class representing a RoleAssignments. */ -export class RoleAssignments { - private readonly client: AuthorizationManagementClientContext; +/// +/** Class containing RoleAssignments operations. */ +export class RoleAssignmentsImpl implements RoleAssignments { + private readonly client: AuthorizationManagementClient; /** - * Create a RoleAssignments. - * @param {AuthorizationManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class RoleAssignments class. + * @param client Reference to the service client */ - constructor(client: AuthorizationManagementClientContext) { + constructor(client: AuthorizationManagementClient) { this.client = client; } /** * Gets role assignments for a resource. - * @param resourceGroupName The name of the resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource. * @param resourceName The name of the resource to get role assignments for. - * @param [options] The optional parameters - * @returns Promise - */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: Models.RoleAssignmentsListForResourceOptionalParams): Promise; + * @param options The options parameters. + */ + public listForResource( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: RoleAssignmentsListForResourceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listForResourcePagingAll( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listForResourcePagingPage( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + ); + } + }; + } + + private async *listForResourcePagingPage( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: RoleAssignmentsListForResourceOptionalParams + ): AsyncIterableIterator { + let result = await this._listForResource( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listForResourceNext( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listForResourcePagingAll( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: RoleAssignmentsListForResourceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listForResourcePagingPage( + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + options + )) { + yield* page; + } + } + /** - * @param resourceGroupName The name of the resource group. - * @param resourceProviderNamespace The namespace of the resource provider. - * @param parentResourcePath The parent resource identity. - * @param resourceType The resource type of the resource. - * @param resourceName The name of the resource to get role assignments for. - * @param callback The callback - */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, callback: msRest.ServiceCallback): void; + * Gets role assignments for a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listForResourceGroup( + resourceGroupName: string, + options?: RoleAssignmentsListForResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listForResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listForResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listForResourceGroupPagingPage( + resourceGroupName: string, + options?: RoleAssignmentsListForResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listForResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listForResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listForResourceGroupPagingAll( + resourceGroupName: string, + options?: RoleAssignmentsListForResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listForResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Gets all role assignments for the subscription. + * @param options The options parameters. + */ + public list( + options?: RoleAssignmentsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: RoleAssignmentsListOptionalParams + ): 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?: RoleAssignmentsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + /** - * @param resourceGroupName The name of the resource group. + * Gets role assignments for a scope. + * @param scope The scope of the role assignments. + * @param options The options parameters. + */ + public listForScope( + scope: string, + options?: RoleAssignmentsListForScopeOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listForScopePagingAll(scope, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listForScopePagingPage(scope, options); + } + }; + } + + private async *listForScopePagingPage( + scope: string, + options?: RoleAssignmentsListForScopeOptionalParams + ): AsyncIterableIterator { + let result = await this._listForScope(scope, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listForScopeNext(scope, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listForScopePagingAll( + scope: string, + options?: RoleAssignmentsListForScopeOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listForScopePagingPage(scope, options)) { + yield* page; + } + } + + /** + * Gets role assignments for a resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param resourceProviderNamespace The namespace of the resource provider. * @param parentResourcePath The parent resource identity. * @param resourceType The resource type of the resource. * @param resourceName The name of the resource to get role assignments for. - * @param options The optional parameters - * @param callback The callback - */ - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options: Models.RoleAssignmentsListForResourceOptionalParams, callback: msRest.ServiceCallback): void; - listForResource(resourceGroupName: string, resourceProviderNamespace: string, parentResourcePath: string, resourceType: string, resourceName: string, options?: Models.RoleAssignmentsListForResourceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + * @param options The options parameters. + */ + private _listForResource( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: RoleAssignmentsListForResourceOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -66,776 +323,524 @@ export class RoleAssignments { resourceName, options }, - listForResourceOperationSpec, - callback) as Promise; + listForResourceOperationSpec + ); } /** * Gets role assignments for a resource group. - * @param resourceGroupName The name of the resource group. - * @param [options] The optional parameters - * @returns Promise - */ - listForResourceGroup(resourceGroupName: string, options?: Models.RoleAssignmentsListForResourceGroupOptionalParams): Promise; - /** - * @param resourceGroupName The name of the resource group. - * @param callback The callback + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. */ - listForResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. - * @param options The optional parameters - * @param callback The callback - */ - listForResourceGroup(resourceGroupName: string, options: Models.RoleAssignmentsListForResourceGroupOptionalParams, callback: msRest.ServiceCallback): void; - listForResourceGroup(resourceGroupName: string, options?: Models.RoleAssignmentsListForResourceGroupOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listForResourceGroup( + resourceGroupName: string, + options?: RoleAssignmentsListForResourceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listForResourceGroupOperationSpec, - callback) as Promise; + { resourceGroupName, options }, + listForResourceGroupOperationSpec + ); } /** * Deletes a role assignment. * @param scope The scope of the role assignment to delete. * @param roleAssignmentName The name of the role assignment to delete. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(scope: string, roleAssignmentName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param scope The scope of the role assignment to delete. - * @param roleAssignmentName The name of the role assignment to delete. - * @param callback The callback - */ - deleteMethod(scope: string, roleAssignmentName: string, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the role assignment to delete. - * @param roleAssignmentName The name of the role assignment to delete. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(scope: string, roleAssignmentName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(scope: string, roleAssignmentName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + scope: string, + roleAssignmentName: string, + options?: RoleAssignmentsDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - scope, - roleAssignmentName, - options - }, - deleteMethodOperationSpec, - callback) as Promise; + { scope, roleAssignmentName, options }, + deleteOperationSpec + ); } /** * Creates a role assignment. * @param scope The scope of the role assignment to create. The scope can be any REST resource - * instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, - * and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - * for a resource. - * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. - * @param properties Role assignment properties. - * @param [options] The optional parameters - * @returns Promise - */ - create(scope: string, roleAssignmentName: string, properties: Models.RoleAssignmentProperties, options?: msRest.RequestOptionsBase): Promise; - /** - * @param scope The scope of the role assignment to create. The scope can be any REST resource - * instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, - * and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - * for a resource. - * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. - * @param properties Role assignment properties. - * @param callback The callback - */ - create(scope: string, roleAssignmentName: string, properties: Models.RoleAssignmentProperties, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the role assignment to create. The scope can be any REST resource - * instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, - * and - * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' - * for a resource. - * @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. - * @param properties Role assignment properties. - * @param options The optional parameters - * @param callback The callback - */ - create(scope: string, roleAssignmentName: string, properties: Models.RoleAssignmentProperties, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - create(scope: string, roleAssignmentName: string, properties: Models.RoleAssignmentProperties, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + * instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment. + * @param options The options parameters. + */ + create( + scope: string, + roleAssignmentName: string, + parameters: RoleAssignmentCreateParameters, + options?: RoleAssignmentsCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - scope, - roleAssignmentName, - properties, - options - }, - createOperationSpec, - callback) as Promise; + { scope, roleAssignmentName, parameters, options }, + createOperationSpec + ); } /** * Get the specified role assignment. * @param scope The scope of the role assignment. * @param roleAssignmentName The name of the role assignment to get. - * @param [options] The optional parameters - * @returns Promise - */ - get(scope: string, roleAssignmentName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param scope The scope of the role assignment. - * @param roleAssignmentName The name of the role assignment to get. - * @param callback The callback + * @param options The options parameters. */ - get(scope: string, roleAssignmentName: string, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the role assignment. - * @param roleAssignmentName The name of the role assignment to get. - * @param options The optional parameters - * @param callback The callback - */ - get(scope: string, roleAssignmentName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(scope: string, roleAssignmentName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + scope: string, + roleAssignmentName: string, + options?: RoleAssignmentsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - scope, - roleAssignmentName, - options - }, - getOperationSpec, - callback) as Promise; + { scope, roleAssignmentName, options }, + getOperationSpec + ); } /** * Deletes a role assignment. - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param [options] The optional parameters - * @returns Promise - */ - deleteById(roleAssignmentId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param callback The callback - */ - deleteById(roleAssignmentId: string, callback: msRest.ServiceCallback): void; - /** - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param options The optional parameters - * @param callback The callback - */ - deleteById(roleAssignmentId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteById(roleAssignmentId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource + * name and resource type. Use the format, + * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: + * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + * @param options The options parameters. + */ + deleteById( + roleAssignmentId: string, + options?: RoleAssignmentsDeleteByIdOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - roleAssignmentId, - options - }, - deleteByIdOperationSpec, - callback) as Promise; + { roleAssignmentId, options }, + deleteByIdOperationSpec + ); } /** * Creates a role assignment by ID. - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param properties Role assignment properties. - * @param [options] The optional parameters - * @returns Promise - */ - createById(roleAssignmentId: string, properties: Models.RoleAssignmentProperties, options?: msRest.RequestOptionsBase): Promise; - /** - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param properties Role assignment properties. - * @param callback The callback - */ - createById(roleAssignmentId: string, properties: Models.RoleAssignmentProperties, callback: msRest.ServiceCallback): void; - /** - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param properties Role assignment properties. - * @param options The optional parameters - * @param callback The callback - */ - createById(roleAssignmentId: string, properties: Models.RoleAssignmentProperties, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createById(roleAssignmentId: string, properties: Models.RoleAssignmentProperties, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource + * name and resource type. Use the format, + * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: + * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + * @param parameters Parameters for the role assignment. + * @param options The options parameters. + */ + createById( + roleAssignmentId: string, + parameters: RoleAssignmentCreateParameters, + options?: RoleAssignmentsCreateByIdOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - roleAssignmentId, - properties, - options - }, - createByIdOperationSpec, - callback) as Promise; + { roleAssignmentId, parameters, options }, + createByIdOperationSpec + ); } /** * Gets a role assignment by ID. - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param [options] The optional parameters - * @returns Promise - */ - getById(roleAssignmentId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param callback The callback - */ - getById(roleAssignmentId: string, callback: msRest.ServiceCallback): void; - /** - * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, - * resource name and resource type. Use the format, - * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: - * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. - * @param options The optional parameters - * @param callback The callback - */ - getById(roleAssignmentId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getById(roleAssignmentId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource + * name and resource type. Use the format, + * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: + * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + * @param options The options parameters. + */ + getById( + roleAssignmentId: string, + options?: RoleAssignmentsGetByIdOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - roleAssignmentId, - options - }, - getByIdOperationSpec, - callback) as Promise; + { roleAssignmentId, options }, + getByIdOperationSpec + ); } /** * Gets all role assignments for the subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: Models.RoleAssignmentsListOptionalParams): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: Models.RoleAssignmentsListOptionalParams, callback: msRest.ServiceCallback): void; - list(options?: Models.RoleAssignmentsListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; + private _list( + options?: RoleAssignmentsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Gets role assignments for a scope. * @param scope The scope of the role assignments. - * @param [options] The optional parameters - * @returns Promise - */ - listForScope(scope: string, options?: Models.RoleAssignmentsListForScopeOptionalParams): Promise; - /** - * @param scope The scope of the role assignments. - * @param callback The callback + * @param options The options parameters. */ - listForScope(scope: string, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the role assignments. - * @param options The optional parameters - * @param callback The callback - */ - listForScope(scope: string, options: Models.RoleAssignmentsListForScopeOptionalParams, callback: msRest.ServiceCallback): void; - listForScope(scope: string, options?: Models.RoleAssignmentsListForScopeOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listForScope( + scope: string, + options?: RoleAssignmentsListForScopeOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - scope, - options - }, - listForScopeOperationSpec, - callback) as Promise; + { scope, options }, + listForScopeOperationSpec + ); } /** - * Gets role assignments for a resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listForResourceNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listForResourceNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listForResourceNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForResourceNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + * ListForResourceNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get role assignments for. + * @param nextLink The nextLink from the previous successful call to the ListForResource method. + * @param options The options parameters. + */ + private _listForResourceNext( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + nextLink: string, + options?: RoleAssignmentsListForResourceNextOptionalParams + ): Promise { return this.client.sendOperationRequest( { - nextPageLink, + resourceGroupName, + resourceProviderNamespace, + parentResourcePath, + resourceType, + resourceName, + nextLink, options }, - listForResourceNextOperationSpec, - callback) as Promise; + listForResourceNextOperationSpec + ); } /** - * Gets role assignments for a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listForResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listForResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListForResourceGroupNext + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param nextLink The nextLink from the previous successful call to the ListForResourceGroup method. + * @param options The options parameters. */ - listForResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listForResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: RoleAssignmentsListForResourceGroupNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listForResourceGroupNextOperationSpec, - callback) as Promise; + { resourceGroupName, nextLink, options }, + listForResourceGroupNextOperationSpec + ); } /** - * Gets all role assignments for the subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: RoleAssignmentsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } /** - * Gets role assignments for a scope. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listForScopeNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listForScopeNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listForScopeNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listForScopeNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + * ListForScopeNext + * @param scope The scope of the role assignments. + * @param nextLink The nextLink from the previous successful call to the ListForScope method. + * @param options The options parameters. + */ + private _listForScopeNext( + scope: string, + nextLink: string, + options?: RoleAssignmentsListForScopeNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listForScopeNextOperationSpec, - callback) as Promise; + { scope, nextLink, options }, + listForScopeNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listForResourceOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listForResourceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.resourceProviderNamespace, - Parameters.parentResourcePath, - Parameters.resourceType, - Parameters.resourceName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.filter, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleAssignmentListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listForResourceGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments", + queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ + Parameters.$host, Parameters.resourceGroupName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.filter, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.subscriptionId, + Parameters.resourceProviderNamespace, + Parameters.parentResourcePath, + Parameters.resourceType, + Parameters.resourceName ], + headerParameters: [Parameters.accept], + serializer +}; +const listForResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RoleAssignmentListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], serializer }; - -const deleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", httpMethod: "DELETE", - path: "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", - urlParameters: [ - Parameters.scope, - Parameters.roleAssignmentName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleAssignment }, + 204: {}, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const createOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.scope, Parameters.roleAssignmentName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: { - properties: "properties" - }, - mapper: { - ...Mappers.RoleAssignmentCreateParameters, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", + httpMethod: "PUT", responses: { 201: { bodyMapper: Mappers.RoleAssignment }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.scope, Parameters.roleAssignmentName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RoleAssignment }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.scope, + Parameters.roleAssignmentName + ], + headerParameters: [Parameters.accept], serializer }; - -const deleteByIdOperationSpec: msRest.OperationSpec = { +const deleteByIdOperationSpec: coreClient.OperationSpec = { + path: "/{roleAssignmentId}", httpMethod: "DELETE", - path: "{roleAssignmentId}", - urlParameters: [ - Parameters.roleAssignmentId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleAssignment }, + 204: {}, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.roleAssignmentId], + headerParameters: [Parameters.accept], serializer }; - -const createByIdOperationSpec: msRest.OperationSpec = { +const createByIdOperationSpec: coreClient.OperationSpec = { + path: "/{roleAssignmentId}", httpMethod: "PUT", - path: "{roleAssignmentId}", - urlParameters: [ - Parameters.roleAssignmentId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: { - properties: "properties" - }, - mapper: { - ...Mappers.RoleAssignmentCreateParameters, - required: true - } - }, responses: { 201: { bodyMapper: Mappers.RoleAssignment }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.roleAssignmentId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const getByIdOperationSpec: msRest.OperationSpec = { +const getByIdOperationSpec: coreClient.OperationSpec = { + path: "/{roleAssignmentId}", httpMethod: "GET", - path: "{roleAssignmentId}", - urlParameters: [ - Parameters.roleAssignmentId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleAssignment }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.roleAssignmentId], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.filter, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleAssignmentListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listForScopeOperationSpec: msRest.OperationSpec = { +const listForScopeOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.Authorization/roleAssignments", httpMethod: "GET", - path: "{scope}/providers/Microsoft.Authorization/roleAssignments", - urlParameters: [ - Parameters.scope - ], - queryParameters: [ - Parameters.filter, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleAssignmentListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.scope], + headerParameters: [Parameters.accept], serializer }; - -const listForResourceNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listForResourceNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RoleAssignmentListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.resourceProviderNamespace, + Parameters.parentResourcePath, + Parameters.resourceType, + Parameters.resourceName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listForResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listForResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RoleAssignmentListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.resourceGroupName, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RoleAssignmentListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listForScopeNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listForScopeNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RoleAssignmentListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleDefinitions.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleDefinitions.ts index c13cfa61f8d1..2c1eb00bf481 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleDefinitions.ts +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operations/roleDefinitions.ts @@ -1,93 +1,124 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/roleDefinitionsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { RoleDefinitions } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AuthorizationManagementClientContext } from "../authorizationManagementClientContext"; +import { AuthorizationManagementClient } from "../authorizationManagementClient"; +import { + RoleDefinition, + RoleDefinitionsListNextOptionalParams, + RoleDefinitionsListOptionalParams, + RoleDefinitionsDeleteOptionalParams, + RoleDefinitionsDeleteResponse, + RoleDefinitionsGetOptionalParams, + RoleDefinitionsGetResponse, + RoleDefinitionsCreateOrUpdateOptionalParams, + RoleDefinitionsCreateOrUpdateResponse, + RoleDefinitionsListResponse, + RoleDefinitionsGetByIdOptionalParams, + RoleDefinitionsGetByIdResponse, + RoleDefinitionsListNextResponse +} from "../models"; -/** Class representing a RoleDefinitions. */ -export class RoleDefinitions { - private readonly client: AuthorizationManagementClientContext; +/// +/** Class containing RoleDefinitions operations. */ +export class RoleDefinitionsImpl implements RoleDefinitions { + private readonly client: AuthorizationManagementClient; /** - * Create a RoleDefinitions. - * @param {AuthorizationManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class RoleDefinitions class. + * @param client Reference to the service client */ - constructor(client: AuthorizationManagementClientContext) { + constructor(client: AuthorizationManagementClient) { this.client = client; } /** - * Deletes a role definition. - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition to delete. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(scope: string, roleDefinitionId: string, options?: msRest.RequestOptionsBase): Promise; - /** + * Get all role definitions that are applicable at scope and above. * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition to delete. - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(scope: string, roleDefinitionId: string, callback: msRest.ServiceCallback): void; + public list( + scope: string, + options?: RoleDefinitionsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(scope, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(scope, options); + } + }; + } + + private async *listPagingPage( + scope: string, + options?: RoleDefinitionsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(scope, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(scope, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + scope: string, + options?: RoleDefinitionsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(scope, options)) { + yield* page; + } + } + /** + * Deletes a role definition. * @param scope The scope of the role definition. * @param roleDefinitionId The ID of the role definition to delete. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(scope: string, roleDefinitionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(scope: string, roleDefinitionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + scope: string, + roleDefinitionId: string, + options?: RoleDefinitionsDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - scope, - roleDefinitionId, - options - }, - deleteMethodOperationSpec, - callback) as Promise; + { scope, roleDefinitionId, options }, + deleteOperationSpec + ); } /** * Get role definition by name (GUID). * @param scope The scope of the role definition. * @param roleDefinitionId The ID of the role definition. - * @param [options] The optional parameters - * @returns Promise - */ - get(scope: string, roleDefinitionId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition. - * @param callback The callback - */ - get(scope: string, roleDefinitionId: string, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition. - * @param options The optional parameters - * @param callback The callback + * @param options The options parameters. */ - get(scope: string, roleDefinitionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(scope: string, roleDefinitionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + scope: string, + roleDefinitionId: string, + options?: RoleDefinitionsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - scope, - roleDefinitionId, - options - }, - getOperationSpec, - callback) as Promise; + { scope, roleDefinitionId, options }, + getOperationSpec + ); } /** @@ -95,279 +126,185 @@ export class RoleDefinitions { * @param scope The scope of the role definition. * @param roleDefinitionId The ID of the role definition. * @param roleDefinition The values for the role definition. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: Models.RoleDefinition, options?: msRest.RequestOptionsBase): Promise; - /** - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition. - * @param roleDefinition The values for the role definition. - * @param callback The callback - */ - createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: Models.RoleDefinition, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the role definition. - * @param roleDefinitionId The ID of the role definition. - * @param roleDefinition The values for the role definition. - * @param options The optional parameters - * @param callback The callback - */ - createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: Models.RoleDefinition, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - createOrUpdate(scope: string, roleDefinitionId: string, roleDefinition: Models.RoleDefinition, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + createOrUpdate( + scope: string, + roleDefinitionId: string, + roleDefinition: RoleDefinition, + options?: RoleDefinitionsCreateOrUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - scope, - roleDefinitionId, - roleDefinition, - options - }, - createOrUpdateOperationSpec, - callback) as Promise; + { scope, roleDefinitionId, roleDefinition, options }, + createOrUpdateOperationSpec + ); } /** * Get all role definitions that are applicable at scope and above. * @param scope The scope of the role definition. - * @param [options] The optional parameters - * @returns Promise - */ - list(scope: string, options?: Models.RoleDefinitionsListOptionalParams): Promise; - /** - * @param scope The scope of the role definition. - * @param callback The callback + * @param options The options parameters. */ - list(scope: string, callback: msRest.ServiceCallback): void; - /** - * @param scope The scope of the role definition. - * @param options The optional parameters - * @param callback The callback - */ - list(scope: string, options: Models.RoleDefinitionsListOptionalParams, callback: msRest.ServiceCallback): void; - list(scope: string, options?: Models.RoleDefinitionsListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _list( + scope: string, + options?: RoleDefinitionsListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - scope, - options - }, - listOperationSpec, - callback) as Promise; + { scope, options }, + listOperationSpec + ); } /** * Gets a role definition by ID. * @param roleDefinitionId The fully qualified role definition ID. Use the format, - * /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - * subscription level role definitions, or - * /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role - * definitions. - * @param [options] The optional parameters - * @returns Promise + * /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for + * subscription level role definitions, or + * /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role + * definitions. + * @param options The options parameters. */ - getById(roleDefinitionId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param roleDefinitionId The fully qualified role definition ID. Use the format, - * /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - * subscription level role definitions, or - * /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role - * definitions. - * @param callback The callback - */ - getById(roleDefinitionId: string, callback: msRest.ServiceCallback): void; - /** - * @param roleDefinitionId The fully qualified role definition ID. Use the format, - * /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for - * subscription level role definitions, or - * /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role - * definitions. - * @param options The optional parameters - * @param callback The callback - */ - getById(roleDefinitionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getById(roleDefinitionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getById( + roleDefinitionId: string, + options?: RoleDefinitionsGetByIdOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - roleDefinitionId, - options - }, - getByIdOperationSpec, - callback) as Promise; + { roleDefinitionId, options }, + getByIdOperationSpec + ); } /** - * Get all role definitions that are applicable at scope and above. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback + * ListNext + * @param scope The scope of the role definition. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + scope: string, + nextLink: string, + options?: RoleDefinitionsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { scope, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const deleteMethodOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", httpMethod: "DELETE", - path: "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", - urlParameters: [ - Parameters.scope, - Parameters.roleDefinitionId0 - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleDefinition }, + 204: {}, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.scope, - Parameters.roleDefinitionId0 - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.roleDefinitionId ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RoleDefinition }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const createOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.scope, - Parameters.roleDefinitionId0 + Parameters.roleDefinitionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "roleDefinition", - mapper: { - ...Mappers.RoleDefinition, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", + httpMethod: "PUT", responses: { 201: { bodyMapper: Mappers.RoleDefinition }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.roleDefinition, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.scope, + Parameters.roleDefinitionId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/{scope}/providers/Microsoft.Authorization/roleDefinitions", httpMethod: "GET", - path: "{scope}/providers/Microsoft.Authorization/roleDefinitions", - urlParameters: [ - Parameters.scope - ], - queryParameters: [ - Parameters.filter, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleDefinitionListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.scope], + headerParameters: [Parameters.accept], serializer }; - -const getByIdOperationSpec: msRest.OperationSpec = { +const getByIdOperationSpec: coreClient.OperationSpec = { + path: "/{roleDefinitionId}", httpMethod: "GET", - path: "{roleDefinitionId}", - urlParameters: [ - Parameters.roleDefinitionId1 - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RoleDefinition }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.roleDefinitionId1], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RoleDefinitionListResult }, default: { - bodyMapper: Mappers.CloudError + bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.nextLink, Parameters.scope], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/globalAdministrator.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/globalAdministrator.ts new file mode 100644 index 000000000000..e0ecc90c5fae --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/globalAdministrator.ts @@ -0,0 +1,20 @@ +/* + * 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 { GlobalAdministratorElevateAccessOptionalParams } from "../models"; + +/** Interface representing a GlobalAdministrator. */ +export interface GlobalAdministrator { + /** + * Elevates access for a Global Administrator. + * @param options The options parameters. + */ + elevateAccess( + options?: GlobalAdministratorElevateAccessOptionalParams + ): Promise; +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/index.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..a229e5a38ba6 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/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 "./permissions"; +export * from "./roleDefinitions"; +export * from "./providerOperationsMetadataOperations"; +export * from "./globalAdministrator"; +export * from "./roleAssignments"; diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/permissions.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/permissions.ts new file mode 100644 index 000000000000..c29022ffc1f1 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/permissions.ts @@ -0,0 +1,45 @@ +/* + * 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 { + Permission, + PermissionsListForResourceGroupOptionalParams, + PermissionsListForResourceOptionalParams +} from "../models"; + +/// +/** Interface representing a Permissions. */ +export interface Permissions { + /** + * Gets all permissions the caller has for a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listForResourceGroup( + resourceGroupName: string, + options?: PermissionsListForResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets all permissions the caller has for a resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get the permissions for. + * @param options The options parameters. + */ + listForResource( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: PermissionsListForResourceOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/providerOperationsMetadataOperations.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/providerOperationsMetadataOperations.ts new file mode 100644 index 000000000000..a7e5a95f3d63 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/providerOperationsMetadataOperations.ts @@ -0,0 +1,36 @@ +/* + * 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 { + ProviderOperationsMetadata, + ProviderOperationsMetadataListOptionalParams, + ProviderOperationsMetadataGetOptionalParams, + ProviderOperationsMetadataGetResponse +} from "../models"; + +/// +/** Interface representing a ProviderOperationsMetadataOperations. */ +export interface ProviderOperationsMetadataOperations { + /** + * Gets provider operations metadata for all resource providers. + * @param options The options parameters. + */ + list( + options?: ProviderOperationsMetadataListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets provider operations metadata for the specified resource provider. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param options The options parameters. + */ + get( + resourceProviderNamespace: string, + options?: ProviderOperationsMetadataGetOptionalParams + ): Promise; +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/roleAssignments.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/roleAssignments.ts new file mode 100644 index 000000000000..0e79c3f1f818 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/roleAssignments.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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + RoleAssignment, + RoleAssignmentsListForResourceOptionalParams, + RoleAssignmentsListForResourceGroupOptionalParams, + RoleAssignmentsListOptionalParams, + RoleAssignmentsListForScopeOptionalParams, + RoleAssignmentsDeleteOptionalParams, + RoleAssignmentsDeleteResponse, + RoleAssignmentCreateParameters, + RoleAssignmentsCreateOptionalParams, + RoleAssignmentsCreateResponse, + RoleAssignmentsGetOptionalParams, + RoleAssignmentsGetResponse, + RoleAssignmentsDeleteByIdOptionalParams, + RoleAssignmentsDeleteByIdResponse, + RoleAssignmentsCreateByIdOptionalParams, + RoleAssignmentsCreateByIdResponse, + RoleAssignmentsGetByIdOptionalParams, + RoleAssignmentsGetByIdResponse +} from "../models"; + +/// +/** Interface representing a RoleAssignments. */ +export interface RoleAssignments { + /** + * Gets role assignments for a resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourcePath The parent resource identity. + * @param resourceType The resource type of the resource. + * @param resourceName The name of the resource to get role assignments for. + * @param options The options parameters. + */ + listForResource( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourcePath: string, + resourceType: string, + resourceName: string, + options?: RoleAssignmentsListForResourceOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets role assignments for a resource group. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listForResourceGroup( + resourceGroupName: string, + options?: RoleAssignmentsListForResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets all role assignments for the subscription. + * @param options The options parameters. + */ + list( + options?: RoleAssignmentsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets role assignments for a scope. + * @param scope The scope of the role assignments. + * @param options The options parameters. + */ + listForScope( + scope: string, + options?: RoleAssignmentsListForScopeOptionalParams + ): PagedAsyncIterableIterator; + /** + * Deletes a role assignment. + * @param scope The scope of the role assignment to delete. + * @param roleAssignmentName The name of the role assignment to delete. + * @param options The options parameters. + */ + delete( + scope: string, + roleAssignmentName: string, + options?: RoleAssignmentsDeleteOptionalParams + ): Promise; + /** + * Creates a role assignment. + * @param scope The scope of the role assignment to create. The scope can be any REST resource + * instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and + * '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' + * for a resource. + * @param roleAssignmentName A GUID for the role assignment to create. The name must be unique and + * different for each role assignment. + * @param parameters Parameters for the role assignment. + * @param options The options parameters. + */ + create( + scope: string, + roleAssignmentName: string, + parameters: RoleAssignmentCreateParameters, + options?: RoleAssignmentsCreateOptionalParams + ): Promise; + /** + * Get the specified role assignment. + * @param scope The scope of the role assignment. + * @param roleAssignmentName The name of the role assignment to get. + * @param options The options parameters. + */ + get( + scope: string, + roleAssignmentName: string, + options?: RoleAssignmentsGetOptionalParams + ): Promise; + /** + * Deletes a role assignment. + * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource + * name and resource type. Use the format, + * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: + * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + * @param options The options parameters. + */ + deleteById( + roleAssignmentId: string, + options?: RoleAssignmentsDeleteByIdOptionalParams + ): Promise; + /** + * Creates a role assignment by ID. + * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource + * name and resource type. Use the format, + * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: + * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + * @param parameters Parameters for the role assignment. + * @param options The options parameters. + */ + createById( + roleAssignmentId: string, + parameters: RoleAssignmentCreateParameters, + options?: RoleAssignmentsCreateByIdOptionalParams + ): Promise; + /** + * Gets a role assignment by ID. + * @param roleAssignmentId The fully qualified ID of the role assignment, including the scope, resource + * name and resource type. Use the format, + * /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. Example: + * /subscriptions/{subId}/resourcegroups/{rgname}//providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. + * @param options The options parameters. + */ + getById( + roleAssignmentId: string, + options?: RoleAssignmentsGetByIdOptionalParams + ): Promise; +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/roleDefinitions.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/roleDefinitions.ts new file mode 100644 index 000000000000..9bb5e67ede88 --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/src/operationsInterfaces/roleDefinitions.ts @@ -0,0 +1,83 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + RoleDefinition, + RoleDefinitionsListOptionalParams, + RoleDefinitionsDeleteOptionalParams, + RoleDefinitionsDeleteResponse, + RoleDefinitionsGetOptionalParams, + RoleDefinitionsGetResponse, + RoleDefinitionsCreateOrUpdateOptionalParams, + RoleDefinitionsCreateOrUpdateResponse, + RoleDefinitionsGetByIdOptionalParams, + RoleDefinitionsGetByIdResponse +} from "../models"; + +/// +/** Interface representing a RoleDefinitions. */ +export interface RoleDefinitions { + /** + * Get all role definitions that are applicable at scope and above. + * @param scope The scope of the role definition. + * @param options The options parameters. + */ + list( + scope: string, + options?: RoleDefinitionsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Deletes a role definition. + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition to delete. + * @param options The options parameters. + */ + delete( + scope: string, + roleDefinitionId: string, + options?: RoleDefinitionsDeleteOptionalParams + ): Promise; + /** + * Get role definition by name (GUID). + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @param options The options parameters. + */ + get( + scope: string, + roleDefinitionId: string, + options?: RoleDefinitionsGetOptionalParams + ): Promise; + /** + * Creates or updates a role definition. + * @param scope The scope of the role definition. + * @param roleDefinitionId The ID of the role definition. + * @param roleDefinition The values for the role definition. + * @param options The options parameters. + */ + createOrUpdate( + scope: string, + roleDefinitionId: string, + roleDefinition: RoleDefinition, + options?: RoleDefinitionsCreateOrUpdateOptionalParams + ): Promise; + /** + * Gets a role definition by ID. + * @param roleDefinitionId The fully qualified role definition ID. Use the format, + * /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for + * subscription level role definitions, or + * /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role + * definitions. + * @param options The options parameters. + */ + getById( + roleDefinitionId: string, + options?: RoleDefinitionsGetByIdOptionalParams + ): Promise; +} diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/test/sampleTest.ts b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/test/sampleTest.ts new file mode 100644 index 000000000000..7ed89b043e1b --- /dev/null +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/tsconfig.json b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/tsconfig.json index 422b584abd5e..3e6ae96443f3 100644 --- a/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/tsconfig.json +++ b/sdk/authorization/arm-authorization-profile-2020-09-01-hybrid/tsconfig.json @@ -3,17 +3,25 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "declaration": true, - "outDir": "./esm", + "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], - "exclude": ["node_modules"] -} + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/authorization/ci.mgmt.yml b/sdk/authorization/ci.mgmt.yml index 6f858f2cab56..a7561b803ee9 100644 --- a/sdk/authorization/ci.mgmt.yml +++ b/sdk/authorization/ci.mgmt.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -10,6 +10,7 @@ trigger: include: - sdk/authorization/ci.mgmt.yml - sdk/authorization/arm-authorization/ + - sdk/authorization/arm-authorization-profile-2020-09-01-hybrid pr: branches: include: @@ -23,11 +24,13 @@ pr: include: - sdk/authorization/ci.mgmt.yml - sdk/authorization/arm-authorization/ - + - sdk/authorization/arm-authorization-profile-2020-09-01-hybrid extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: authorization Artifacts: - name: azure-arm-authorization - safeName: azurearmauthorization \ No newline at end of file + safeName: azurearmauthorization + - name: azure-arm-authorization-profile-2020-09-01-hybrid + safeName: azurearmauthorizationprofile20200901hybrid