diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index e02cbe3fa1ef..dda8e8a590f0 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -79,6 +79,7 @@ specifiers: '@rush-temp/arm-eventhub-profile-2020-09-01-hybrid': file:./projects/arm-eventhub-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-extendedlocation': file:./projects/arm-extendedlocation.tgz '@rush-temp/arm-features': file:./projects/arm-features.tgz + '@rush-temp/arm-fluidrelay': file:./projects/arm-fluidrelay.tgz '@rush-temp/arm-frontdoor': file:./projects/arm-frontdoor.tgz '@rush-temp/arm-hanaonazure': file:./projects/arm-hanaonazure.tgz '@rush-temp/arm-hardwaresecuritymodules': file:./projects/arm-hardwaresecuritymodules.tgz @@ -373,6 +374,7 @@ dependencies: '@rush-temp/arm-eventhub-profile-2020-09-01-hybrid': file:projects/arm-eventhub-profile-2020-09-01-hybrid.tgz '@rush-temp/arm-extendedlocation': file:projects/arm-extendedlocation.tgz '@rush-temp/arm-features': file:projects/arm-features.tgz + '@rush-temp/arm-fluidrelay': file:projects/arm-fluidrelay.tgz '@rush-temp/arm-frontdoor': file:projects/arm-frontdoor.tgz '@rush-temp/arm-hanaonazure': file:projects/arm-hanaonazure.tgz '@rush-temp/arm-hardwaresecuritymodules': file:projects/arm-hardwaresecuritymodules.tgz @@ -2967,7 +2969,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: @@ -3216,7 +3218,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: @@ -3361,7 +3363,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: @@ -3499,7 +3501,7 @@ packages: dev: false /concat-map/0.0.1: - resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: false /concurrently/6.5.1: @@ -3562,7 +3564,7 @@ packages: dev: false /cookie-signature/1.0.6: - resolution: {integrity: sha1-4wOogrNCzD7oylE6eZmXNNqzriw=} + resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} dev: false /cookie/0.4.2: @@ -3664,7 +3666,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.3.0: @@ -3917,11 +3919,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.195: @@ -4790,7 +4792,7 @@ packages: dev: false /fresh/0.5.2: - resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=} + resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} engines: {node: '>= 0.6'} dev: false @@ -4930,7 +4932,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: @@ -6301,7 +6303,7 @@ 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 @@ -6311,7 +6313,7 @@ packages: 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: @@ -6671,7 +6673,7 @@ packages: dev: false /noms/0.0.0: - resolution: {integrity: sha1-2o69nzr51nYJGbJ9nNyAkqczKFk=} + resolution: {integrity: sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==} dependencies: inherits: 2.0.4 readable-stream: 1.0.34 @@ -8812,7 +8814,7 @@ packages: dev: false /utils-merge/1.0.1: - resolution: {integrity: sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=} + resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} engines: {node: '>= 0.4.0'} dev: false @@ -11504,6 +11506,31 @@ packages: - supports-color dev: false + file:projects/arm-fluidrelay.tgz: + resolution: {integrity: sha512-wlUf7GwSL7Fw20hrSS+TXCtRyMqfSkeZtkBAhkU0ONJwwI+dui5Y2061K9/aNT/YS0IP2+rkVBdQYNP9FFOqhw==, tarball: file:projects/arm-fluidrelay.tgz} + name: '@rush-temp/arm-fluidrelay' + version: 0.0.0 + dependencies: + '@microsoft/api-extractor': 7.18.11 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.76.0 + '@rollup/plugin-json': 4.1.0_rollup@2.76.0 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.76.0 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.76.0 + '@types/chai': 4.3.1 + chai: 4.3.6 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.76.0 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.76.0 + tslib: 2.4.0 + typescript: 4.2.4 + uglify-js: 3.16.2 + transitivePeerDependencies: + - '@types/node' + dev: false + file:projects/arm-frontdoor.tgz: resolution: {integrity: sha512-0yMRsjqRI2fi/Rd6yR+Re/KM3iZltmLGYmL72lsKup0zg27Bcp4LvdmRixKktb8WTswsPDCY4ZtmE7xc1tkNPA==, tarball: file:projects/arm-frontdoor.tgz} name: '@rush-temp/arm-frontdoor' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index 3a4f6ff8419f..81ff9074b53e 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -13,3 +13,5 @@ https://docs.microsoft.com/javascript/api/@azure/arm-networkfunction?view=azure- https://docs.microsoft.com/en-us/javascript/api/@azure-rest/arm-containerservice?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure-rest/arm-containerservice?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure-rest/arm-servicefabric?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/arm-fluidrelay +https://docs.microsoft.com/javascript/api/@azure/arm-fluidrelay?view=azure-node-preview diff --git a/rush.json b/rush.json index 7aba9bc50999..57c4665d7e4e 100644 --- a/rush.json +++ b/rush.json @@ -1779,6 +1779,11 @@ "packageName": "@azure/arm-networkfunction", "projectFolder": "sdk/networkfunction/arm-networkfunction", "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-fluidrelay", + "projectFolder": "sdk/fluidrelay/arm-fluidrelay", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/fluidrelay/arm-fluidrelay/CHANGELOG.md b/sdk/fluidrelay/arm-fluidrelay/CHANGELOG.md new file mode 100644 index 000000000000..a8d11b9f9f79 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2022-07-18) + +The package of @azure/arm-fluidrelay 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/fluidrelay/arm-fluidrelay/LICENSE b/sdk/fluidrelay/arm-fluidrelay/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/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/fluidrelay/arm-fluidrelay/README.md b/sdk/fluidrelay/arm-fluidrelay/README.md new file mode 100644 index 000000000000..5258a942b8d0 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/README.md @@ -0,0 +1,109 @@ +# Azure FluidRelayManagement client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure FluidRelayManagement client. + + + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fluidrelay/arm-fluidrelay) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-fluidrelay) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-fluidrelay) | +[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-fluidrelay` package + +Install the Azure FluidRelayManagement client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-fluidrelay +``` + +### Create and authenticate a `FluidRelayManagementClient` + +To create a client object to access the Azure FluidRelayManagement API, you will need the `endpoint` of your Azure FluidRelayManagement resource and a `credential`. The Azure FluidRelayManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure FluidRelayManagement 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 FluidRelayManagement** 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 { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +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 FluidRelayManagementClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new FluidRelayManagementClient(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 + +### FluidRelayManagementClient + +`FluidRelayManagementClient` is the primary interface for developers using the Azure FluidRelayManagement client library. Explore the methods on this client object to understand the different features of the Azure FluidRelayManagement 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%2Ffluidrelay%2Farm-fluidrelay%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/fluidrelay/arm-fluidrelay/_meta.json b/sdk/fluidrelay/arm-fluidrelay/_meta.json new file mode 100644 index 000000000000..4588d560d65a --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "c03c258c7a01a7d57b3110cc20e2e76752b6f2d6", + "readme": "specification/fluidrelay/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\fluidrelay\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.1 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.4.0", + "use": "@autorest/typescript@6.0.0-rc.1" +} \ No newline at end of file diff --git a/sdk/fluidrelay/arm-fluidrelay/api-extractor.json b/sdk/fluidrelay/arm-fluidrelay/api-extractor.json new file mode 100644 index 000000000000..922d383c99f8 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/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-fluidrelay.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/fluidrelay/arm-fluidrelay/package.json b/sdk/fluidrelay/arm-fluidrelay/package.json new file mode 100644 index 000000000000..40f1e368a3a5 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/package.json @@ -0,0 +1,119 @@ +{ + "name": "@azure/arm-fluidrelay", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for FluidRelayManagementClient.", + "version": "1.0.0", + "engines": { + "node": ">=12.0.0" + }, + "dependencies": { + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.5.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-fluidrelay.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", + "@types/chai": "^4.2.8", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fluidrelay/arm-fluidrelay", + "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" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/fluidRelayManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": [ + "azure" + ], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-fluidrelay?view=azure-node-preview" + } +} \ No newline at end of file diff --git a/sdk/fluidrelay/arm-fluidrelay/recordings/node/my_test/recording_sample_test.json b/sdk/fluidrelay/arm-fluidrelay/recordings/node/my_test/recording_sample_test.json new file mode 100644 index 000000000000..f721723386d8 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/recordings/node/my_test/recording_sample_test.json @@ -0,0 +1,4 @@ +{ + "Entries": [], + "Variables": {} +} diff --git a/sdk/fluidrelay/arm-fluidrelay/review/arm-fluidrelay.api.md b/sdk/fluidrelay/arm-fluidrelay/review/arm-fluidrelay.api.md new file mode 100644 index 000000000000..a733049b3d10 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/review/arm-fluidrelay.api.md @@ -0,0 +1,370 @@ +## API Report File for "@azure/arm-fluidrelay" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; + +// @public +export type CmkIdentityType = "SystemAssigned" | "UserAssigned"; + +// @public +export type CreatedByType = string; + +// @public +export interface CustomerManagedKeyEncryptionProperties { + keyEncryptionKeyIdentity?: CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity; + keyEncryptionKeyUrl?: string; +} + +// @public +export interface CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity { + identityType?: CmkIdentityType; + userAssignedIdentityResourceId?: string; +} + +// @public +export interface EncryptionProperties { + customerManagedKeyEncryption?: CustomerManagedKeyEncryptionProperties; +} + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface FluidRelayContainer extends ProxyResource { + readonly creationTime?: Date; + readonly frsContainerId?: string; + readonly frsTenantId?: string; + readonly lastAccessTime?: Date; + readonly provisioningState?: ProvisioningState; + readonly systemData?: SystemData; +} + +// @public +export interface FluidRelayContainerList { + readonly nextLink?: string; + value?: FluidRelayContainer[]; +} + +// @public +export interface FluidRelayContainers { + delete(resourceGroup: string, fluidRelayServerName: string, fluidRelayContainerName: string, options?: FluidRelayContainersDeleteOptionalParams): Promise; + get(resourceGroup: string, fluidRelayServerName: string, fluidRelayContainerName: string, options?: FluidRelayContainersGetOptionalParams): Promise; + listByFluidRelayServers(resourceGroup: string, fluidRelayServerName: string, options?: FluidRelayContainersListByFluidRelayServersOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface FluidRelayContainersDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface FluidRelayContainersGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayContainersGetResponse = FluidRelayContainer; + +// @public +export interface FluidRelayContainersListByFluidRelayServersNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayContainersListByFluidRelayServersNextResponse = FluidRelayContainerList; + +// @public +export interface FluidRelayContainersListByFluidRelayServersOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayContainersListByFluidRelayServersResponse = FluidRelayContainerList; + +// @public +export interface FluidRelayEndpoints { + readonly ordererEndpoints?: string[]; + readonly serviceEndpoints?: string[]; + readonly storageEndpoints?: string[]; +} + +// @public (undocumented) +export class FluidRelayManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: FluidRelayManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + fluidRelayContainers: FluidRelayContainers; + // (undocumented) + fluidRelayOperations: FluidRelayOperations; + // (undocumented) + fluidRelayServers: FluidRelayServers; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface FluidRelayManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface FluidRelayOperations { + list(options?: FluidRelayOperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface FluidRelayOperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayOperationsListNextResponse = OperationListResult; + +// @public +export interface FluidRelayOperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayOperationsListResponse = OperationListResult; + +// @public +export interface FluidRelayServer extends TrackedResource { + encryption?: EncryptionProperties; + readonly fluidRelayEndpoints?: FluidRelayEndpoints; + readonly frsTenantId?: string; + identity?: Identity; + provisioningState?: ProvisioningState; + storagesku?: StorageSKU; + readonly systemData?: SystemData; +} + +// @public +export interface FluidRelayServerKeys { + readonly key1?: string; + readonly key2?: string; +} + +// @public +export interface FluidRelayServerList { + nextLink?: string; + value: FluidRelayServer[]; +} + +// @public +export interface FluidRelayServers { + createOrUpdate(resourceGroup: string, fluidRelayServerName: string, resource: FluidRelayServer, options?: FluidRelayServersCreateOrUpdateOptionalParams): Promise; + delete(resourceGroup: string, fluidRelayServerName: string, options?: FluidRelayServersDeleteOptionalParams): Promise; + get(resourceGroup: string, fluidRelayServerName: string, options?: FluidRelayServersGetOptionalParams): Promise; + listByResourceGroup(resourceGroup: string, options?: FluidRelayServersListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: FluidRelayServersListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + listKeys(resourceGroup: string, fluidRelayServerName: string, options?: FluidRelayServersListKeysOptionalParams): Promise; + regenerateKey(resourceGroup: string, fluidRelayServerName: string, parameters: RegenerateKeyRequest, options?: FluidRelayServersRegenerateKeyOptionalParams): Promise; + update(resourceGroup: string, fluidRelayServerName: string, resource: FluidRelayServerUpdate, options?: FluidRelayServersUpdateOptionalParams): Promise; +} + +// @public +export interface FluidRelayServersCreateOrUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersCreateOrUpdateResponse = FluidRelayServer; + +// @public +export interface FluidRelayServersDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface FluidRelayServersGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersGetResponse = FluidRelayServer; + +// @public +export interface FluidRelayServersListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersListByResourceGroupNextResponse = FluidRelayServerList; + +// @public +export interface FluidRelayServersListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersListByResourceGroupResponse = FluidRelayServerList; + +// @public +export interface FluidRelayServersListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersListBySubscriptionNextResponse = FluidRelayServerList; + +// @public +export interface FluidRelayServersListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersListBySubscriptionResponse = FluidRelayServerList; + +// @public +export interface FluidRelayServersListKeysOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersListKeysResponse = FluidRelayServerKeys; + +// @public +export interface FluidRelayServersRegenerateKeyOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersRegenerateKeyResponse = FluidRelayServerKeys; + +// @public +export interface FluidRelayServersUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type FluidRelayServersUpdateResponse = FluidRelayServer; + +// @public +export interface FluidRelayServerUpdate { + encryption?: EncryptionProperties; + identity?: Identity; + location?: string; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface Identity { + readonly principalId?: string; + readonly tenantId?: string; + type?: ResourceIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentitiesValue; + }; +} + +// @public +export type KeyName = "key1" | "key2"; + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownProvisioningState { + Canceled = "Canceled", + Failed = "Failed", + Succeeded = "Succeeded" +} + +// @public +export enum KnownStorageSKU { + Basic = "basic", + Standard = "standard" +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationListResult { + nextLink?: string; + value?: OperationResult[]; +} + +// @public +export interface OperationResult { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; +} + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource extends Resource { +} + +// @public +export interface RegenerateKeyRequest { + keyName: KeyName; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export type ResourceIdentityType = "SystemAssigned" | "UserAssigned" | "SystemAssigned, UserAssigned" | "None"; + +// @public +export type StorageSKU = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: { + [propertyName: string]: string; + }; +} + +// @public (undocumented) +export interface UserAssignedIdentitiesValue { + readonly clientId?: string; + readonly principalId?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/fluidrelay/arm-fluidrelay/rollup.config.js b/sdk/fluidrelay/arm-fluidrelay/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/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/fluidrelay/arm-fluidrelay/sample.env b/sdk/fluidrelay/arm-fluidrelay/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersDeleteSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersDeleteSample.ts new file mode 100644 index 000000000000..def53a31f961 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a Fluid Relay container. + * + * @summary Delete a Fluid Relay container. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Delete.json + */ +async function deleteAFluidRelayContainer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const fluidRelayContainerName = "myFluidRelayContainer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayContainers.delete( + resourceGroup, + fluidRelayServerName, + fluidRelayContainerName + ); + console.log(result); +} + +deleteAFluidRelayContainer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersGetSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersGetSample.ts new file mode 100644 index 000000000000..37637abede57 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a Fluid Relay container. + * + * @summary Get a Fluid Relay container. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Get.json + */ +async function getFluidRelayContainerDetails() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const fluidRelayContainerName = "myFluidRelayContainer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayContainers.get( + resourceGroup, + fluidRelayServerName, + fluidRelayContainerName + ); + console.log(result); +} + +getFluidRelayContainerDetails().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersListByFluidRelayServersSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersListByFluidRelayServersSample.ts new file mode 100644 index 000000000000..8ccfa3000977 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayContainersListByFluidRelayServersSample.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all Fluid Relay containers which are children of a given Fluid Relay server. + * + * @summary List all Fluid Relay containers which are children of a given Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_ListByFluidRelayServer.json + */ +async function listAllFluidRelayContainersInAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayContainers.listByFluidRelayServers( + resourceGroup, + fluidRelayServerName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayContainersInAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayOperationsListSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayOperationsListSample.ts new file mode 100644 index 000000000000..6413cc0a867e --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayOperationsListSample.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all operations provided by Microsoft.FluidRelay. + * + * @summary List all operations provided by Microsoft.FluidRelay. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServerOperations.json + */ +async function listFluidRelayServerOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listFluidRelayServerOperations().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersCreateOrUpdateSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersCreateOrUpdateSample.ts new file mode 100644 index 000000000000..50cb77a2e1cd --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersCreateOrUpdateSample.ts @@ -0,0 +1,121 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + FluidRelayServer, + FluidRelayManagementClient +} from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateOrUpdate.json + */ +async function createAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource: FluidRelayServer = { + identity: { type: "SystemAssigned" }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" } + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServer().catch(console.error); + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateWithAmi.json + */ +async function createAFluidRelayServerWithAmi() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource: FluidRelayServer = { + identity: { + type: "SystemAssigned, UserAssigned", + userAssignedIdentities: { + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": {}, + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/id2": {} + } + }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" } + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServerWithAmi().catch(console.error); + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateWithCmk.json + */ +async function createAFluidRelayServerWithCmk() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource: FluidRelayServer = { + encryption: { + customerManagedKeyEncryption: { + keyEncryptionKeyIdentity: { + identityType: "UserAssigned", + userAssignedIdentityResourceId: + "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityForCMK" + }, + keyEncryptionKeyUrl: + "https://contosovault.vault.azure.net/keys/contosokek" + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identityForCMK": {} + } + }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" } + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServerWithCmk().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersDeleteSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersDeleteSample.ts new file mode 100644 index 000000000000..3aa92cad3994 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a Fluid Relay server. + * + * @summary Delete a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Delete.json + */ +async function deleteAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.delete( + resourceGroup, + fluidRelayServerName + ); + console.log(result); +} + +deleteAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersGetSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersGetSample.ts new file mode 100644 index 000000000000..2be0e0ddd91d --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a Fluid Relay server. + * + * @summary Get a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Get.json + */ +async function getFluidRelayServerDetails() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.get( + resourceGroup, + fluidRelayServerName + ); + console.log(result); +} + +getFluidRelayServerDetails().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListByResourceGroupSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListByResourceGroupSample.ts new file mode 100644 index 000000000000..099a5a426440 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all Fluid Relay servers in a resource group. + * + * @summary List all Fluid Relay servers in a resource group. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListByResourceGroup.json + */ +async function listAllFluidRelayServersInAResourceGroup() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayServers.listByResourceGroup( + resourceGroup + )) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayServersInAResourceGroup().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListBySubscriptionSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListBySubscriptionSample.ts new file mode 100644 index 000000000000..074df6d7c5cc --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListBySubscriptionSample.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all Fluid Relay servers in a subscription. + * + * @summary List all Fluid Relay servers in a subscription. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListBySubscription.json + */ +async function listAllFluidRelayServersInASubscription() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayServers.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayServersInASubscription().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListKeysSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListKeysSample.ts new file mode 100644 index 000000000000..c679f50972f7 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersListKeysSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get primary and secondary key for this server. + * + * @summary Get primary and secondary key for this server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListKeys.json + */ +async function getKeysForAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.listKeys( + resourceGroup, + fluidRelayServerName + ); + console.log(result); +} + +getKeysForAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersRegenerateKeySample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersRegenerateKeySample.ts new file mode 100644 index 000000000000..2e8f1b5bc8b5 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersRegenerateKeySample.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RegenerateKeyRequest, + FluidRelayManagementClient +} from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Regenerate the primary or secondary key for this server. + * + * @summary Regenerate the primary or secondary key for this server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_RegenerateKeys.json + */ +async function regenerateKeysForAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const parameters: RegenerateKeyRequest = { keyName: "key1" }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.regenerateKey( + resourceGroup, + fluidRelayServerName, + parameters + ); + console.log(result); +} + +regenerateKeysForAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersUpdateSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersUpdateSample.ts new file mode 100644 index 000000000000..462aee5f7b00 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples-dev/fluidRelayServersUpdateSample.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + FluidRelayServerUpdate, + FluidRelayManagementClient +} from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a Fluid Relay server. + * + * @summary Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Update.json + */ +async function updateAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource: FluidRelayServerUpdate = { tags: { category: "sales" } }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.update( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +updateAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/README.md b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/README.md new file mode 100644 index 000000000000..4f63afb0553d --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/README.md @@ -0,0 +1,72 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [fluidRelayContainersDeleteSample.js][fluidrelaycontainersdeletesample] | Delete a Fluid Relay container. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Delete.json | +| [fluidRelayContainersGetSample.js][fluidrelaycontainersgetsample] | Get a Fluid Relay container. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Get.json | +| [fluidRelayContainersListByFluidRelayServersSample.js][fluidrelaycontainerslistbyfluidrelayserverssample] | List all Fluid Relay containers which are children of a given Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_ListByFluidRelayServer.json | +| [fluidRelayOperationsListSample.js][fluidrelayoperationslistsample] | List all operations provided by Microsoft.FluidRelay. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServerOperations.json | +| [fluidRelayServersCreateOrUpdateSample.js][fluidrelayserverscreateorupdatesample] | Create or Update a Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateOrUpdate.json | +| [fluidRelayServersDeleteSample.js][fluidrelayserversdeletesample] | Delete a Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Delete.json | +| [fluidRelayServersGetSample.js][fluidrelayserversgetsample] | Get a Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Get.json | +| [fluidRelayServersListByResourceGroupSample.js][fluidrelayserverslistbyresourcegroupsample] | List all Fluid Relay servers in a resource group. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListByResourceGroup.json | +| [fluidRelayServersListBySubscriptionSample.js][fluidrelayserverslistbysubscriptionsample] | List all Fluid Relay servers in a subscription. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListBySubscription.json | +| [fluidRelayServersListKeysSample.js][fluidrelayserverslistkeyssample] | Get primary and secondary key for this server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListKeys.json | +| [fluidRelayServersRegenerateKeySample.js][fluidrelayserversregeneratekeysample] | Regenerate the primary or secondary key for this server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_RegenerateKeys.json | +| [fluidRelayServersUpdateSample.js][fluidrelayserversupdatesample] | Update a Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Update.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node fluidRelayContainersDeleteSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node fluidRelayContainersDeleteSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[fluidrelaycontainersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersDeleteSample.js +[fluidrelaycontainersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersGetSample.js +[fluidrelaycontainerslistbyfluidrelayserverssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersListByFluidRelayServersSample.js +[fluidrelayoperationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayOperationsListSample.js +[fluidrelayserverscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersCreateOrUpdateSample.js +[fluidrelayserversdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersDeleteSample.js +[fluidrelayserversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersGetSample.js +[fluidrelayserverslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListByResourceGroupSample.js +[fluidrelayserverslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListBySubscriptionSample.js +[fluidrelayserverslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListKeysSample.js +[fluidrelayserversregeneratekeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersRegenerateKeySample.js +[fluidrelayserversupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersUpdateSample.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-fluidrelay?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fluidrelay/arm-fluidrelay/README.md diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersDeleteSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersDeleteSample.js new file mode 100644 index 000000000000..356718e5fc98 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersDeleteSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete a Fluid Relay container. + * + * @summary Delete a Fluid Relay container. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Delete.json + */ +async function deleteAFluidRelayContainer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const fluidRelayContainerName = "myFluidRelayContainer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayContainers.delete( + resourceGroup, + fluidRelayServerName, + fluidRelayContainerName + ); + console.log(result); +} + +deleteAFluidRelayContainer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersGetSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersGetSample.js new file mode 100644 index 000000000000..d4cfc4509cbd --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersGetSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a Fluid Relay container. + * + * @summary Get a Fluid Relay container. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Get.json + */ +async function getFluidRelayContainerDetails() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const fluidRelayContainerName = "myFluidRelayContainer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayContainers.get( + resourceGroup, + fluidRelayServerName, + fluidRelayContainerName + ); + console.log(result); +} + +getFluidRelayContainerDetails().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersListByFluidRelayServersSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersListByFluidRelayServersSample.js new file mode 100644 index 000000000000..b2865cace7a7 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayContainersListByFluidRelayServersSample.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all Fluid Relay containers which are children of a given Fluid Relay server. + * + * @summary List all Fluid Relay containers which are children of a given Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_ListByFluidRelayServer.json + */ +async function listAllFluidRelayContainersInAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayContainers.listByFluidRelayServers( + resourceGroup, + fluidRelayServerName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayContainersInAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayOperationsListSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayOperationsListSample.js new file mode 100644 index 000000000000..e30876c0d798 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayOperationsListSample.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all operations provided by Microsoft.FluidRelay. + * + * @summary List all operations provided by Microsoft.FluidRelay. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServerOperations.json + */ +async function listFluidRelayServerOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listFluidRelayServerOperations().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersCreateOrUpdateSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersCreateOrUpdateSample.js new file mode 100644 index 000000000000..2cad204424c6 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersCreateOrUpdateSample.js @@ -0,0 +1,120 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateOrUpdate.json + */ +async function createAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource = { + identity: { type: "SystemAssigned" }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" }, + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServer().catch(console.error); + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateWithAmi.json + */ +async function createAFluidRelayServerWithAmi() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource = { + identity: { + type: "SystemAssigned, UserAssigned", + userAssignedIdentities: { + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": + {}, + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/id2": + {}, + }, + }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" }, + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServerWithAmi().catch(console.error); + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateWithCmk.json + */ +async function createAFluidRelayServerWithCmk() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource = { + encryption: { + customerManagedKeyEncryption: { + keyEncryptionKeyIdentity: { + identityType: "UserAssigned", + userAssignedIdentityResourceId: + "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityForCMK", + }, + keyEncryptionKeyUrl: "https://contosovault.vault.azure.net/keys/contosokek", + }, + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identityForCMK": + {}, + }, + }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" }, + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServerWithCmk().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersDeleteSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersDeleteSample.js new file mode 100644 index 000000000000..add2ec1cd598 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersDeleteSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Delete a Fluid Relay server. + * + * @summary Delete a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Delete.json + */ +async function deleteAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.delete(resourceGroup, fluidRelayServerName); + console.log(result); +} + +deleteAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersGetSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersGetSample.js new file mode 100644 index 000000000000..4d1324f63965 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersGetSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get a Fluid Relay server. + * + * @summary Get a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Get.json + */ +async function getFluidRelayServerDetails() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.get(resourceGroup, fluidRelayServerName); + console.log(result); +} + +getFluidRelayServerDetails().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListByResourceGroupSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListByResourceGroupSample.js new file mode 100644 index 000000000000..c1500d2d2260 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListByResourceGroupSample.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all Fluid Relay servers in a resource group. + * + * @summary List all Fluid Relay servers in a resource group. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListByResourceGroup.json + */ +async function listAllFluidRelayServersInAResourceGroup() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayServers.listByResourceGroup(resourceGroup)) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayServersInAResourceGroup().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListBySubscriptionSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListBySubscriptionSample.js new file mode 100644 index 000000000000..8e0f0c32a59a --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListBySubscriptionSample.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to List all Fluid Relay servers in a subscription. + * + * @summary List all Fluid Relay servers in a subscription. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListBySubscription.json + */ +async function listAllFluidRelayServersInASubscription() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayServers.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayServersInASubscription().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListKeysSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListKeysSample.js new file mode 100644 index 000000000000..523d554f596a --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersListKeysSample.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Get primary and secondary key for this server. + * + * @summary Get primary and secondary key for this server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListKeys.json + */ +async function getKeysForAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.listKeys(resourceGroup, fluidRelayServerName); + console.log(result); +} + +getKeysForAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersRegenerateKeySample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersRegenerateKeySample.js new file mode 100644 index 000000000000..63afdd8d968d --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersRegenerateKeySample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Regenerate the primary or secondary key for this server. + * + * @summary Regenerate the primary or secondary key for this server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_RegenerateKeys.json + */ +async function regenerateKeysForAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const parameters = { keyName: "key1" }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.regenerateKey( + resourceGroup, + fluidRelayServerName, + parameters + ); + console.log(result); +} + +regenerateKeysForAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersUpdateSample.js b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersUpdateSample.js new file mode 100644 index 000000000000..a33a1eff721e --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/fluidRelayServersUpdateSample.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +const { FluidRelayManagementClient } = require("@azure/arm-fluidrelay"); +const { DefaultAzureCredential } = require("@azure/identity"); + +/** + * This sample demonstrates how to Update a Fluid Relay server. + * + * @summary Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Update.json + */ +async function updateAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource = { tags: { category: "sales" } }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.update( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +updateAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/package.json b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/package.json new file mode 100644 index 000000000000..5c1d61f3a24a --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "@azure-samples/arm-fluidrelay-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/fluidrelay/arm-fluidrelay" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fluidrelay/arm-fluidrelay", + "dependencies": { + "@azure/arm-fluidrelay": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/sample.env b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/README.md b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/README.md new file mode 100644 index 000000000000..73a654e61ac1 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/README.md @@ -0,0 +1,85 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [fluidRelayContainersDeleteSample.ts][fluidrelaycontainersdeletesample] | Delete a Fluid Relay container. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Delete.json | +| [fluidRelayContainersGetSample.ts][fluidrelaycontainersgetsample] | Get a Fluid Relay container. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Get.json | +| [fluidRelayContainersListByFluidRelayServersSample.ts][fluidrelaycontainerslistbyfluidrelayserverssample] | List all Fluid Relay containers which are children of a given Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_ListByFluidRelayServer.json | +| [fluidRelayOperationsListSample.ts][fluidrelayoperationslistsample] | List all operations provided by Microsoft.FluidRelay. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServerOperations.json | +| [fluidRelayServersCreateOrUpdateSample.ts][fluidrelayserverscreateorupdatesample] | Create or Update a Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateOrUpdate.json | +| [fluidRelayServersDeleteSample.ts][fluidrelayserversdeletesample] | Delete a Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Delete.json | +| [fluidRelayServersGetSample.ts][fluidrelayserversgetsample] | Get a Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Get.json | +| [fluidRelayServersListByResourceGroupSample.ts][fluidrelayserverslistbyresourcegroupsample] | List all Fluid Relay servers in a resource group. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListByResourceGroup.json | +| [fluidRelayServersListBySubscriptionSample.ts][fluidrelayserverslistbysubscriptionsample] | List all Fluid Relay servers in a subscription. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListBySubscription.json | +| [fluidRelayServersListKeysSample.ts][fluidrelayserverslistkeyssample] | Get primary and secondary key for this server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListKeys.json | +| [fluidRelayServersRegenerateKeySample.ts][fluidrelayserversregeneratekeysample] | Regenerate the primary or secondary key for this server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_RegenerateKeys.json | +| [fluidRelayServersUpdateSample.ts][fluidrelayserversupdatesample] | Update a Fluid Relay server. x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Update.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/fluidRelayContainersDeleteSample.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/fluidRelayContainersDeleteSample.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[fluidrelaycontainersdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersDeleteSample.ts +[fluidrelaycontainersgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersGetSample.ts +[fluidrelaycontainerslistbyfluidrelayserverssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersListByFluidRelayServersSample.ts +[fluidrelayoperationslistsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayOperationsListSample.ts +[fluidrelayserverscreateorupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersCreateOrUpdateSample.ts +[fluidrelayserversdeletesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersDeleteSample.ts +[fluidrelayserversgetsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersGetSample.ts +[fluidrelayserverslistbyresourcegroupsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListByResourceGroupSample.ts +[fluidrelayserverslistbysubscriptionsample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListBySubscriptionSample.ts +[fluidrelayserverslistkeyssample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListKeysSample.ts +[fluidrelayserversregeneratekeysample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersRegenerateKeySample.ts +[fluidrelayserversupdatesample]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersUpdateSample.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-fluidrelay?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fluidrelay/arm-fluidrelay/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/package.json b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/package.json new file mode 100644 index 000000000000..b62f890a74e2 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "@azure-samples/arm-fluidrelay-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/fluidrelay/arm-fluidrelay" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/fluidrelay/arm-fluidrelay", + "dependencies": { + "@azure/arm-fluidrelay": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/sample.env b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/sample.env new file mode 100644 index 000000000000..672847a3fea0 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersDeleteSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersDeleteSample.ts new file mode 100644 index 000000000000..def53a31f961 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersDeleteSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a Fluid Relay container. + * + * @summary Delete a Fluid Relay container. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Delete.json + */ +async function deleteAFluidRelayContainer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const fluidRelayContainerName = "myFluidRelayContainer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayContainers.delete( + resourceGroup, + fluidRelayServerName, + fluidRelayContainerName + ); + console.log(result); +} + +deleteAFluidRelayContainer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersGetSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersGetSample.ts new file mode 100644 index 000000000000..37637abede57 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersGetSample.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a Fluid Relay container. + * + * @summary Get a Fluid Relay container. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_Get.json + */ +async function getFluidRelayContainerDetails() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const fluidRelayContainerName = "myFluidRelayContainer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayContainers.get( + resourceGroup, + fluidRelayServerName, + fluidRelayContainerName + ); + console.log(result); +} + +getFluidRelayContainerDetails().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersListByFluidRelayServersSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersListByFluidRelayServersSample.ts new file mode 100644 index 000000000000..8ccfa3000977 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayContainersListByFluidRelayServersSample.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all Fluid Relay containers which are children of a given Fluid Relay server. + * + * @summary List all Fluid Relay containers which are children of a given Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayContainers_ListByFluidRelayServer.json + */ +async function listAllFluidRelayContainersInAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayContainers.listByFluidRelayServers( + resourceGroup, + fluidRelayServerName + )) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayContainersInAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayOperationsListSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayOperationsListSample.ts new file mode 100644 index 000000000000..6413cc0a867e --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayOperationsListSample.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all operations provided by Microsoft.FluidRelay. + * + * @summary List all operations provided by Microsoft.FluidRelay. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServerOperations.json + */ +async function listFluidRelayServerOperations() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayOperations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +listFluidRelayServerOperations().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersCreateOrUpdateSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersCreateOrUpdateSample.ts new file mode 100644 index 000000000000..50cb77a2e1cd --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersCreateOrUpdateSample.ts @@ -0,0 +1,121 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + FluidRelayServer, + FluidRelayManagementClient +} from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateOrUpdate.json + */ +async function createAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource: FluidRelayServer = { + identity: { type: "SystemAssigned" }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" } + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServer().catch(console.error); + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateWithAmi.json + */ +async function createAFluidRelayServerWithAmi() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource: FluidRelayServer = { + identity: { + type: "SystemAssigned, UserAssigned", + userAssignedIdentities: { + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/id1": {}, + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/id2": {} + } + }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" } + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServerWithAmi().catch(console.error); + +/** + * This sample demonstrates how to Create or Update a Fluid Relay server. + * + * @summary Create or Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_CreateWithCmk.json + */ +async function createAFluidRelayServerWithCmk() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource: FluidRelayServer = { + encryption: { + customerManagedKeyEncryption: { + keyEncryptionKeyIdentity: { + identityType: "UserAssigned", + userAssignedIdentityResourceId: + "/subscriptions/xxxx-xxxx-xxxx-xxxx/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identityForCMK" + }, + keyEncryptionKeyUrl: + "https://contosovault.vault.azure.net/keys/contosokek" + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/xxxxXxxxXxxxXxxx/resourceGroups/myResourceGroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identityForCMK": {} + } + }, + location: "west-us", + storagesku: "basic", + tags: { category: "sales" } + }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.createOrUpdate( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +createAFluidRelayServerWithCmk().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersDeleteSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersDeleteSample.ts new file mode 100644 index 000000000000..3aa92cad3994 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersDeleteSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Delete a Fluid Relay server. + * + * @summary Delete a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Delete.json + */ +async function deleteAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.delete( + resourceGroup, + fluidRelayServerName + ); + console.log(result); +} + +deleteAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersGetSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersGetSample.ts new file mode 100644 index 000000000000..2be0e0ddd91d --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersGetSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get a Fluid Relay server. + * + * @summary Get a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Get.json + */ +async function getFluidRelayServerDetails() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.get( + resourceGroup, + fluidRelayServerName + ); + console.log(result); +} + +getFluidRelayServerDetails().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListByResourceGroupSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListByResourceGroupSample.ts new file mode 100644 index 000000000000..099a5a426440 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListByResourceGroupSample.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. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all Fluid Relay servers in a resource group. + * + * @summary List all Fluid Relay servers in a resource group. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListByResourceGroup.json + */ +async function listAllFluidRelayServersInAResourceGroup() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayServers.listByResourceGroup( + resourceGroup + )) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayServersInAResourceGroup().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListBySubscriptionSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListBySubscriptionSample.ts new file mode 100644 index 000000000000..074df6d7c5cc --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListBySubscriptionSample.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to List all Fluid Relay servers in a subscription. + * + * @summary List all Fluid Relay servers in a subscription. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListBySubscription.json + */ +async function listAllFluidRelayServersInASubscription() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.fluidRelayServers.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +listAllFluidRelayServersInASubscription().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListKeysSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListKeysSample.ts new file mode 100644 index 000000000000..c679f50972f7 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersListKeysSample.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { FluidRelayManagementClient } from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Get primary and secondary key for this server. + * + * @summary Get primary and secondary key for this server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_ListKeys.json + */ +async function getKeysForAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.listKeys( + resourceGroup, + fluidRelayServerName + ); + console.log(result); +} + +getKeysForAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersRegenerateKeySample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersRegenerateKeySample.ts new file mode 100644 index 000000000000..2e8f1b5bc8b5 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersRegenerateKeySample.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + RegenerateKeyRequest, + FluidRelayManagementClient +} from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Regenerate the primary or secondary key for this server. + * + * @summary Regenerate the primary or secondary key for this server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_RegenerateKeys.json + */ +async function regenerateKeysForAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const parameters: RegenerateKeyRequest = { keyName: "key1" }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.regenerateKey( + resourceGroup, + fluidRelayServerName, + parameters + ); + console.log(result); +} + +regenerateKeysForAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersUpdateSample.ts b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersUpdateSample.ts new file mode 100644 index 000000000000..462aee5f7b00 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/src/fluidRelayServersUpdateSample.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +import { + FluidRelayServerUpdate, + FluidRelayManagementClient +} from "@azure/arm-fluidrelay"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to Update a Fluid Relay server. + * + * @summary Update a Fluid Relay server. + * x-ms-original-file: specification/fluidrelay/resource-manager/Microsoft.FluidRelay/stable/2022-06-01/examples/FluidRelayServers_Update.json + */ +async function updateAFluidRelayServer() { + const subscriptionId = "xxxx-xxxx-xxxx-xxxx"; + const resourceGroup = "myResourceGroup"; + const fluidRelayServerName = "myFluidRelayServer"; + const resource: FluidRelayServerUpdate = { tags: { category: "sales" } }; + const credential = new DefaultAzureCredential(); + const client = new FluidRelayManagementClient(credential, subscriptionId); + const result = await client.fluidRelayServers.update( + resourceGroup, + fluidRelayServerName, + resource + ); + console.log(result); +} + +updateAFluidRelayServer().catch(console.error); diff --git a/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/tsconfig.json b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/tsconfig.json new file mode 100644 index 000000000000..416c2dd82e00 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/samples/v1/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/fluidrelay/arm-fluidrelay/src/fluidRelayManagementClient.ts b/sdk/fluidrelay/arm-fluidrelay/src/fluidRelayManagementClient.ts new file mode 100644 index 000000000000..2112a79aab24 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/fluidRelayManagementClient.ts @@ -0,0 +1,146 @@ +/* + * 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 { + FluidRelayOperationsImpl, + FluidRelayServersImpl, + FluidRelayContainersImpl +} from "./operations"; +import { + FluidRelayOperations, + FluidRelayServers, + FluidRelayContainers +} from "./operationsInterfaces"; +import { FluidRelayManagementClientOptionalParams } from "./models"; + +export class FluidRelayManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the FluidRelayManagementClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The subscription id (GUID) for this resource. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: FluidRelayManagementClientOptionalParams + ) { + 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: FluidRelayManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-fluidrelay/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-06-01"; + this.fluidRelayOperations = new FluidRelayOperationsImpl(this); + this.fluidRelayServers = new FluidRelayServersImpl(this); + this.fluidRelayContainers = new FluidRelayContainersImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + fluidRelayOperations: FluidRelayOperations; + fluidRelayServers: FluidRelayServers; + fluidRelayContainers: FluidRelayContainers; +} diff --git a/sdk/fluidrelay/arm-fluidrelay/src/index.ts b/sdk/fluidrelay/arm-fluidrelay/src/index.ts new file mode 100644 index 000000000000..7e0288c312d9 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/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 { FluidRelayManagementClient } from "./fluidRelayManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/fluidrelay/arm-fluidrelay/src/models/index.ts b/sdk/fluidrelay/arm-fluidrelay/src/models/index.ts new file mode 100644 index 000000000000..e0667da34b23 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/models/index.ts @@ -0,0 +1,512 @@ +/* + * 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"; + +/** Result of GET request to list FluidRelay operations. */ +export interface OperationListResult { + /** List of FluidRelay operations supported by the Microsoft.FluidRelay provider. */ + value?: OperationResult[]; + /** URL to get the next set of operation list results if there are any. */ + nextLink?: string; +} + +/** A FluidRelay REST API operation. */ +export interface OperationResult { + /** Operation name: {provider}/{resource}/{operation} */ + name?: string; + /** The object that represents the operation. */ + display?: OperationDisplay; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; +} + +/** The object that represents the operation. */ +export interface OperationDisplay { + /** Service provider: Microsoft.FluidRelay */ + provider?: string; + /** Type on which the operation is performed, e.g., 'servers'. */ + resource?: string; + /** Operation type, e.g., read, write, delete, etc. */ + operation?: string; + /** Description of the operation, e.g., 'Write confluent'. */ + 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 Fluid Relay endpoints for this server */ +export interface FluidRelayEndpoints { + /** + * The Fluid Relay Orderer endpoints. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly ordererEndpoints?: string[]; + /** + * The Fluid Relay storage endpoints. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly storageEndpoints?: string[]; + /** + * The Fluid Relay service endpoints. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly serviceEndpoints?: string[]; +} + +/** All encryption configuration for a resource. */ +export interface EncryptionProperties { + /** All Customer-managed key encryption properties for the resource. */ + customerManagedKeyEncryption?: CustomerManagedKeyEncryptionProperties; +} + +/** All Customer-managed key encryption properties for the resource. */ +export interface CustomerManagedKeyEncryptionProperties { + /** All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. */ + keyEncryptionKeyIdentity?: CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity; + /** key encryption key Url, with or without a version. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. Key auto rotation is enabled by providing a key uri without version. Otherwise, customer is responsible for rotating the key. The keyEncryptionKeyIdentity(either SystemAssigned or UserAssigned) should have permission to access this key url. */ + keyEncryptionKeyUrl?: string; +} + +/** All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. */ +export interface CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity { + /** Values can be SystemAssigned or UserAssigned */ + identityType?: CmkIdentityType; + /** user assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. */ + userAssignedIdentityResourceId?: string; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +/** Identity for the resource. */ +export interface Identity { + /** + * The principal ID of resource identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID of resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** The identity type. */ + type?: ResourceIdentityType; + /** The list of user identities associated with the resource. */ + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentitiesValue; + }; +} + +export interface UserAssignedIdentitiesValue { + /** + * The principal id of user assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The client id of user assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** + * Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** The updatable properties of a Fluid Relay server */ +export interface FluidRelayServerUpdate { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The type of identity used for the resource. */ + identity?: Identity; + /** The geo-location where the resource lives */ + location?: string; + /** All encryption configuration for a resource. */ + encryption?: EncryptionProperties; +} + +/** Specifies which key should be generated. */ +export interface RegenerateKeyRequest { + /** The key to regenerate. */ + keyName: KeyName; +} + +/** The set of available keys for this server. */ +export interface FluidRelayServerKeys { + /** + * The primary key for this server + * This value contains a credential. Consider obscuring before showing to users + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly key1?: string; + /** + * The secondary key for this server + * This value contains a credential. Consider obscuring before showing to users + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly key2?: string; +} + +/** Paged response */ +export interface FluidRelayServerList { + /** A sequence of FluidRelay servers. */ + value: FluidRelayServer[]; + /** A link to the next page of results, if any. */ + nextLink?: string; +} + +/** Paged response */ +export interface FluidRelayContainerList { + /** A sequence of FluidRelay containers. */ + value?: FluidRelayContainer[]; + /** + * A link to the next page of results, if any. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +} + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export interface ProxyResource extends Resource {} + +/** A FluidRelay Server. */ +export interface FluidRelayServer extends TrackedResource { + /** + * System meta data for this resource, including creation and modification information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** The type of identity used for the resource. */ + identity?: Identity; + /** + * The Fluid tenantId for this server + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly frsTenantId?: string; + /** + * The Fluid Relay Service endpoints for this server. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly fluidRelayEndpoints?: FluidRelayEndpoints; + /** Provision states for FluidRelay RP */ + provisioningState?: ProvisioningState; + /** All encryption configuration for a resource. */ + encryption?: EncryptionProperties; + /** Sku of the storage associated with the resource */ + storagesku?: StorageSKU; +} + +/** A FluidRelay Container. */ +export interface FluidRelayContainer extends ProxyResource { + /** + * System meta data for this resource, including creation and modification information. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** + * The Fluid tenantId for this container + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly frsTenantId?: string; + /** + * The frsContainerId for this container + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly frsContainerId?: string; + /** + * Provision states for FluidRelay RP + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** + * The creation time of this resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly creationTime?: Date; + /** + * Last time when user access this resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastAccessTime?: Date; +} + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + /** Succeeded */ + Succeeded = "Succeeded", + /** Failed */ + Failed = "Failed", + /** Canceled */ + Canceled = "Canceled" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Canceled** + */ +export type ProvisioningState = string; + +/** Known values of {@link StorageSKU} that the service accepts. */ +export enum KnownStorageSKU { + /** Standard */ + Standard = "standard", + /** Basic */ + Basic = "basic" +} + +/** + * Defines values for StorageSKU. \ + * {@link KnownStorageSKU} can be used interchangeably with StorageSKU, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **standard** \ + * **basic** + */ +export type StorageSKU = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + /** User */ + User = "User", + /** Application */ + Application = "Application", + /** ManagedIdentity */ + ManagedIdentity = "ManagedIdentity", + /** Key */ + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; +/** Defines values for CmkIdentityType. */ +export type CmkIdentityType = "SystemAssigned" | "UserAssigned"; +/** Defines values for ResourceIdentityType. */ +export type ResourceIdentityType = + | "SystemAssigned" + | "UserAssigned" + | "SystemAssigned, UserAssigned" + | "None"; +/** Defines values for KeyName. */ +export type KeyName = "key1" | "key2"; + +/** Optional parameters. */ +export interface FluidRelayOperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type FluidRelayOperationsListResponse = OperationListResult; + +/** Optional parameters. */ +export interface FluidRelayOperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type FluidRelayOperationsListNextResponse = OperationListResult; + +/** Optional parameters. */ +export interface FluidRelayServersGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type FluidRelayServersGetResponse = FluidRelayServer; + +/** Optional parameters. */ +export interface FluidRelayServersCreateOrUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the createOrUpdate operation. */ +export type FluidRelayServersCreateOrUpdateResponse = FluidRelayServer; + +/** Optional parameters. */ +export interface FluidRelayServersUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type FluidRelayServersUpdateResponse = FluidRelayServer; + +/** Optional parameters. */ +export interface FluidRelayServersDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FluidRelayServersRegenerateKeyOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the regenerateKey operation. */ +export type FluidRelayServersRegenerateKeyResponse = FluidRelayServerKeys; + +/** Optional parameters. */ +export interface FluidRelayServersListKeysOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listKeys operation. */ +export type FluidRelayServersListKeysResponse = FluidRelayServerKeys; + +/** Optional parameters. */ +export interface FluidRelayServersListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type FluidRelayServersListBySubscriptionResponse = FluidRelayServerList; + +/** Optional parameters. */ +export interface FluidRelayServersListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type FluidRelayServersListByResourceGroupResponse = FluidRelayServerList; + +/** Optional parameters. */ +export interface FluidRelayServersListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type FluidRelayServersListBySubscriptionNextResponse = FluidRelayServerList; + +/** Optional parameters. */ +export interface FluidRelayServersListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type FluidRelayServersListByResourceGroupNextResponse = FluidRelayServerList; + +/** Optional parameters. */ +export interface FluidRelayContainersGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type FluidRelayContainersGetResponse = FluidRelayContainer; + +/** Optional parameters. */ +export interface FluidRelayContainersDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface FluidRelayContainersListByFluidRelayServersOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByFluidRelayServers operation. */ +export type FluidRelayContainersListByFluidRelayServersResponse = FluidRelayContainerList; + +/** Optional parameters. */ +export interface FluidRelayContainersListByFluidRelayServersNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByFluidRelayServersNext operation. */ +export type FluidRelayContainersListByFluidRelayServersNextResponse = FluidRelayContainerList; + +/** Optional parameters. */ +export interface FluidRelayManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/fluidrelay/arm-fluidrelay/src/models/mappers.ts b/sdk/fluidrelay/arm-fluidrelay/src/models/mappers.ts new file mode 100644 index 000000000000..82c66bc21c01 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/models/mappers.ts @@ -0,0 +1,719 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResult" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const OperationResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResult", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + 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 FluidRelayEndpoints: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FluidRelayEndpoints", + modelProperties: { + ordererEndpoints: { + serializedName: "ordererEndpoints", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + storageEndpoints: { + serializedName: "storageEndpoints", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + serviceEndpoints: { + serializedName: "serviceEndpoints", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const EncryptionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EncryptionProperties", + modelProperties: { + customerManagedKeyEncryption: { + serializedName: "customerManagedKeyEncryption", + type: { + name: "Composite", + className: "CustomerManagedKeyEncryptionProperties" + } + } + } + } +}; + +export const CustomerManagedKeyEncryptionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CustomerManagedKeyEncryptionProperties", + modelProperties: { + keyEncryptionKeyIdentity: { + serializedName: "keyEncryptionKeyIdentity", + type: { + name: "Composite", + className: + "CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity" + } + }, + keyEncryptionKeyUrl: { + serializedName: "keyEncryptionKeyUrl", + type: { + name: "String" + } + } + } + } +}; + +export const CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CustomerManagedKeyEncryptionPropertiesKeyEncryptionKeyIdentity", + modelProperties: { + identityType: { + serializedName: "identityType", + type: { + name: "Enum", + allowedValues: ["SystemAssigned", "UserAssigned"] + } + }, + userAssignedIdentityResourceId: { + serializedName: "userAssignedIdentityResourceId", + type: { + name: "String" + } + } + } + } +}; + +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 Identity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Identity", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + type: { + name: "Enum", + allowedValues: [ + "SystemAssigned", + "UserAssigned", + "SystemAssigned, UserAssigned", + "None" + ] + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { + name: "Composite", + className: "UserAssignedIdentitiesValue" + } + } + } + } + } + } +}; + +export const UserAssignedIdentitiesValue: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentitiesValue", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const FluidRelayServerUpdate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FluidRelayServerUpdate", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "Identity" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + encryption: { + serializedName: "properties.encryption", + type: { + name: "Composite", + className: "EncryptionProperties" + } + } + } + } +}; + +export const RegenerateKeyRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RegenerateKeyRequest", + modelProperties: { + keyName: { + serializedName: "keyName", + required: true, + type: { + name: "Enum", + allowedValues: ["key1", "key2"] + } + } + } + } +}; + +export const FluidRelayServerKeys: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FluidRelayServerKeys", + modelProperties: { + key1: { + serializedName: "key1", + readOnly: true, + type: { + name: "String" + } + }, + key2: { + serializedName: "key2", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const FluidRelayServerList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FluidRelayServerList", + modelProperties: { + value: { + serializedName: "value", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FluidRelayServer" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const FluidRelayContainerList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FluidRelayContainerList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FluidRelayContainer" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const FluidRelayServer: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FluidRelayServer", + modelProperties: { + ...TrackedResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "Identity" + } + }, + frsTenantId: { + serializedName: "properties.frsTenantId", + readOnly: true, + type: { + name: "String" + } + }, + fluidRelayEndpoints: { + serializedName: "properties.fluidRelayEndpoints", + type: { + name: "Composite", + className: "FluidRelayEndpoints" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + encryption: { + serializedName: "properties.encryption", + type: { + name: "Composite", + className: "EncryptionProperties" + } + }, + storagesku: { + serializedName: "properties.storagesku", + type: { + name: "String" + } + } + } + } +}; + +export const FluidRelayContainer: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FluidRelayContainer", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + frsTenantId: { + serializedName: "properties.frsTenantId", + readOnly: true, + type: { + name: "String" + } + }, + frsContainerId: { + serializedName: "properties.frsContainerId", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + creationTime: { + serializedName: "properties.creationTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastAccessTime: { + serializedName: "properties.lastAccessTime", + readOnly: true, + type: { + name: "DateTime" + } + } + } + } +}; diff --git a/sdk/fluidrelay/arm-fluidrelay/src/models/parameters.ts b/sdk/fluidrelay/arm-fluidrelay/src/models/parameters.ts new file mode 100644 index 000000000000..51c5121fc3d7 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/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 { + FluidRelayServer as FluidRelayServerMapper, + FluidRelayServerUpdate as FluidRelayServerUpdateMapper, + RegenerateKeyRequest as RegenerateKeyRequestMapper +} 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-06-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroup: OperationURLParameter = { + parameterPath: "resourceGroup", + mapper: { + serializedName: "resourceGroup", + required: true, + type: { + name: "String" + } + } +}; + +export const fluidRelayServerName: OperationURLParameter = { + parameterPath: "fluidRelayServerName", + mapper: { + serializedName: "fluidRelayServerName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const resource: OperationParameter = { + parameterPath: "resource", + mapper: FluidRelayServerMapper +}; + +export const resource1: OperationParameter = { + parameterPath: "resource", + mapper: FluidRelayServerUpdateMapper +}; + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: RegenerateKeyRequestMapper +}; + +export const fluidRelayContainerName: OperationURLParameter = { + parameterPath: "fluidRelayContainerName", + mapper: { + serializedName: "fluidRelayContainerName", + required: true, + type: { + name: "String" + } + } +}; diff --git a/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayContainers.ts b/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayContainers.ts new file mode 100644 index 000000000000..2274e225f63c --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayContainers.ts @@ -0,0 +1,276 @@ +/* + * 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 { FluidRelayContainers } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { FluidRelayManagementClient } from "../fluidRelayManagementClient"; +import { + FluidRelayContainer, + FluidRelayContainersListByFluidRelayServersNextOptionalParams, + FluidRelayContainersListByFluidRelayServersOptionalParams, + FluidRelayContainersGetOptionalParams, + FluidRelayContainersGetResponse, + FluidRelayContainersDeleteOptionalParams, + FluidRelayContainersListByFluidRelayServersResponse, + FluidRelayContainersListByFluidRelayServersNextResponse +} from "../models"; + +/// +/** Class containing FluidRelayContainers operations. */ +export class FluidRelayContainersImpl implements FluidRelayContainers { + private readonly client: FluidRelayManagementClient; + + /** + * Initialize a new instance of the class FluidRelayContainers class. + * @param client Reference to the service client + */ + constructor(client: FluidRelayManagementClient) { + this.client = client; + } + + /** + * List all Fluid Relay containers which are children of a given Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + public listByFluidRelayServers( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayContainersListByFluidRelayServersOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByFluidRelayServersPagingAll( + resourceGroup, + fluidRelayServerName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByFluidRelayServersPagingPage( + resourceGroup, + fluidRelayServerName, + options + ); + } + }; + } + + private async *listByFluidRelayServersPagingPage( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayContainersListByFluidRelayServersOptionalParams + ): AsyncIterableIterator { + let result = await this._listByFluidRelayServers( + resourceGroup, + fluidRelayServerName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByFluidRelayServersNext( + resourceGroup, + fluidRelayServerName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByFluidRelayServersPagingAll( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayContainersListByFluidRelayServersOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByFluidRelayServersPagingPage( + resourceGroup, + fluidRelayServerName, + options + )) { + yield* page; + } + } + + /** + * Get a Fluid Relay container. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param fluidRelayContainerName The Fluid Relay container resource name. + * @param options The options parameters. + */ + get( + resourceGroup: string, + fluidRelayServerName: string, + fluidRelayContainerName: string, + options?: FluidRelayContainersGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, fluidRelayContainerName, options }, + getOperationSpec + ); + } + + /** + * Delete a Fluid Relay container. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param fluidRelayContainerName The Fluid Relay container resource name. + * @param options The options parameters. + */ + delete( + resourceGroup: string, + fluidRelayServerName: string, + fluidRelayContainerName: string, + options?: FluidRelayContainersDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, fluidRelayContainerName, options }, + deleteOperationSpec + ); + } + + /** + * List all Fluid Relay containers which are children of a given Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + private _listByFluidRelayServers( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayContainersListByFluidRelayServersOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, options }, + listByFluidRelayServersOperationSpec + ); + } + + /** + * ListByFluidRelayServersNext + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param nextLink The nextLink from the previous successful call to the ListByFluidRelayServers + * method. + * @param options The options parameters. + */ + private _listByFluidRelayServersNext( + resourceGroup: string, + fluidRelayServerName: string, + nextLink: string, + options?: FluidRelayContainersListByFluidRelayServersNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, nextLink, options }, + listByFluidRelayServersNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/fluidRelayContainers/{fluidRelayContainerName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayContainer + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName, + Parameters.fluidRelayContainerName + ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/fluidRelayContainers/{fluidRelayContainerName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName, + Parameters.fluidRelayContainerName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByFluidRelayServersOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/fluidRelayContainers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayContainerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByFluidRelayServersNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayContainerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayOperations.ts b/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayOperations.ts new file mode 100644 index 000000000000..ad13b297fe14 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayOperations.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 { FluidRelayOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { FluidRelayManagementClient } from "../fluidRelayManagementClient"; +import { + OperationResult, + FluidRelayOperationsListNextOptionalParams, + FluidRelayOperationsListOptionalParams, + FluidRelayOperationsListResponse, + FluidRelayOperationsListNextResponse +} from "../models"; + +/// +/** Class containing FluidRelayOperations operations. */ +export class FluidRelayOperationsImpl implements FluidRelayOperations { + private readonly client: FluidRelayManagementClient; + + /** + * Initialize a new instance of the class FluidRelayOperations class. + * @param client Reference to the service client + */ + constructor(client: FluidRelayManagementClient) { + this.client = client; + } + + /** + * List all operations provided by Microsoft.FluidRelay. + * @param options The options parameters. + */ + public list( + options?: FluidRelayOperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: FluidRelayOperationsListOptionalParams + ): 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?: FluidRelayOperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * List all operations provided by Microsoft.FluidRelay. + * @param options The options parameters. + */ + private _list( + options?: FluidRelayOperationsListOptionalParams + ): 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?: FluidRelayOperationsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.FluidRelay/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayServers.ts b/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayServers.ts new file mode 100644 index 000000000000..7d868bdd9b30 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/operations/fluidRelayServers.ts @@ -0,0 +1,534 @@ +/* + * 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 { FluidRelayServers } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { FluidRelayManagementClient } from "../fluidRelayManagementClient"; +import { + FluidRelayServer, + FluidRelayServersListBySubscriptionNextOptionalParams, + FluidRelayServersListBySubscriptionOptionalParams, + FluidRelayServersListByResourceGroupNextOptionalParams, + FluidRelayServersListByResourceGroupOptionalParams, + FluidRelayServersGetOptionalParams, + FluidRelayServersGetResponse, + FluidRelayServersCreateOrUpdateOptionalParams, + FluidRelayServersCreateOrUpdateResponse, + FluidRelayServerUpdate, + FluidRelayServersUpdateOptionalParams, + FluidRelayServersUpdateResponse, + FluidRelayServersDeleteOptionalParams, + RegenerateKeyRequest, + FluidRelayServersRegenerateKeyOptionalParams, + FluidRelayServersRegenerateKeyResponse, + FluidRelayServersListKeysOptionalParams, + FluidRelayServersListKeysResponse, + FluidRelayServersListBySubscriptionResponse, + FluidRelayServersListByResourceGroupResponse, + FluidRelayServersListBySubscriptionNextResponse, + FluidRelayServersListByResourceGroupNextResponse +} from "../models"; + +/// +/** Class containing FluidRelayServers operations. */ +export class FluidRelayServersImpl implements FluidRelayServers { + private readonly client: FluidRelayManagementClient; + + /** + * Initialize a new instance of the class FluidRelayServers class. + * @param client Reference to the service client + */ + constructor(client: FluidRelayManagementClient) { + this.client = client; + } + + /** + * List all Fluid Relay servers in a subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: FluidRelayServersListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: FluidRelayServersListBySubscriptionOptionalParams + ): 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?: FluidRelayServersListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * List all Fluid Relay servers in a resource group. + * @param resourceGroup The resource group containing the resource. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroup: string, + options?: FluidRelayServersListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroup, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroup, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroup: string, + options?: FluidRelayServersListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroup, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroup, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroup: string, + options?: FluidRelayServersListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroup, + options + )) { + yield* page; + } + } + + /** + * Get a Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + get( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayServersGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, options }, + getOperationSpec + ); + } + + /** + * Create or Update a Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param resource The details of the Fluid Relay server resource. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroup: string, + fluidRelayServerName: string, + resource: FluidRelayServer, + options?: FluidRelayServersCreateOrUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, resource, options }, + createOrUpdateOperationSpec + ); + } + + /** + * Update a Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param resource The details of the Fluid Relay server resource included in update calls. + * @param options The options parameters. + */ + update( + resourceGroup: string, + fluidRelayServerName: string, + resource: FluidRelayServerUpdate, + options?: FluidRelayServersUpdateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, resource, options }, + updateOperationSpec + ); + } + + /** + * Delete a Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + delete( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayServersDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, options }, + deleteOperationSpec + ); + } + + /** + * Regenerate the primary or secondary key for this server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param parameters The details of which keys to generate. + * @param options The options parameters. + */ + regenerateKey( + resourceGroup: string, + fluidRelayServerName: string, + parameters: RegenerateKeyRequest, + options?: FluidRelayServersRegenerateKeyOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, parameters, options }, + regenerateKeyOperationSpec + ); + } + + /** + * Get primary and secondary key for this server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + listKeys( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayServersListKeysOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, fluidRelayServerName, options }, + listKeysOperationSpec + ); + } + + /** + * List all Fluid Relay servers in a subscription. + * @param options The options parameters. + */ + private _listBySubscription( + options?: FluidRelayServersListBySubscriptionOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionOperationSpec + ); + } + + /** + * List all Fluid Relay servers in a resource group. + * @param resourceGroup The resource group containing the resource. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroup: string, + options?: FluidRelayServersListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, options }, + listByResourceGroupOperationSpec + ); + } + + /** + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. + */ + private _listBySubscriptionNext( + nextLink: string, + options?: FluidRelayServersListBySubscriptionNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroup The resource group containing the resource. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroup: string, + nextLink: string, + options?: FluidRelayServersListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroup, nextLink, options }, + listByResourceGroupNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServer + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServer + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServer + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.resource1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName + ], + headerParameters: [Parameters.accept], + serializer +}; +const regenerateKeyOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/regenerateKey", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServerKeys + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const listKeysOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers/{fluidRelayServerName}/listKeys", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServerKeys + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup, + Parameters.fluidRelayServerName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.FluidRelay/fluidRelayServers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay/fluidRelayServers", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroup + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.FluidRelayServerList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroup + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/fluidrelay/arm-fluidrelay/src/operations/index.ts b/sdk/fluidrelay/arm-fluidrelay/src/operations/index.ts new file mode 100644 index 000000000000..73c3cfad79b1 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/operations/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./fluidRelayOperations"; +export * from "./fluidRelayServers"; +export * from "./fluidRelayContainers"; diff --git a/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayContainers.ts b/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayContainers.ts new file mode 100644 index 000000000000..98c08aff3aeb --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayContainers.ts @@ -0,0 +1,58 @@ +/* + * 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 { + FluidRelayContainer, + FluidRelayContainersListByFluidRelayServersOptionalParams, + FluidRelayContainersGetOptionalParams, + FluidRelayContainersGetResponse, + FluidRelayContainersDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a FluidRelayContainers. */ +export interface FluidRelayContainers { + /** + * List all Fluid Relay containers which are children of a given Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + listByFluidRelayServers( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayContainersListByFluidRelayServersOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a Fluid Relay container. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param fluidRelayContainerName The Fluid Relay container resource name. + * @param options The options parameters. + */ + get( + resourceGroup: string, + fluidRelayServerName: string, + fluidRelayContainerName: string, + options?: FluidRelayContainersGetOptionalParams + ): Promise; + /** + * Delete a Fluid Relay container. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param fluidRelayContainerName The Fluid Relay container resource name. + * @param options The options parameters. + */ + delete( + resourceGroup: string, + fluidRelayServerName: string, + fluidRelayContainerName: string, + options?: FluidRelayContainersDeleteOptionalParams + ): Promise; +} diff --git a/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayOperations.ts b/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayOperations.ts new file mode 100644 index 000000000000..072019021bed --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayOperations.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 { + OperationResult, + FluidRelayOperationsListOptionalParams +} from "../models"; + +/// +/** Interface representing a FluidRelayOperations. */ +export interface FluidRelayOperations { + /** + * List all operations provided by Microsoft.FluidRelay. + * @param options The options parameters. + */ + list( + options?: FluidRelayOperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayServers.ts b/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayServers.ts new file mode 100644 index 000000000000..d4c75b5b4021 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/fluidRelayServers.ts @@ -0,0 +1,120 @@ +/* + * 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 { + FluidRelayServer, + FluidRelayServersListBySubscriptionOptionalParams, + FluidRelayServersListByResourceGroupOptionalParams, + FluidRelayServersGetOptionalParams, + FluidRelayServersGetResponse, + FluidRelayServersCreateOrUpdateOptionalParams, + FluidRelayServersCreateOrUpdateResponse, + FluidRelayServerUpdate, + FluidRelayServersUpdateOptionalParams, + FluidRelayServersUpdateResponse, + FluidRelayServersDeleteOptionalParams, + RegenerateKeyRequest, + FluidRelayServersRegenerateKeyOptionalParams, + FluidRelayServersRegenerateKeyResponse, + FluidRelayServersListKeysOptionalParams, + FluidRelayServersListKeysResponse +} from "../models"; + +/// +/** Interface representing a FluidRelayServers. */ +export interface FluidRelayServers { + /** + * List all Fluid Relay servers in a subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: FluidRelayServersListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * List all Fluid Relay servers in a resource group. + * @param resourceGroup The resource group containing the resource. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroup: string, + options?: FluidRelayServersListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + get( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayServersGetOptionalParams + ): Promise; + /** + * Create or Update a Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param resource The details of the Fluid Relay server resource. + * @param options The options parameters. + */ + createOrUpdate( + resourceGroup: string, + fluidRelayServerName: string, + resource: FluidRelayServer, + options?: FluidRelayServersCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param resource The details of the Fluid Relay server resource included in update calls. + * @param options The options parameters. + */ + update( + resourceGroup: string, + fluidRelayServerName: string, + resource: FluidRelayServerUpdate, + options?: FluidRelayServersUpdateOptionalParams + ): Promise; + /** + * Delete a Fluid Relay server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + delete( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayServersDeleteOptionalParams + ): Promise; + /** + * Regenerate the primary or secondary key for this server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param parameters The details of which keys to generate. + * @param options The options parameters. + */ + regenerateKey( + resourceGroup: string, + fluidRelayServerName: string, + parameters: RegenerateKeyRequest, + options?: FluidRelayServersRegenerateKeyOptionalParams + ): Promise; + /** + * Get primary and secondary key for this server. + * @param resourceGroup The resource group containing the resource. + * @param fluidRelayServerName The Fluid Relay server resource name. + * @param options The options parameters. + */ + listKeys( + resourceGroup: string, + fluidRelayServerName: string, + options?: FluidRelayServersListKeysOptionalParams + ): Promise; +} diff --git a/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/index.ts b/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..73c3cfad79b1 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/src/operationsInterfaces/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./fluidRelayOperations"; +export * from "./fluidRelayServers"; +export * from "./fluidRelayContainers"; diff --git a/sdk/fluidrelay/arm-fluidrelay/test/sampleTest.ts b/sdk/fluidrelay/arm-fluidrelay/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/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/fluidrelay/arm-fluidrelay/tsconfig.json b/sdk/fluidrelay/arm-fluidrelay/tsconfig.json new file mode 100644 index 000000000000..86224d016e3d --- /dev/null +++ b/sdk/fluidrelay/arm-fluidrelay/tsconfig.json @@ -0,0 +1,33 @@ +{ + "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, + "paths": { + "@azure/arm-fluidrelay": [ + "./src/index" + ] + } + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts", + "samples-dev/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/fluidrelay/ci.mgmt.yml b/sdk/fluidrelay/ci.mgmt.yml new file mode 100644 index 000000000000..2a44349adcd2 --- /dev/null +++ b/sdk/fluidrelay/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/fluidrelay/arm-fluidrelay + - sdk/fluidrelay/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/fluidrelay/arm-fluidrelay + - sdk/fluidrelay/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: fluidrelay + Artifacts: + - name: azure-arm-fluidrelay + safeName: azurearmfluidrelay + \ No newline at end of file