diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index a871e784860b..9a7268a05e8f 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -39,6 +39,7 @@ specifiers: '@rush-temp/arm-communication': file:./projects/arm-communication.tgz '@rush-temp/arm-compute': file:./projects/arm-compute.tgz '@rush-temp/arm-compute-profile-2020-09-01-hybrid': file:./projects/arm-compute-profile-2020-09-01-hybrid.tgz + '@rush-temp/arm-confidentialledger': file:./projects/arm-confidentialledger.tgz '@rush-temp/arm-confluent': file:./projects/arm-confluent.tgz '@rush-temp/arm-consumption': file:./projects/arm-consumption.tgz '@rush-temp/arm-containerinstance': file:./projects/arm-containerinstance.tgz @@ -322,6 +323,7 @@ dependencies: '@rush-temp/arm-communication': file:projects/arm-communication.tgz '@rush-temp/arm-compute': file:projects/arm-compute.tgz '@rush-temp/arm-compute-profile-2020-09-01-hybrid': file:projects/arm-compute-profile-2020-09-01-hybrid.tgz + '@rush-temp/arm-confidentialledger': file:projects/arm-confidentialledger.tgz '@rush-temp/arm-confluent': file:projects/arm-confluent.tgz '@rush-temp/arm-consumption': file:projects/arm-consumption.tgz '@rush-temp/arm-containerinstance': file:projects/arm-containerinstance.tgz @@ -2986,7 +2988,7 @@ packages: dev: false /array-flatten/1.1.1: - resolution: {integrity: sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=} + resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} dev: false /array-includes/3.1.5: @@ -3226,7 +3228,7 @@ packages: dev: false /buffer-equal-constant-time/1.0.1: - resolution: {integrity: sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=} + resolution: {integrity: sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==} dev: false /buffer-from/1.1.2: @@ -3367,7 +3369,7 @@ packages: dev: false /charenc/0.0.2: - resolution: {integrity: sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=} + resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==} dev: false /check-error/1.0.2: @@ -3488,7 +3490,7 @@ packages: dev: false /concat-map/0.0.1: - resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: false /concurrently/7.2.0: @@ -3540,7 +3542,7 @@ packages: dev: false /cookie-signature/1.0.6: - resolution: {integrity: sha1-4wOogrNCzD7oylE6eZmXNNqzriw=} + resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} dev: false /cookie/0.4.2: @@ -3642,7 +3644,7 @@ packages: dev: false /crypt/0.0.2: - resolution: {integrity: sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=} + resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} dev: false /csv-parse/5.0.4: @@ -3884,11 +3886,11 @@ packages: dev: false /edge-launcher/1.2.2: - resolution: {integrity: sha1-60Cq+9Bnpup27/+rBke81VCbN7I=} + resolution: {integrity: sha512-JcD5WBi3BHZXXVSSeEhl6sYO8g5cuynk/hifBzds2Bp4JdzCGLNMHgMCKu5DvrO1yatMgF0goFsxXRGus0yh1g==} dev: false /ee-first/1.1.1: - resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} dev: false /electron-to-chromium/1.4.137: @@ -4737,7 +4739,7 @@ packages: dev: false /fresh/0.5.2: - resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=} + resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} engines: {node: '>= 0.6'} dev: false @@ -4890,7 +4892,7 @@ packages: dev: false /github-from-package/0.0.0: - resolution: {integrity: sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=} + resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} dev: false /glob-parent/5.1.2: @@ -6006,7 +6008,7 @@ packages: dev: false /load-json-file/4.0.0: - resolution: {integrity: sha1-L19Fq5HjMhYjT9U62rZo607AmTs=} + resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} engines: {node: '>=4'} dependencies: graceful-fs: 4.2.10 @@ -6016,7 +6018,7 @@ packages: dev: false /locate-path/2.0.0: - resolution: {integrity: sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=} + resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} engines: {node: '>=4'} dependencies: p-locate: 2.0.0 @@ -6039,39 +6041,39 @@ packages: dev: false /lodash.flattendeep/4.4.0: - resolution: {integrity: sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=} + resolution: {integrity: sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==} dev: false /lodash.get/4.4.2: - resolution: {integrity: sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=} + resolution: {integrity: sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==} dev: false /lodash.includes/4.3.0: - resolution: {integrity: sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=} + resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==} dev: false /lodash.isboolean/3.0.3: - resolution: {integrity: sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=} + resolution: {integrity: sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==} dev: false /lodash.isequal/4.5.0: - resolution: {integrity: sha1-QVxEePK8wwEgwizhDtMib30+GOA=} + resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} dev: false /lodash.isinteger/4.0.4: - resolution: {integrity: sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=} + resolution: {integrity: sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==} dev: false /lodash.isnumber/3.0.3: - resolution: {integrity: sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=} + resolution: {integrity: sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==} dev: false /lodash.isplainobject/4.0.6: - resolution: {integrity: sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=} + resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} dev: false /lodash.isstring/4.0.1: - resolution: {integrity: sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=} + resolution: {integrity: sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==} dev: false /lodash.merge/4.6.2: @@ -6079,15 +6081,15 @@ packages: dev: false /lodash.once/4.1.1: - resolution: {integrity: sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=} + resolution: {integrity: sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==} dev: false /lodash.sortby/4.7.0: - resolution: {integrity: sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=} + resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} dev: false /lodash.truncate/4.4.2: - resolution: {integrity: sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=} + resolution: {integrity: sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==} dev: false /lodash/4.17.21: @@ -6231,17 +6233,17 @@ packages: dev: false /media-typer/0.3.0: - resolution: {integrity: sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=} + resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} engines: {node: '>= 0.6'} dev: false /memorystream/0.3.1: - resolution: {integrity: sha1-htcJCzDORV1j+64S3aUaR93K+bI=} + resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} engines: {node: '>= 0.10.0'} dev: false /merge-descriptors/1.0.1: - resolution: {integrity: sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=} + resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} dev: false /merge-source-map/1.1.0: @@ -6260,7 +6262,7 @@ packages: dev: false /methods/1.1.2: - resolution: {integrity: sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=} + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} engines: {node: '>= 0.6'} dev: false @@ -6321,7 +6323,7 @@ packages: dev: false /min-document/2.19.0: - resolution: {integrity: sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=} + resolution: {integrity: sha512-9Wy1B3m3f66bPPmU5hdA4DR4PB2OfDU/+GS3yAB7IQozE3tqXaVv2zOjgla7MEGSRv95+ILmOuvhLkOK6wJtCQ==} dependencies: dom-walk: 0.1.2 dev: false @@ -6444,7 +6446,7 @@ packages: dev: false /module-details-from-path/1.0.3: - resolution: {integrity: sha1-EUyUlnPiqKNenTV4hSeqN7Z52is=} + resolution: {integrity: sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A==} dev: false /moment/2.29.3: @@ -6452,7 +6454,7 @@ packages: dev: false /ms/2.0.0: - resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=} + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} dev: false /ms/2.1.1: @@ -10249,6 +10251,33 @@ packages: - supports-color dev: false + file:projects/arm-confidentialledger.tgz: + resolution: {integrity: sha512-MBYtfnNkPXm/JlYmp9CZzyc67Yv5kZ9vduGHllspcqAfuvL1R9v2g9iYxDR5nRgq3EYUn35iOQGF17R5AtTcEA==, tarball: file:projects/arm-confidentialledger.tgz} + name: '@rush-temp/arm-confidentialledger' + version: 0.0.0 + dependencies: + '@azure/core-lro': 2.2.4 + '@azure/identity': 2.0.4 + '@microsoft/api-extractor': 7.18.11 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.73.0 + '@rollup/plugin-json': 4.1.0_rollup@2.73.0 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.73.0 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.73.0 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.73.0 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.73.0 + tslib: 2.4.0 + typescript: 4.2.4 + uglify-js: 3.15.5 + transitivePeerDependencies: + - '@types/node' + - debug + - supports-color + dev: false + file:projects/arm-confluent.tgz: resolution: {integrity: sha512-g85MC0H59sZhtxewS2sM29eqT/7KV0eHJtuxEXf0dgfa28RhpJunJeQx4OuHTqYV5EtKy8YglGoW+s79sOlHVQ==, tarball: file:projects/arm-confluent.tgz} name: '@rush-temp/arm-confluent' @@ -14709,7 +14738,7 @@ packages: dev: false file:projects/communication-short-codes.tgz: - resolution: {integrity: sha512-cr4ngteTeRaGJ9dboW1HK3ystzEm9DGmG3Cfl6Ty+zPGBFj28oB7lABRHJ5MEsZVqt+s+5BeWAP4Yn/NCuLhZA==, tarball: file:projects/communication-short-codes.tgz} + resolution: {integrity: sha512-gLd6fDR3V4YGwG4pNU3a7l1zjZz9Ueyc55jeNBGOb0Yay4N/N4Ci8hFvdlLMUfhmJ6Q1v516OjjWhVZJaTYe0w==, tarball: file:projects/communication-short-codes.tgz} name: '@rush-temp/communication-short-codes' version: 0.0.0 dependencies: @@ -14752,7 +14781,6 @@ packages: transitivePeerDependencies: - bufferutil - debug - - encoding - supports-color - utf-8-validate dev: false diff --git a/rush.json b/rush.json index 3784aeac3ee1..770ad7d71610 100644 --- a/rush.json +++ b/rush.json @@ -1725,6 +1725,11 @@ "packageName": "@azure/arm-deviceupdate", "projectFolder": "sdk/deviceupdate/arm-deviceupdate", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-confidentialledger", + "projectFolder": "sdk/confidentialledger/arm-confidentialledger", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/confidentialledger/arm-confidentialledger/CHANGELOG.md b/sdk/confidentialledger/arm-confidentialledger/CHANGELOG.md new file mode 100644 index 000000000000..4979341abf39 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2022-05-31) + +The package of @azure/arm-confidentialledger is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/confidentialledger/arm-confidentialledger/LICENSE b/sdk/confidentialledger/arm-confidentialledger/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/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/confidentialledger/arm-confidentialledger/README.md b/sdk/confidentialledger/arm-confidentialledger/README.md new file mode 100644 index 000000000000..ffb94177061b --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/README.md @@ -0,0 +1,109 @@ +# Azure ConfidentialLedger client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ConfidentialLedger client. + +Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/confidentialledger/arm-confidentialledger) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-confidentialledger) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-confidentialledger) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-confidentialledger` package + +Install the Azure ConfidentialLedger client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-confidentialledger +``` + +### Create and authenticate a `ConfidentialLedgerClient` + +To create a client object to access the Azure ConfidentialLedger API, you will need the `endpoint` of your Azure ConfidentialLedger resource and a `credential`. The Azure ConfidentialLedger client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure ConfidentialLedger resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure ConfidentialLedger** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { ConfidentialLedgerClient } = require("@azure/arm-confidentialledger"); +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 ConfidentialLedgerClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new ConfidentialLedgerClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### ConfidentialLedgerClient + +`ConfidentialLedgerClient` is the primary interface for developers using the Azure ConfidentialLedger client library. Explore the methods on this client object to understand the different features of the Azure ConfidentialLedger service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fconfidentialledger%2Farm-confidentialledger%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/confidentialledger/arm-confidentialledger/_meta.json b/sdk/confidentialledger/arm-confidentialledger/_meta.json new file mode 100644 index 000000000000..88a180f7cd67 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "30b6221c12cc4014ee5142660d09cd48049ee388", + "readme": "specification/confidentialledger/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/confidentialledger/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.3.1", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" +} \ No newline at end of file diff --git a/sdk/confidentialledger/arm-confidentialledger/api-extractor.json b/sdk/confidentialledger/arm-confidentialledger/api-extractor.json new file mode 100644 index 000000000000..825e789f0157 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/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-confidentialledger.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/confidentialledger/arm-confidentialledger/package.json b/sdk/confidentialledger/arm-confidentialledger/package.json new file mode 100644 index 000000000000..4dd470f44000 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/package.json @@ -0,0 +1,112 @@ +{ + "name": "@azure/arm-confidentialledger", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for ConfidentialLedgerClient.", + "version": "1.0.0", + "engines": { + "node": ">=12.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.5.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-confidentialledger.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "7.18.11", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^1.0.4", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/confidentialledger/arm-confidentialledger", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/confidentialLedgerClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/confidentialledger/arm-confidentialledger/review/arm-confidentialledger.api.md b/sdk/confidentialledger/arm-confidentialledger/review/arm-confidentialledger.api.md new file mode 100644 index 000000000000..f393961dec2c --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/review/arm-confidentialledger.api.md @@ -0,0 +1,333 @@ +## API Report File for "@azure/arm-confidentialledger" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export interface AADBasedSecurityPrincipal { + ledgerRoleName?: LedgerRoleName; + principalId?: string; + tenantId?: string; +} + +// @public +export interface CertBasedSecurityPrincipal { + cert?: string; + ledgerRoleName?: LedgerRoleName; +} + +// @public +export type CheckNameAvailabilityOperationResponse = CheckNameAvailabilityResponse; + +// @public +export interface CheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CheckNameAvailabilityReason = string; + +// @public +export interface CheckNameAvailabilityRequest { + name?: string; + type?: string; +} + +// @public +export interface CheckNameAvailabilityResponse { + message?: string; + nameAvailable?: boolean; + reason?: CheckNameAvailabilityReason; +} + +// @public +export type ConfidentialLedger = Resource & ResourceLocation & Tags & { + properties?: LedgerProperties; +}; + +// @public (undocumented) +export class ConfidentialLedgerClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ConfidentialLedgerClientOptionalParams); + // (undocumented) + apiVersion: string; + checkNameAvailability(nameAvailabilityRequest: CheckNameAvailabilityRequest, options?: CheckNameAvailabilityOptionalParams): Promise; + // (undocumented) + ledger: Ledger; + // (undocumented) + operations: Operations; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface ConfidentialLedgerClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface ConfidentialLedgerList { + nextLink?: string; + value?: ConfidentialLedger[]; +} + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export enum KnownCheckNameAvailabilityReason { + // (undocumented) + AlreadyExists = "AlreadyExists", + // (undocumented) + Invalid = "Invalid" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownLedgerRoleName { + // (undocumented) + Administrator = "Administrator", + // (undocumented) + Contributor = "Contributor", + // (undocumented) + Reader = "Reader" +} + +// @public +export enum KnownLedgerType { + // (undocumented) + Private = "Private", + // (undocumented) + Public = "Public", + // (undocumented) + Unknown = "Unknown" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Unknown = "Unknown", + // (undocumented) + Updating = "Updating" +} + +// @public +export interface Ledger { + beginCreate(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerCreateOptionalParams): Promise, LedgerCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, ledgerName: string, options?: LedgerDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, ledgerName: string, options?: LedgerDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerUpdateOptionalParams): Promise, LedgerUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, ledgerName: string, confidentialLedger: ConfidentialLedger, options?: LedgerUpdateOptionalParams): Promise; + get(resourceGroupName: string, ledgerName: string, options?: LedgerGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: LedgerListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: LedgerListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface LedgerCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type LedgerCreateResponse = ConfidentialLedger; + +// @public +export interface LedgerDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface LedgerGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LedgerGetResponse = ConfidentialLedger; + +// @public +export interface LedgerListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type LedgerListByResourceGroupNextResponse = ConfidentialLedgerList; + +// @public +export interface LedgerListByResourceGroupOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type LedgerListByResourceGroupResponse = ConfidentialLedgerList; + +// @public +export interface LedgerListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type LedgerListBySubscriptionNextResponse = ConfidentialLedgerList; + +// @public +export interface LedgerListBySubscriptionOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type LedgerListBySubscriptionResponse = ConfidentialLedgerList; + +// @public +export interface LedgerProperties { + aadBasedSecurityPrincipals?: AADBasedSecurityPrincipal[]; + certBasedSecurityPrincipals?: CertBasedSecurityPrincipal[]; + readonly identityServiceUri?: string; + readonly ledgerInternalNamespace?: string; + readonly ledgerName?: string; + ledgerType?: LedgerType; + readonly ledgerUri?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export type LedgerRoleName = string; + +// @public +export type LedgerType = string; + +// @public +export interface LedgerUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type LedgerUpdateResponse = ConfidentialLedger; + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = ResourceProviderOperationList; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = ResourceProviderOperationList; + +// @public +export type ProvisioningState = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface ResourceLocation { + location?: string; +} + +// @public +export interface ResourceProviderOperationDefinition { + display?: ResourceProviderOperationDisplay; + isDataAction?: boolean; + name?: string; +} + +// @public +export interface ResourceProviderOperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface ResourceProviderOperationList { + readonly nextLink?: string; + readonly value?: ResourceProviderOperationDefinition[]; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface Tags { + tags?: { + [propertyName: string]: string; + }; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/confidentialledger/arm-confidentialledger/rollup.config.js b/sdk/confidentialledger/arm-confidentialledger/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/rollup.config.js @@ -0,0 +1,122 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/confidentialledger/arm-confidentialledger/src/confidentialLedgerClient.ts b/sdk/confidentialledger/arm-confidentialledger/src/confidentialLedgerClient.ts new file mode 100644 index 000000000000..5a85dbc22f9d --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/confidentialLedgerClient.ts @@ -0,0 +1,181 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import * as coreAuth from "@azure/core-auth"; +import { OperationsImpl, LedgerImpl } from "./operations"; +import { Operations, Ledger } from "./operationsInterfaces"; +import * as Parameters from "./models/parameters"; +import * as Mappers from "./models/mappers"; +import { + ConfidentialLedgerClientOptionalParams, + CheckNameAvailabilityRequest, + CheckNameAvailabilityOptionalParams, + CheckNameAvailabilityOperationResponse +} from "./models"; + +export class ConfidentialLedgerClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the ConfidentialLedgerClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: ConfidentialLedgerClientOptionalParams + ) { + 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: ConfidentialLedgerClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-confidentialledger/1.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-05-13"; + this.operations = new OperationsImpl(this); + this.ledger = new LedgerImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + /** + * To check whether a resource name is available. + * @param nameAvailabilityRequest Name availability request payload. + * @param options The options parameters. + */ + checkNameAvailability( + nameAvailabilityRequest: CheckNameAvailabilityRequest, + options?: CheckNameAvailabilityOptionalParams + ): Promise { + return this.sendOperationRequest( + { nameAvailabilityRequest, options }, + checkNameAvailabilityOperationSpec + ); + } + + operations: Operations; + ledger: Ledger; +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/checkNameAvailability", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.CheckNameAvailabilityResponse + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.nameAvailabilityRequest, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/index.ts b/sdk/confidentialledger/arm-confidentialledger/src/index.ts new file mode 100644 index 000000000000..e7aa2480f49f --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/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 { ConfidentialLedgerClient } from "./confidentialLedgerClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/lroImpl.ts b/sdk/confidentialledger/arm-confidentialledger/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/confidentialledger/arm-confidentialledger/src/models/index.ts b/sdk/confidentialledger/arm-confidentialledger/src/models/index.ts new file mode 100644 index 000000000000..fba3e508cd31 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/models/index.ts @@ -0,0 +1,442 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +/** List containing this Resource Provider's available operations. */ +export interface ResourceProviderOperationList { + /** + * Resource provider operations list. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: ResourceProviderOperationDefinition[]; + /** + * The URI that can be used to request the next page for list of Azure operations. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Describes the Resource Provider Operation. */ +export interface ResourceProviderOperationDefinition { + /** Resource provider operation name. */ + name?: string; + /** Indicates whether the operation is data action or not. */ + isDataAction?: boolean; + /** Details about the operations */ + display?: ResourceProviderOperationDisplay; +} + +/** Describes the properties of the Operation. */ +export interface ResourceProviderOperationDisplay { + /** Name of the resource provider. */ + provider?: string; + /** Name of the resource type. */ + resource?: string; + /** Name of the resource provider operation. */ + operation?: string; + /** Description of the resource provider operation. */ + description?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** The check availability request body. */ +export interface CheckNameAvailabilityRequest { + /** The name of the resource for which availability needs to be checked. */ + name?: string; + /** The resource type. */ + type?: string; +} + +/** The check availability result. */ +export interface CheckNameAvailabilityResponse { + /** Indicates if the resource name is available. */ + nameAvailable?: boolean; + /** The reason why the given name is not available. */ + reason?: CheckNameAvailabilityReason; + /** Detailed reason why the given name is available. */ + message?: string; +} + +/** Additional Confidential Ledger properties. */ +export interface LedgerProperties { + /** + * Unique name for the Confidential Ledger. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ledgerName?: string; + /** + * Endpoint for calling Ledger Service. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ledgerUri?: string; + /** + * Endpoint for accessing network identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly identityServiceUri?: string; + /** + * Internal namespace for the Ledger + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ledgerInternalNamespace?: string; + /** Type of Confidential Ledger */ + ledgerType?: LedgerType; + /** + * Provisioning state of Ledger Resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Array of all AAD based Security Principals. */ + aadBasedSecurityPrincipals?: AADBasedSecurityPrincipal[]; + /** Array of all cert based Security Principals. */ + certBasedSecurityPrincipals?: CertBasedSecurityPrincipal[]; +} + +/** AAD based security principal with associated Ledger RoleName */ +export interface AADBasedSecurityPrincipal { + /** UUID/GUID based Principal Id of the Security Principal */ + principalId?: string; + /** UUID/GUID based Tenant Id of the Security Principal */ + tenantId?: string; + /** LedgerRole associated with the Security Principal of Ledger */ + ledgerRoleName?: LedgerRoleName; +} + +/** Cert based security principal with Ledger RoleName */ +export interface CertBasedSecurityPrincipal { + /** Public key of the user cert (.pem or .cer) */ + cert?: string; + /** LedgerRole associated with the Security Principal of Ledger */ + ledgerRoleName?: LedgerRoleName; +} + +/** An Azure resource. */ +export interface Resource { + /** + * Name of the Resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Fully qualified resource Id for the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The type of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Metadata pertaining to creation and last modification of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** Location of the ARM Resource */ +export interface ResourceLocation { + /** The Azure location where the Confidential Ledger is running. */ + location?: string; +} + +/** Tags for Confidential Ledger Resource */ +export interface Tags { + /** Additional tags for Confidential Ledger */ + tags?: { [propertyName: string]: string }; +} + +/** Object that includes an array of Confidential Ledgers and a possible link for next set. */ +export interface ConfidentialLedgerList { + /** List of Confidential Ledgers */ + value?: ConfidentialLedger[]; + /** The URL the client should use to fetch the next page (per server side paging). */ + nextLink?: string; +} + +/** Confidential Ledger. Contains the properties of Confidential Ledger Resource. */ +export type ConfidentialLedger = Resource & + ResourceLocation & + Tags & { + /** Properties of Confidential Ledger Resource. */ + properties?: LedgerProperties; + }; + +/** Known values of {@link CheckNameAvailabilityReason} that the service accepts. */ +export enum KnownCheckNameAvailabilityReason { + Invalid = "Invalid", + AlreadyExists = "AlreadyExists" +} + +/** + * Defines values for CheckNameAvailabilityReason. \ + * {@link KnownCheckNameAvailabilityReason} can be used interchangeably with CheckNameAvailabilityReason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Invalid** \ + * **AlreadyExists** + */ +export type CheckNameAvailabilityReason = string; + +/** Known values of {@link LedgerType} that the service accepts. */ +export enum KnownLedgerType { + Unknown = "Unknown", + Public = "Public", + Private = "Private" +} + +/** + * Defines values for LedgerType. \ + * {@link KnownLedgerType} can be used interchangeably with LedgerType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **Public** \ + * **Private** + */ +export type LedgerType = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Unknown = "Unknown", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Creating = "Creating", + Deleting = "Deleting", + Updating = "Updating" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Creating** \ + * **Deleting** \ + * **Updating** + */ +export type ProvisioningState = string; + +/** Known values of {@link LedgerRoleName} that the service accepts. */ +export enum KnownLedgerRoleName { + Reader = "Reader", + Contributor = "Contributor", + Administrator = "Administrator" +} + +/** + * Defines values for LedgerRoleName. \ + * {@link KnownLedgerRoleName} can be used interchangeably with LedgerRoleName, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Reader** \ + * **Contributor** \ + * **Administrator** + */ +export type LedgerRoleName = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = ResourceProviderOperationList; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = ResourceProviderOperationList; + +/** Optional parameters. */ +export interface CheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkNameAvailability operation. */ +export type CheckNameAvailabilityOperationResponse = CheckNameAvailabilityResponse; + +/** Optional parameters. */ +export interface LedgerGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type LedgerGetResponse = ConfidentialLedger; + +/** Optional parameters. */ +export interface LedgerDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface LedgerCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type LedgerCreateResponse = ConfidentialLedger; + +/** Optional parameters. */ +export interface LedgerUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type LedgerUpdateResponse = ConfidentialLedger; + +/** Optional parameters. */ +export interface LedgerListByResourceGroupOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public' */ + filter?: string; +} + +/** Contains response data for the listByResourceGroup operation. */ +export type LedgerListByResourceGroupResponse = ConfidentialLedgerList; + +/** Optional parameters. */ +export interface LedgerListBySubscriptionOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public' */ + filter?: string; +} + +/** Contains response data for the listBySubscription operation. */ +export type LedgerListBySubscriptionResponse = ConfidentialLedgerList; + +/** Optional parameters. */ +export interface LedgerListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public' */ + filter?: string; +} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type LedgerListByResourceGroupNextResponse = ConfidentialLedgerList; + +/** Optional parameters. */ +export interface LedgerListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public' */ + filter?: string; +} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type LedgerListBySubscriptionNextResponse = ConfidentialLedgerList; + +/** Optional parameters. */ +export interface ConfidentialLedgerClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/confidentialledger/arm-confidentialledger/src/models/mappers.ts b/sdk/confidentialledger/arm-confidentialledger/src/models/mappers.ts new file mode 100644 index 000000000000..1793484fb218 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/models/mappers.ts @@ -0,0 +1,524 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const ResourceProviderOperationList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceProviderOperationList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceProviderOperationDefinition" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ResourceProviderOperationDefinition: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceProviderOperationDefinition", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "ResourceProviderOperationDisplay" + } + } + } + } +}; + +export const ResourceProviderOperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceProviderOperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const CheckNameAvailabilityRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityRequest", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityResponse", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const LedgerProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LedgerProperties", + modelProperties: { + ledgerName: { + serializedName: "ledgerName", + readOnly: true, + type: { + name: "String" + } + }, + ledgerUri: { + serializedName: "ledgerUri", + readOnly: true, + type: { + name: "String" + } + }, + identityServiceUri: { + serializedName: "identityServiceUri", + readOnly: true, + type: { + name: "String" + } + }, + ledgerInternalNamespace: { + serializedName: "ledgerInternalNamespace", + readOnly: true, + type: { + name: "String" + } + }, + ledgerType: { + serializedName: "ledgerType", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + aadBasedSecurityPrincipals: { + serializedName: "aadBasedSecurityPrincipals", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AADBasedSecurityPrincipal" + } + } + } + }, + certBasedSecurityPrincipals: { + serializedName: "certBasedSecurityPrincipals", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CertBasedSecurityPrincipal" + } + } + } + } + } + } +}; + +export const AADBasedSecurityPrincipal: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AADBasedSecurityPrincipal", + modelProperties: { + principalId: { + serializedName: "principalId", + type: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + type: { + name: "String" + } + }, + ledgerRoleName: { + serializedName: "ledgerRoleName", + type: { + name: "String" + } + } + } + } +}; + +export const CertBasedSecurityPrincipal: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CertBasedSecurityPrincipal", + modelProperties: { + cert: { + serializedName: "cert", + type: { + name: "String" + } + }, + ledgerRoleName: { + serializedName: "ledgerRoleName", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ResourceLocation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceLocation", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + } + } + } +}; + +export const Tags: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Tags", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const ConfidentialLedgerList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfidentialLedgerList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ConfidentialLedger" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ConfidentialLedger: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConfidentialLedger", + modelProperties: { + ...Resource.type.modelProperties, + ...ResourceLocation.type.modelProperties, + ...Tags.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "LedgerProperties" + } + } + } + } +}; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/models/parameters.ts b/sdk/confidentialledger/arm-confidentialledger/src/models/parameters.ts new file mode 100644 index 000000000000..4ffa6f786f43 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/models/parameters.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + CheckNameAvailabilityRequest as CheckNameAvailabilityRequestMapper, + ConfidentialLedger as ConfidentialLedgerMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-05-13", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const nameAvailabilityRequest: OperationParameter = { + parameterPath: "nameAvailabilityRequest", + mapper: CheckNameAvailabilityRequestMapper +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 3 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const ledgerName: OperationURLParameter = { + parameterPath: "ledgerName", + mapper: { + constraints: { + Pattern: new RegExp("^[a-zA-Z0-9]") + }, + serializedName: "ledgerName", + required: true, + type: { + name: "String" + } + } +}; + +export const confidentialLedger: OperationParameter = { + parameterPath: "confidentialLedger", + mapper: ConfidentialLedgerMapper +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], + mapper: { + serializedName: "$filter", + type: { + name: "String" + } + } +}; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operations/index.ts b/sdk/confidentialledger/arm-confidentialledger/src/operations/index.ts new file mode 100644 index 000000000000..55550f1acb43 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/operations/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./ledger"; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operations/ledger.ts b/sdk/confidentialledger/arm-confidentialledger/src/operations/ledger.ts new file mode 100644 index 000000000000..df4e2fd7b016 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/operations/ledger.ts @@ -0,0 +1,674 @@ +/* + * 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 { Ledger } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ConfidentialLedgerClient } from "../confidentialLedgerClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ConfidentialLedger, + LedgerListByResourceGroupNextOptionalParams, + LedgerListByResourceGroupOptionalParams, + LedgerListBySubscriptionNextOptionalParams, + LedgerListBySubscriptionOptionalParams, + LedgerGetOptionalParams, + LedgerGetResponse, + LedgerDeleteOptionalParams, + LedgerCreateOptionalParams, + LedgerCreateResponse, + LedgerUpdateOptionalParams, + LedgerUpdateResponse, + LedgerListByResourceGroupResponse, + LedgerListBySubscriptionResponse, + LedgerListByResourceGroupNextResponse, + LedgerListBySubscriptionNextResponse +} from "../models"; + +/// +/** Class containing Ledger operations. */ +export class LedgerImpl implements Ledger { + private readonly client: ConfidentialLedgerClient; + + /** + * Initialize a new instance of the class Ledger class. + * @param client Reference to the service client + */ + constructor(client: ConfidentialLedgerClient) { + this.client = client; + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: LedgerListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: LedgerListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: LedgerListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * @param options The options parameters. + */ + public listBySubscription( + options?: LedgerListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: LedgerListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listBySubscriptionPagingAll( + options?: LedgerListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Retrieves the properties of a Confidential Ledger. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param options The options parameters. + */ + get( + resourceGroupName: string, + ledgerName: string, + options?: LedgerGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, ledgerName, options }, + getOperationSpec + ); + } + + /** + * Deletes an existing Confidential Ledger. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + ledgerName: string, + options?: LedgerDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, ledgerName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Deletes an existing Confidential Ledger. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + ledgerName: string, + options?: LedgerDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + ledgerName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Create Request Body + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedger, + options?: LedgerCreateOptionalParams + ): Promise< + PollerLike, LedgerCreateResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, ledgerName, confidentialLedger, options }, + createOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Create Request Body + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedger, + options?: LedgerCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + ledgerName, + confidentialLedger, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates properties of Confidential Ledger + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger request body for Updating Ledger + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedger, + options?: LedgerUpdateOptionalParams + ): Promise< + PollerLike, LedgerUpdateResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, ledgerName, confidentialLedger, options }, + updateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + await poller.poll(); + return poller; + } + + /** + * Updates properties of Confidential Ledger + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger request body for Updating Ledger + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedger, + options?: LedgerUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + ledgerName, + confidentialLedger, + options + ); + return poller.pollUntilDone(); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: LedgerListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * @param options The options parameters. + */ + private _listBySubscription( + options?: LedgerListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: LedgerListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: LedgerListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedger + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.ledgerName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.ledgerName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedger + }, + 201: { + bodyMapper: Mappers.ConfidentialLedger + }, + 202: { + bodyMapper: Mappers.ConfidentialLedger + }, + 204: { + bodyMapper: Mappers.ConfidentialLedger + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.confidentialLedger, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.ledgerName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers/{ledgerName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedger + }, + 201: { + bodyMapper: Mappers.ConfidentialLedger + }, + 202: { + bodyMapper: Mappers.ConfidentialLedger + }, + 204: { + bodyMapper: Mappers.ConfidentialLedger + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.confidentialLedger, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.ledgerName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger/ledgers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedgerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/ledgers/", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedgerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedgerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ConfidentialLedgerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operations/operations.ts b/sdk/confidentialledger/arm-confidentialledger/src/operations/operations.ts new file mode 100644 index 000000000000..55a87df78010 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/operations/operations.ts @@ -0,0 +1,137 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { ConfidentialLedgerClient } from "../confidentialLedgerClient"; +import { + ResourceProviderOperationDefinition, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; + +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: ConfidentialLedgerClient; + + /** + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client + */ + constructor(client: ConfidentialLedgerClient) { + this.client = client; + } + + /** + * Retrieves a list of available API operations + * @param options The options parameters. + */ + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Retrieves a list of available API operations + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ConfidentialLedger/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceProviderOperationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceProviderOperationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/index.ts b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..55550f1acb43 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/index.ts @@ -0,0 +1,10 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./ledger"; diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/ledger.ts b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/ledger.ts new file mode 100644 index 000000000000..249212c68f9f --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/ledger.ts @@ -0,0 +1,132 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ConfidentialLedger, + LedgerListByResourceGroupOptionalParams, + LedgerListBySubscriptionOptionalParams, + LedgerGetOptionalParams, + LedgerGetResponse, + LedgerDeleteOptionalParams, + LedgerCreateOptionalParams, + LedgerCreateResponse, + LedgerUpdateOptionalParams, + LedgerUpdateResponse +} from "../models"; + +/// +/** Interface representing a Ledger. */ +export interface Ledger { + /** + * Retrieves the properties of all Confidential Ledgers. + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: LedgerListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Retrieves the properties of all Confidential Ledgers. + * @param options The options parameters. + */ + listBySubscription( + options?: LedgerListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Retrieves the properties of a Confidential Ledger. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param options The options parameters. + */ + get( + resourceGroupName: string, + ledgerName: string, + options?: LedgerGetOptionalParams + ): Promise; + /** + * Deletes an existing Confidential Ledger. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + ledgerName: string, + options?: LedgerDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes an existing Confidential Ledger. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + ledgerName: string, + options?: LedgerDeleteOptionalParams + ): Promise; + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Create Request Body + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedger, + options?: LedgerCreateOptionalParams + ): Promise< + PollerLike, LedgerCreateResponse> + >; + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger Create Request Body + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedger, + options?: LedgerCreateOptionalParams + ): Promise; + /** + * Updates properties of Confidential Ledger + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger request body for Updating Ledger + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedger, + options?: LedgerUpdateOptionalParams + ): Promise< + PollerLike, LedgerUpdateResponse> + >; + /** + * Updates properties of Confidential Ledger + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger + * @param confidentialLedger Confidential Ledger request body for Updating Ledger + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + ledgerName: string, + confidentialLedger: ConfidentialLedger, + options?: LedgerUpdateOptionalParams + ): Promise; +} diff --git a/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/operations.ts b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/operations.ts new file mode 100644 index 000000000000..3ab5c608ab2f --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/src/operationsInterfaces/operations.ts @@ -0,0 +1,25 @@ +/* + * 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 { + ResourceProviderOperationDefinition, + OperationsListOptionalParams +} from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Retrieves a list of available API operations + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/confidentialledger/arm-confidentialledger/test/sampleTest.ts b/sdk/confidentialledger/arm-confidentialledger/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/confidentialledger/arm-confidentialledger/tsconfig.json b/sdk/confidentialledger/arm-confidentialledger/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/confidentialledger/arm-confidentialledger/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/confidentialledger/ci.mgmt.yml b/sdk/confidentialledger/ci.mgmt.yml new file mode 100644 index 000000000000..b571a1013827 --- /dev/null +++ b/sdk/confidentialledger/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/confidentialledger/arm-confidentialledger + - sdk/confidentialledger/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/confidentialledger/arm-confidentialledger + - sdk/confidentialledger/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: confidentialledger + Artifacts: + - name: azure-arm-confidentialledger + safeName: azurearmconfidentialledger + \ No newline at end of file diff --git a/sdk/confidentialledger/ci.yml b/sdk/confidentialledger/ci.yml index 81aa0cd58730..5a0497df09c9 100644 --- a/sdk/confidentialledger/ci.yml +++ b/sdk/confidentialledger/ci.yml @@ -1,5 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. - + trigger: branches: include: @@ -9,7 +9,9 @@ trigger: paths: include: - sdk/confidentialledger/ - + exclude: + - sdk/confidentialledger/arm-confidentialledger + - sdk/confidentialledger/ci.mgmt.yml pr: branches: include: @@ -20,11 +22,13 @@ pr: paths: include: - sdk/confidentialledger/ - + exclude: + - sdk/confidentialledger/arm-confidentialledger + - sdk/confidentialledger/ci.mgmt.yml extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: confidentialledger Artifacts: - name: azure-rest-confidential-ledger - safeName: azurerestconfidentialledger \ No newline at end of file + safeName: azurerestconfidentialledger